All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/11] scsi: Add IRQ_DISABLE_SCSI_QCMD wrapper
@ 2010-11-17 22:18 Nicholas A. Bellinger
  2010-11-17 22:27 ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Nicholas A. Bellinger @ 2010-11-17 22:18 UTC (permalink / raw)
  To: linux-scsi, Jeff Garzik, James Bottomley, Christoph Hellwig
  Cc: Mike Christie, Ravi Anand, Andrew Vasquez, Joe Eykholt,
	James Smart, Vasu Dev, Tim Chen, Andi Kleen, Tejun Heo,
	Mike Anderson, MPTFusionLinux, Nicholas Bellinger

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch adds a IRQ_DISABLE_SCSI_QCMD() wrapper macro used by LLDs
that can now run in host_lock less mode, but still need interrupts disabled
using local_irq_save() before calling their lld_queuecommand() dispatcher.

jgarzik says this method is in fact slower than doing a spin_lock_irqsave() on
internal lib_lld_queuecommand() callers (as is done in libiscsi and libata)
but is still needed by the majority of lock_less LLDs.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 include/scsi/scsi_host.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index e7e3858..321b114 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -521,6 +521,20 @@ struct scsi_host_template {
 		return rc;						\
 	}
 
+/*
+ * Used for LLDs running in lock-less mode, but that still require having
+ * interrupts disable during their lld_queuecommand() dispatch.
+ */
+#define IRQ_DISABLE_SCSI_QCMD(func_name)				\
+	int func_name(struct Scsi_Host *shost, struct scsi_cmnd *cmd)	\
+	{								\
+		unsigned long irq_flags;				\
+		int rc;							\
+		local_irq_save(irq_flags);				\
+		rc = func_name##_irq_disable(cmd, cmd->scsi_done);	\
+		local_irq_restore(irq_flags);				\
+		return rc;						\
+	}
 
 /*
  * shost state: If you alter this, you also need to alter scsi_sysfs.c
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 03/11] scsi: Add IRQ_DISABLE_SCSI_QCMD wrapper
@ 2010-11-12  0:13 Nicholas A. Bellinger
  0 siblings, 0 replies; 9+ messages in thread
From: Nicholas A. Bellinger @ 2010-11-12  0:13 UTC (permalink / raw)
  To: linux-scsi, Jeff Garzik, James Bottomley, Christoph Hellwig
  Cc: Mike Christie, Ravi Anand, Andrew Vasquez, Joe Eykholt,
	James Smart, Vasu Dev, Tim Chen, Andi Kleen, Tejun Heo,
	Mike Anderson, MPTFusionLinux, Nicholas Bellinger

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch adds a IRQ_DISABLE_SCSI_QCMD() wrapper macro used by LLDs
that can now run in host_lock less mode, but still need interrupts disabled
using local_irq_save() before calling their lld_queuecommand() dispatcher.

jgarzik says this method is in fact slower than doing a spin_lock_irqsave() on
internal lib_lld_queuecommand() callers (as is done in libiscsi and libata)
but is still needed by the majority of lock_less LLDs.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 include/scsi/scsi_host.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 6909038..ddb0622 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -523,6 +523,21 @@ struct scsi_host_template {
 		return rc;						\
 	}
 
+/*
+ * Used for LLDs running in lock-less mode, but that still require having
+ * interrupts disable during their lld_queuecommand() dispatch.
+ */
+#define IRQ_DISABLE_SCSI_QCMD(func_name)				\
+	int func_name(struct scsi_cmnd *cmd,				\
+		 void (*done)(struct scsi_cmnd *))			\
+	{								\
+		unsigned long irq_flags;				\
+		int rc;							\
+		local_irq_save(irq_flags);				\
+		rc = func_name##_irq_disable (cmd, done);		\
+		local_irq_restore(irq_flags);				\
+		return rc;						\
+	}	
 
 /*
  * shost state: If you alter this, you also need to alter scsi_sysfs.c
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-11-19  0:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-17 22:18 [PATCH 03/11] scsi: Add IRQ_DISABLE_SCSI_QCMD wrapper Nicholas A. Bellinger
2010-11-17 22:27 ` Christoph Hellwig
2010-11-17 22:29   ` Nicholas A. Bellinger
2010-11-17 22:37     ` Christoph Hellwig
2010-11-18 10:25       ` Boaz Harrosh
2010-11-18 23:05         ` Nicholas A. Bellinger
2010-11-18 23:15           ` Jeff Garzik
2010-11-19  0:04             ` Nicholas A. Bellinger
  -- strict thread matches above, loose matches on Subject: below --
2010-11-12  0:13 Nicholas A. Bellinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.