All of lore.kernel.org
 help / color / mirror / Atom feed
* hpsa: Convert SCSI LLD ->queuecommand() for host_lock less operation
@ 2011-01-29 22:38 Nicholas A. Bellinger
  2011-01-30  3:26 ` Jeff Garzik
  2011-01-31 14:24 ` scameron
  0 siblings, 2 replies; 7+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-29 22:38 UTC (permalink / raw)
  To: Stephen M. Cameron; +Cc: James Bottomley, J.H., linux-scsi

Hi Stephen and Co,

Attached is a quick patch to enable modern SCSI host_lock' less
operation for the HPSA SCSI LLD driver on >= .37 kernels.  After an
initial LLD conversion and review, I would like to verify with you that
the following calls are currently protected by HPDA LLD internal locks
that disable interrupts from the newly renamed hpsa_scsi_queue_command()
dispatcher below..

*) For cmd_alloc(), struct ctlr_info *h->lock + spin_lock_irqsave() is
obtained and released.

*) For enqueue_cmd_and_start_io(), struct ctlr_info *h->lock +
spin_lock_irqsave() is obtained for addQ() + start_io() and released.

So the one new piece wrt to host_lock less mode that is *not* protected
in hpsa_scsi_queue_command() is the call to hpsa_scatter_gather().  This
should be OK to get called without h->lock held w/ spin_lock_irqsave(),
yes..?

So far this patch has been compile tested only.  Please have a look and
comment.

Thanks!

--nab

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 12deffc..e205f33 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1906,9 +1906,11 @@ sglist_finished:
        return 0;
 }
 
-
-static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
-       void (*done)(struct scsi_cmnd *))
+/*
+ * Running in struct Scsi_Host->host_lock less mode using LLD internal
+ * struct ctlr_info *h->lock w/ spin_lock_irqsave() protection.
+ */
+static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 {
        struct ctlr_info *h;
        struct hpsa_scsi_dev_t *dev;
@@ -1921,7 +1923,7 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
        dev = cmd->device->hostdata;
        if (!dev) {
                cmd->result = DID_NO_CONNECT << 16;
-               done(cmd);
+               cmd->scsi_done(cmd);
                return 0;
        }
        memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr));
@@ -1936,9 +1938,6 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
        }
 
        /* Fill in the command list header */
-
-       cmd->scsi_done = done;    /* save this for use by completion code */
-
        /* save c in case we have to abort it  */
        cmd->host_scribble = (unsigned char *) c;
 
@@ -2001,8 +2000,6 @@ static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
        return 0;
 }
 
-static DEF_SCSI_QCMD(hpsa_scsi_queue_command)
-
 static void hpsa_scan_start(struct Scsi_Host *sh)
 {
        struct ctlr_info *h = shost_to_hba(sh);



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

end of thread, other threads:[~2011-02-01  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-29 22:38 hpsa: Convert SCSI LLD ->queuecommand() for host_lock less operation Nicholas A. Bellinger
2011-01-30  3:26 ` Jeff Garzik
2011-01-30 21:18   ` Nicholas A. Bellinger
2011-01-31 14:42     ` scameron
2011-01-31 20:26       ` Nicholas A. Bellinger
2011-02-01  9:13         ` Boaz Harrosh
2011-01-31 14:24 ` scameron

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.