Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jun 2012 07:05:14 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r236542 - in stable/8/sys: cam dev/ahci dev/ata dev/mvs dev/siis
Message-ID:  <201206040705.q5475E4s011257@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Jun  4 07:05:13 2012
New Revision: 236542
URL: http://svn.freebsd.org/changeset/base/236542

Log:
  MFC r235333:
  Add two functions xpt_batch_start() and xpt_batch_done() to the CAM SIM KPI
  to allow drivers to handle request completion directly without passing
  them to the CAM SWI thread removing extra context switch.
  Modify all ATA/SATA drivers to use them.

Modified:
  stable/8/sys/cam/cam_sim.h
  stable/8/sys/cam/cam_xpt.c
  stable/8/sys/cam/cam_xpt_sim.h
  stable/8/sys/dev/ahci/ahci.c
  stable/8/sys/dev/ata/ata-all.c
  stable/8/sys/dev/mvs/mvs.c
  stable/8/sys/dev/siis/siis.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/cam/cam_sim.h
==============================================================================
--- stable/8/sys/cam/cam_sim.h	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/cam/cam_sim.h	Mon Jun  4 07:05:13 2012	(r236542)
@@ -106,6 +106,7 @@ struct cam_sim {
 #define	CAM_SIM_MPSAFE			0x02
 #define	CAM_SIM_ON_DONEQ		0x04
 #define	CAM_SIM_POLLED			0x08
+#define	CAM_SIM_BATCH			0x10
 	struct callout		callout;
 	struct cam_devq 	*devq;	/* Device Queue to use for this SIM */
 	int			refcount; /* References to the SIM. */

Modified: stable/8/sys/cam/cam_xpt.c
==============================================================================
--- stable/8/sys/cam/cam_xpt.c	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/cam/cam_xpt.c	Mon Jun  4 07:05:13 2012	(r236542)
@@ -4250,7 +4250,8 @@ xpt_done(union ccb *done_ccb)
 		TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h,
 		    sim_links.tqe);
 		done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX;
-		if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) {
+		if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED |
+		    CAM_SIM_BATCH)) == 0) {
 			mtx_lock(&cam_simq_lock);
 			first = TAILQ_EMPTY(&cam_simq);
 			TAILQ_INSERT_TAIL(&cam_simq, sim, links);
@@ -4262,6 +4263,25 @@ xpt_done(union ccb *done_ccb)
 	}
 }
 
+void
+xpt_batch_start(struct cam_sim *sim)
+{
+
+	KASSERT((sim->flags & CAM_SIM_BATCH) == 0, ("Batch flag already set"));
+	sim->flags |= CAM_SIM_BATCH;
+}
+
+void
+xpt_batch_done(struct cam_sim *sim)
+{
+
+	KASSERT((sim->flags & CAM_SIM_BATCH) != 0, ("Batch flag was not set"));
+	sim->flags &= ~CAM_SIM_BATCH;
+	if (!TAILQ_EMPTY(&sim->sim_doneq) &&
+	    (sim->flags & CAM_SIM_ON_DONEQ) == 0)
+		camisr_runqueue(&sim->sim_doneq);
+}
+
 union ccb *
 xpt_alloc_ccb()
 {

Modified: stable/8/sys/cam/cam_xpt_sim.h
==============================================================================
--- stable/8/sys/cam/cam_xpt_sim.h	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/cam/cam_xpt_sim.h	Mon Jun  4 07:05:13 2012	(r236542)
@@ -51,6 +51,8 @@ void		xpt_release_devq_rl(struct cam_pat
 		    u_int count, int run_queue);
 int		xpt_sim_opened(struct cam_sim *sim);
 void		xpt_done(union ccb *done_ccb);
+void		xpt_batch_start(struct cam_sim *sim);
+void		xpt_batch_done(struct cam_sim *sim);
 #endif
 
 #endif /* _CAM_CAM_XPT_SIM_H */

Modified: stable/8/sys/dev/ahci/ahci.c
==============================================================================
--- stable/8/sys/dev/ahci/ahci.c	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/dev/ahci/ahci.c	Mon Jun  4 07:05:13 2012	(r236542)
@@ -1455,7 +1455,9 @@ ahci_ch_intr_locked(void *data)
 	struct ahci_channel *ch = device_get_softc(dev);
 
 	mtx_lock(&ch->mtx);
+	xpt_batch_start(ch->sim);
 	ahci_ch_intr(data);
+	xpt_batch_done(ch->sim);
 	mtx_unlock(&ch->mtx);
 }
 

Modified: stable/8/sys/dev/ata/ata-all.c
==============================================================================
--- stable/8/sys/dev/ata/ata-all.c	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/dev/ata/ata-all.c	Mon Jun  4 07:05:13 2012	(r236542)
@@ -543,9 +543,11 @@ ata_interrupt(void *data)
     struct ata_channel *ch = (struct ata_channel *)data;
 
     mtx_lock(&ch->state_mtx);
+    xpt_batch_start(ch->sim);
 #endif
     ata_interrupt_locked(data);
 #ifdef ATA_CAM
+    xpt_batch_done(ch->sim);
     mtx_unlock(&ch->state_mtx);
 #endif
 }

Modified: stable/8/sys/dev/mvs/mvs.c
==============================================================================
--- stable/8/sys/dev/mvs/mvs.c	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/dev/mvs/mvs.c	Mon Jun  4 07:05:13 2012	(r236542)
@@ -653,7 +653,9 @@ mvs_ch_intr_locked(void *data)
 	struct mvs_channel *ch = device_get_softc(dev);
 
 	mtx_lock(&ch->mtx);
+	xpt_batch_start(ch->sim);
 	mvs_ch_intr(data);
+	xpt_batch_done(ch->sim);
 	mtx_unlock(&ch->mtx);
 }
 

Modified: stable/8/sys/dev/siis/siis.c
==============================================================================
--- stable/8/sys/dev/siis/siis.c	Mon Jun  4 07:03:56 2012	(r236541)
+++ stable/8/sys/dev/siis/siis.c	Mon Jun  4 07:05:13 2012	(r236542)
@@ -835,7 +835,9 @@ siis_ch_intr_locked(void *data)
 	struct siis_channel *ch = device_get_softc(dev);
 
 	mtx_lock(&ch->mtx);
+	xpt_batch_start(ch->sim);
 	siis_ch_intr(data);
+	xpt_batch_done(ch->sim);
 	mtx_unlock(&ch->mtx);
 }
 



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