RE: [PATCH] scsi: Add SHT->unlocked_qcmd for host_lock lessSHT->queuecommand() dispatch

From: Nicholas A. Bellinger
Date: Tue Oct 26 2010 - 21:54:27 EST


On Wed, 2010-10-27 at 09:52 +0800, Jack Wang wrote:
> From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
>
> Greetings all,
>
> This patch adds scsi_dispatch_cmd_unlocked() and scsi_dispatch_cmd_locked()
> which are now called directly from scsi_dispatch_cmd() depending upon what
> is reported by SHT->unlocked_qcmd on a per driver basis. Note that by
> default
> unlocked_qcmd is disabled, and all LLDs not defining a SHT->unlocked_qcmd
> will
> be using the legacy scsi_dispatch_cmd_locked().
>
> This patch also drops the usage of scsi_cmd_get_serial() in
> scsi_dispatch_cmd()
> and assumes the legacy SCSI LLDs that depend upon struct
> scsi_cmnd->serial_number
> will call the now EXPORT_SYMBOL()'ed scsi_cmd_get_serial() call.
>
> This patch also adds a cmd->eh_eflags |= SCSI_EH_SOFTIRQ_DONE assignment in
> scsi_softirq_done() in order to signal scsi_try_to_abort_cmd() that the
> command
> has been completed. This patch uses blk_test_rq_complete() together with a
> new SCSI_EH_SOFTIRQ_DONE in scsi_error.c:scsi_try_to_abort_cmd() in order to
> handle the struct scsi_cmnd timeout case intsead w/o scmd->serial_number
> usage:
>
> - if (scmd->serial_number == 0)
> + if ((blk_test_rq_complete(scmd->request)) &&
> + (scmd->eh_eflags & SCSI_EH_SOFTIRQ_DONE))
> return SUCCESS;
>
> Finally, this patch also converts the remaining struct
> Scsi_Host->cmd_serial_number
> to atomic_t following a recommedation by Joe Eykholt to start struct
> Scsi_Host->
> cmd_serial_number at 1, and increment each serial_number by 2 so that the
> serial is odd, and wraps to 1 instead of 0. struct
> Scsi_Host->cmd_serial_number
> is initialized to '1' in drivers/scsi/hosts.c:scsi_host_alloc().
>
> Along with the changes to SCSI ML, this series includes the following LLD
> commits to enable lock-less operation for certain LLDs, and adds the explict
> scsi_cmd_get_serial() to the legacy LLDs still requring cmd->serial_number
> for anything beyond informational purposes:
>
> libiscsi: Remove host_lock unlock() + lock() from iscsi_queuecommand()
> libsas: Remove host_lock unlock() + lock() from sas_queuecommand()
> aic94xx: Set SHT->unlocked_qcmd=1 for libsas queuecommand()
> mvsas: Set SHT->unlocked_qcmd=1 for libsas queuecommand()
> pm8001: Set SHT->unlocked_qcmd=1 for libsas queuecommand()
> libata: Remove host_lock unlock() + lock() from ata_scsi_queuecmd()
> lpfc: Remove host_lock unlock() + lock() from lpfc_queuecommand()
> qla4xxx: Remove host_lock unlock() + lock() from qla4xxx_queuecommand()
> qla2xxx: Remove host_lock unlock() + lock() from qla2xxx_queuecommand()
> fnic: Remove host_lock unlock() + lock() from fnic_queuecommand()
> mpt2sas: Add scsi_cmd_get_serial() call and set SHT->unlocked_qcmd=1
> mpt/fusion: Add scsi_cmd_get_serial() call and set SHT->unlocked_qcmd=1
> dpt_i2o: Add scsi_cmd_get_serial() call
> eata: Add scsi_cmd_get_serial() call
> u14-34f: Add scsi_cmd_get_serial() call
>
>
> Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
> Acked-by: Ravi Anand <ravi.anand@xxxxxxxxxx> (for qla2xx)
> Acked-by: Luben Tuikov <ltuikov@xxxxxxxxx> (for aic94xx)
>
> Hi, Nab
>
> Please consider to add my ack. Thanks!
> Acked-by: Jack Wang <jack_wang@xxxxxxxxx> (for pm8001)
>

Many thanks Jack!

Best,

--nab

> Jack
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/