Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Fix SAS wildcard scan on smartpqi and other controllers
@ 2026-05-13 17:42 Martin Wilck
  2026-05-13 17:42 ` [PATCH v3 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Martin Wilck
  2026-05-13 17:42 ` [PATCH v3 2/2] Revert "scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans" Martin Wilck
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Wilck @ 2026-05-13 17:42 UTC (permalink / raw)
  To: Martin K. Petersen, Christoph Hellwig, Don Brace, ranjan.kumar
  Cc: linux-scsi, Hannes Reinecke, Lee Duncan, Martin Wilck,
	mpi3mr-linuxdrv.pdl

commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to handle wildcard and
multi-channel scans") modified the way SAS drivers handle the common way of
rescanning SCSI devices using "echo - - - >/sys/class/scsi_host/host$N/scan".
Before this patch, SAS drivers would only scan channel 0 for this "wildcard
scan" scenario; after this patch, it would scan all channels up to
shost->max_channel.

This can cause massive resource usage for some drivers, as the driver needs to
send an INQUIRY to LUN 0 to every supported ID and e.g. smartpqi sets
shost->max_id to 0xffffffff. These INQUIRYs mostly fail, but the kernel needs
to set up queues, tag sets, etc. before sending the INQUIRY. Also, some SAS
drivers assign special meaning to SCSI channels such as channel 0 for physical
and channel 1 for logical devices, and thus don't support "normal" SCSI
scanning of these channels anyway.

With smartpqi and hisi_sas, actual kernel crashes due to resource exhaustion
have been observed.

v1 and v2 of this patch set proposed leveraging the functions scan_start() and
scan_finished() provided by some SAS drivers for fixing this issue. But the
review of the v2 series by Sashiko showed that this is a complex and
error-prone endeavor. Therefore I asked for some guidance on the ML [1].
I am now proposing a different, simpler solution to the issues we observed,
which is simply reverting commit 37c4e72b0651 ("scsi: Fix sas_user_scan() to
handle wildcard and multi-channel scans").

This revert will require a different solution for the wildcard scan with mpi3mr
and mpt3sas with "Tri-mode" enabled. But it seems wrong in the first place
that adding the support for this special mode of operation for some drivers
broke wildcard scan for other drivers.

The first patch is a minor fix for smartpqi.

[1] https://lore.kernel.org/linux-scsi/61b4da9dcbee8fd71d1ecb2cfdca5c2408528bd7.camel@suse.com/

----
Changes v2 -> v3:

- Removed patch 2 and replaced it by a revert of 37c4e72b0651

Changes v1 -> v2 (obsolete)

- export and call do_scsi_scan_host() instead of duplicating its code
  (Hannes Reinecke)

Martin Wilck (2):
  scsi: smartpqi: use shost_to_hba() in pqi_scan_finished()
  Revert "scsi: Fix sas_user_scan() to handle wildcard and multi-channel
    scans"

 drivers/scsi/scsi_scan.c              |  2 +-
 drivers/scsi/scsi_transport_sas.c     | 60 ++++++---------------------
 drivers/scsi/smartpqi/smartpqi_init.c |  2 +-
 3 files changed, 14 insertions(+), 50 deletions(-)

-- 
2.54.0


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

end of thread, other threads:[~2026-05-13 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 17:42 [PATCH v3 0/2] Fix SAS wildcard scan on smartpqi and other controllers Martin Wilck
2026-05-13 17:42 ` [PATCH v3 1/2] scsi: smartpqi: use shost_to_hba() in pqi_scan_finished() Martin Wilck
2026-05-13 17:42 ` [PATCH v3 2/2] Revert "scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans" Martin Wilck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox