Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	Don Brace <don.brace@microchip.com>,
	ranjan.kumar@broadcom.com
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Lee Duncan <lduncan@suse.com>, Martin Wilck <mwilck@suse.com>,
	mpi3mr-linuxdrv.pdl@broadcom.com
Subject: [PATCH v3 0/2] Fix SAS wildcard scan on smartpqi and other controllers
Date: Wed, 13 May 2026 19:42:34 +0200	[thread overview]
Message-ID: <20260513174236.430465-1-mwilck@suse.com> (raw)

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


             reply	other threads:[~2026-05-13 17:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 17:42 Martin Wilck [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260513174236.430465-1-mwilck@suse.com \
    --to=martin.wilck@suse.com \
    --cc=don.brace@microchip.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=lduncan@suse.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mpi3mr-linuxdrv.pdl@broadcom.com \
    --cc=mwilck@suse.com \
    --cc=ranjan.kumar@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox