mbox series

[RFC,v2,00/18] blk-mq/libata/scsi: SCSI driver tagging improvements

Message ID 1654770559-101375-1-git-send-email-john.garry@huawei.com (mailing list archive)
Headers show
Series blk-mq/libata/scsi: SCSI driver tagging improvements | expand

Message

John Garry June 9, 2022, 10:29 a.m. UTC
Currently SCSI low-level drivers are required to manage tags for commands
which do not come via the block layer - libata internal commands would be
an example of one of these. We want to make blk-mq manage these tags also.

There was some work to provide "reserved commands" support in such series
as https://lore.kernel.org/linux-scsi/20211125151048.103910-1-hare@suse.de/

This was based on allocating a request for the lifetime of the "internal"
command.

This series tries to solve that problem by not just allocating the request
but also sending it as a request through the block layer. Reasons to do
this:
- Normal flow of a request and also commonality for regular scsi command
  lifetime
- We don't leave request and scsi_cmnd fields dangling as when we just
  allocate and free the request for the lifetime of the "internal" command
- For poll mode support we can only poll in block layer, so could not send
  internal commands on poll mode queues if we did not do this, which is a
  problem
- Can get rid of duplicated code like libsas internal command timeout
  handling

Based on v5.19-rc1

Please consider as an PoC for now. I have broken builds, bisectablility,
and functionality for a lot of libsas drivers, like pm8001. Indeed, 
10/18 onwards need a lot of work...

Testing:
QEMU with AHCI with disk and cdrom attached and hisi_sas v2 both boot.

v1 was sent here:
https://lore.kernel.org/linux-scsi/1647945585-197349-1-git-send-email-john.garry@huawei.com/

Hannes Reinecke (1):
  scsi: core: Implement reserved command handling

John Garry (17):
  blk-mq: Add a flag for reserved requests
  scsi: core: Resurrect scsi_{get,free}_host_dev()
  scsi: core: Add support to send reserved commands
  scsi: core: Allocate SCSI host sdev when required
  libata-scsi: Add ata_scsi_queue_internal()
  libata-scsi: Add ata_internal_queuecommand()
  libata: Queue ATA internal commands as requests
  scsi: ipr: Support reserved commands
  libata/scsi: libsas: Add sas_queuecommand_internal()
  scsi: libsas: Don't attempt to find scsi host rphy in slave alloc
  scsi: libsas drivers: Prepare for reserved commands
  scsi: libsas: Allocate SCSI commands for tasks
  scsi: libsas: Queue SMP commands as requests
  scsi: libsas: Queue TMF commands as requests
  scsi: core: Add scsi_alloc_request_hwq()
  scsi: libsas: Queue internal abort commands as requests
  scsi: libsas drivers: Remove private tag management

 block/blk-mq.c                         |   6 +
 drivers/ata/libata-core.c              | 145 +++++++++++++++----------
 drivers/ata/libata-sata.c              |   5 +-
 drivers/ata/libata-scsi.c              |  61 ++++++++++-
 drivers/ata/libata.h                   |   4 -
 drivers/scsi/hisi_sas/hisi_sas_main.c  |  93 ++++------------
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c |   6 +-
 drivers/scsi/hisi_sas/hisi_sas_v3_hw.c |   3 +-
 drivers/scsi/hosts.c                   |  14 +++
 drivers/scsi/ipr.c                     |  17 ++-
 drivers/scsi/libsas/sas_ata.c          |  22 ++--
 drivers/scsi/libsas/sas_expander.c     |  24 ++--
 drivers/scsi/libsas/sas_init.c         |  74 ++++++++-----
 drivers/scsi/libsas/sas_internal.h     |   6 +
 drivers/scsi/libsas/sas_scsi_host.c    | 121 +++++++++++++++------
 drivers/scsi/scsi_lib.c                |  50 ++++++++-
 drivers/scsi/scsi_scan.c               |  57 ++++++++++
 include/linux/blk-mq.h                 |   6 +
 include/linux/libata.h                 |  13 ++-
 include/scsi/libsas.h                  |  57 +++++++++-
 include/scsi/scsi_cmnd.h               |   8 ++
 include/scsi/scsi_host.h               |  34 +++++-
 22 files changed, 597 insertions(+), 229 deletions(-)