Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2006 17:06:36 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96417 for review
Message-ID:  <200604301706.k3UH6aTd043714@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96417

Change 96417 by scottl@scottl-junior on 2006/04/30 17:05:53

	Take a stab at fixing the problems with crashdumps.  xpt_done assumes
	that it is always safe to call swi_sched, even when in a panic state
	where the scheduler is in an unknown state.  swi_sched should be
	fixed to not blow up the scheduler in this scenario, but we also need
	to make CAM more deterministic.  So when a periph goes into poll
	driving more, mark a flag so that xpt_done knows not to bother with
	swi_sched.  It would be better to set this flag on a per-CCB basis,
	but there are no more bits available in the ccb flags field.  That
	will be fixed later as part of the camlock work.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#6 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#21 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#9 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#6 (text+ko) ====

@@ -113,6 +113,7 @@
 #define CAM_PERIPH_INVALID		0x08
 #define CAM_PERIPH_NEW_DEV_FOUND	0x10
 #define CAM_PERIPH_RECOVERY_INPROG	0x20
+#define CAM_PERIPH_POLLED		0x40
 	u_int32_t		 immediate_priority;
 	u_int32_t		 refcount;
 	SLIST_HEAD(, ccb_hdr)	 ccb_list;	/* For "immediate" requests */

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#21 (text+ko) ====

@@ -4959,7 +4959,9 @@
 					  sim_links.tqe);
 			done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
 			mtx_unlock(&cam_bioq_lock);
-			swi_sched(cambio_ih, 0);
+			if ((done_ccb->ccb_h.path->periph->flags &
+			    CAM_PERIPH_POLLED) == 0)
+				swi_sched(cambio_ih, 0);
 			break;
 		default:
 			panic("unknown periph type %d",

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_da.c#9 (text+ko) ====

@@ -734,6 +734,7 @@
 		return (ENXIO);
 
 	if (length > 0) {
+		periph->flags |= CAM_PERIPH_POLLED;
 		xpt_setup_ccb(&csio.ccb_h, periph->path, /*priority*/1);
 		csio.ccb_h.ccb_state = DA_CCB_DUMP;
 		scsi_read_write(&csio,
@@ -759,10 +760,11 @@
 			else
 				printf("status == 0x%x, scsi status == 0x%x\n",
 				       csio.ccb_h.status, csio.scsi_status);
+			periph->flags |= CAM_PERIPH_POLLED;
 			return(EIO);
 		}
 		return(0);
-	} 
+	}
 		
 	/*
 	 * Sync the disk cache contents to the physical media.
@@ -801,6 +803,7 @@
 			}
 		}
 	}
+	periph->flags &= ~CAM_PERIPH_POLLED;
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604301706.k3UH6aTd043714>