Skip to content

Drop host_lock usage from scsi_dispatch_cmd()

Nicholas A. Bellinger linux-scsi lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest11 patches 15 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11scsi: Convert struct Scsi_Host->cmd_serial_number to atomic_tdrivers/scsi/hosts.c drivers/scsi/scsi.c include/scsi/scsi_host.h+19 -616 replies
2/11scsi: Drop struct Scsi_Host->host_lock usage in scsi_dispatch_cmd()drivers/scsi/scsi.c+1 -30 replies
3/11libiscsi: Remove host_lock unlock() + lock() from iscsi_queuecommand()drivers/scsi/libiscsi.c+0 -40 replies
4/11libsas: Remove host_lock unlock() + lock() from sas_queuecommand()drivers/scsi/libsas/sas_scsi_host.c+0 -50 replies
5/11libfc: Remove host_lock unlock() + lock() from fc_queuecommand()drivers/scsi/libfc/fc_fcp.c+1 -40 replies
6/11libata: Remove host_lock unlock() + lock() from ata_scsi_queuecmd()drivers/ata/libata-scsi.c+0 -20 replies
7/11lpfc: Remove host_lock unlock() + lock() from lpfc_queuecommand()drivers/scsi/lpfc/lpfc_scsi.c+0 -20 replies
8/11qla4xxx: Remove host_lock unlock() + lock() from qla4xxx_queuecommand()drivers/scsi/qla4xxx/ql4_os.c+1 -71 reply
9/11qla2xxx: Remove host_lock unlock() + lock() from qla2xxx_queuecommand()drivers/scsi/qla2xxx/qla_os.c+2 -50 replies
10/11fnic: Remove host_lock unlock() + lock() from fnic_queuecommand()drivers/scsi/fnic/fnic_scsi.c+0 -90 replies
11/11buslogic: Remove host_lock unlock() + lock() from BusLogic_QueueCommand()drivers/scsi/BusLogic.c+0 -40 replies

Reviews trailers per patch

2 of 11 patches have a Reviewed-by or Acked-by.

PatchSwen SchilligRavi Anand
1/11R-b
2/11
3/11
4/11
5/11
6/11
7/11
8/11A-b
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/11] Drop host_lock usage from scsi_dispatch_cmd()

From: Nicholas Bellinger <[email protected]>

Greetings all,

This series contains the second round of a whole-sale conversion for completely dropping struct Scsi_Host->host_lock usage within scsi_dispatch_cmd() for the ML internal scsi_cmd_get_serial() and external SHT->queuecommand() LLD callers.

The main changes from comments from v1 -> v2 are:

	*) Make scsi_cmd_get_serial() use atomic_t and disable it's usage by default.
	*) Drop struct Scsi_Host->host_lock usage in scsi_dispatch_cmd()

For the v2 series, patch #1 converts struct Scsi_Host->cmd_serial_number to atomic_t and adds struct Scsi_Host->use_serial_number to enabled usage. This patch also follows Joe Eykholt suggestion of using a +2 for each scsi_cmd_get_serial() to ensure that the counter always wraps to a non-zero value.

Patch #2 completely removes host_lock usage from scsi_dispatch_cmd().

Patch #3 -> #6 remove the legacy host_lock lock() -> do_work() -> unlock() optimization from generic libiscsi, libsas, libfc and libata ->queuecommand() callers respectively.

And patches #7 -> #11 do the same conversion legacy host_lock lock() -> do_work() -> unlock() for lpfc, qla4xxx, qla2xxx, fnic, and buslogic LLDs specific ->queuecommand() callers.

There may still be more LLDs which use this optimization, so please let me know if there is another piece of SHT->queuecommand() caller code that does this legacy optimization not in this list that need to be updated. I will be sure to CC the right driver maintainers and CC linux-scsi as I come across any more conversions.

Many thanks to James Bottomley, Andi Keen, Joe Eykholt, Vasu Dev and Tim Chen for their code and comments!

Nicholas Bellinger (11):
scsi: Convert struct Scsi_Host->cmd_serial_number to atomic_t
scsi: Drop struct Scsi_Host->host_lock usage in scsi_dispatch_cmd()
libiscsi: Remove host_lock unlock() + lock() from
iscsi_queuecommand()
libsas: Remove host_lock unlock() + lock() from sas_queuecommand()
libfc: Remove host_lock unlock() + lock() from fc_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()
buslogic: Remove host_lock unlock() + lock() from
BusLogic_QueueCommand()

 drivers/ata/libata-scsi.c           |    2 --
 drivers/scsi/BusLogic.c             |    4 ----
 drivers/scsi/fnic/fnic_scsi.c       |    9 ---------
 drivers/scsi/hosts.c                |    4 ++++
 drivers/scsi/libfc/fc_fcp.c         |    5 +----
 drivers/scsi/libiscsi.c             |    4 ----
 drivers/scsi/libsas/sas_scsi_host.c |    5 -----
 drivers/scsi/lpfc/lpfc_scsi.c       |    2 --
 drivers/scsi/qla2xxx/qla_os.c       |    7 ++-----
 drivers/scsi/qla4xxx/ql4_os.c       |    8 +-------
 drivers/scsi/scsi.c                 |   17 +++++++++++------
 include/scsi/scsi_host.h            |    8 +++++---
 12 files changed, 24 insertions(+), 51 deletions(-)
Signature · 1 line
1.7.2.3