diff mbox

[v2] scsi: introduce short_inquiry flag for broken host adapters

Message ID 1441296673-14315-1-git-send-email-vkuznets@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vitaly Kuznetsov Sept. 3, 2015, 4:11 p.m. UTC
Some host adapters (e.g. Hyper-V storvsc) are known for not respecting the
SPC-2/3/4 requirement for 'INQUIRY data (see table ...) shall contain at
least 36 bytes'. As a result we get tons on 'scsi 0:7:1:1: scsi scan:
INQUIRY result too short (5), using 36' messages on console. This can be
problematic for slow consoles. Introduce short_inquiry host template flag
to avoid printing error messages for such adapters.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
Changes since v1:
- This is a successor of previously sent "scsi_scan: move 'INQUIRY result
  too short' message to debug level" patch. Instead of moving the message
  to debug level for all adapters introduce a special 'short_inquiry' flag
  for host template [inspired by James Bottomley].
---
 drivers/scsi/scsi_scan.c   | 7 ++++---
 drivers/scsi/storvsc_drv.c | 1 +
 include/scsi/scsi_host.h   | 6 ++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

Comments

Vitaly Kuznetsov Sept. 15, 2015, 2:27 p.m. UTC | #1
Vitaly Kuznetsov <vkuznets@redhat.com> writes:

> Some host adapters (e.g. Hyper-V storvsc) are known for not respecting the
> SPC-2/3/4 requirement for 'INQUIRY data (see table ...) shall contain at
> least 36 bytes'. As a result we get tons on 'scsi 0:7:1:1: scsi scan:
> INQUIRY result too short (5), using 36' messages on console. This can be
> problematic for slow consoles. Introduce short_inquiry host template flag
> to avoid printing error messages for such adapters.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> Changes since v1:
> - This is a successor of previously sent "scsi_scan: move 'INQUIRY result
>   too short' message to debug level" patch. Instead of moving the message
>   to debug level for all adapters introduce a special 'short_inquiry' flag
>   for host template [inspired by James Bottomley].

James,

sorry for the ping but can you please let me know your opinion? This is
not a 'cosmetic fix', serial port on Hyper-V is extremely slow and users
get softlockups just because we output too much. Here is a freshly
booted guest with SCSI and FC adapters connected:

# dmesg | grep -c INQUIRY
2076

(my other pernding '[PATCH] scsi_scan: don't dump trace when
scsi_prep_async_scan() is called twice' is related to the same issue).

See also: https://lkml.org/lkml/2015/9/6/119

Thanks,

[...]
James Bottomley Sept. 15, 2015, 6:24 p.m. UTC | #2
On Tue, 2015-09-15 at 16:27 +0200, Vitaly Kuznetsov wrote:
> Vitaly Kuznetsov <vkuznets@redhat.com> writes:
> 
> > Some host adapters (e.g. Hyper-V storvsc) are known for not respecting the
> > SPC-2/3/4 requirement for 'INQUIRY data (see table ...) shall contain at
> > least 36 bytes'. As a result we get tons on 'scsi 0:7:1:1: scsi scan:
> > INQUIRY result too short (5), using 36' messages on console. This can be
> > problematic for slow consoles. Introduce short_inquiry host template flag
> > to avoid printing error messages for such adapters.
> >
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> > ---
> > Changes since v1:
> > - This is a successor of previously sent "scsi_scan: move 'INQUIRY result
> >   too short' message to debug level" patch. Instead of moving the message
> >   to debug level for all adapters introduce a special 'short_inquiry' flag
> >   for host template [inspired by James Bottomley].
> 
> James,
> 
> sorry for the ping but can you please let me know your opinion? This is
> not a 'cosmetic fix', serial port on Hyper-V is extremely slow and users
> get softlockups just because we output too much. Here is a freshly
> booted guest with SCSI and FC adapters connected:
> 
> # dmesg | grep -c INQUIRY
> 2076

It needs a review ... preferably from someone who validates that we
don't get any adverse impact from the missing inquiry data

> (my other pernding '[PATCH] scsi_scan: don't dump trace when
> scsi_prep_async_scan() is called twice' is related to the same issue).

So does this.

James


> See also: https://lkml.org/lkml/2015/9/6/119
> 
> Thanks,
> 
> [...]
> 



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
KY Srinivasan Sept. 15, 2015, 7:55 p.m. UTC | #3
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogSmFtZXMgQm90d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DExMDhk
MmJkZmFkODI2JTdjNzJmOTg4YmY4NmYxNDFhZjkxYWIyZDdjZDAxMQ0KPiBkYjQ3JTdjMSZzZGF0
YT10M0lHTE1pRzJzVTRWSmZtR2lZS0dNeTIyZDNJeEhiR1Fab3A2M25yVjdZJTNkDQo+ID4NCj4g
PiBUaGFua3MsDQo+ID4NCj4gPiBbLi4uXQ0KPiA+DQo+IA0KPiANCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index f9f3f82..f1d00a0 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -701,9 +701,10 @@  static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
 	 * strings.
 	 */
 	if (sdev->inquiry_len < 36) {
-		sdev_printk(KERN_INFO, sdev,
-			    "scsi scan: INQUIRY result too short (%d),"
-			    " using 36\n", sdev->inquiry_len);
+		if (!sdev->host->hostt->short_inquiry)
+			sdev_printk(KERN_INFO, sdev,
+				    "scsi scan: INQUIRY result too short (%d),"
+				    " using 36\n", sdev->inquiry_len);
 		sdev->inquiry_len = 36;
 	}
 
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 3c6584f..f3b4d0f 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1711,6 +1711,7 @@  static struct scsi_host_template scsi_driver = {
 	/* Make sure we dont get a sg segment crosses a page boundary */
 	.dma_boundary =		PAGE_SIZE-1,
 	.no_write_same =	1,
+	.short_inquiry =	1,
 };
 
 enum {
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index e113c75..7b022af 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -454,6 +454,12 @@  struct scsi_host_template {
 	unsigned no_async_abort:1;
 
 	/*
+	 * True if this host adapter returns short (<36 bytes) responses to
+	 * some INQUIRY requests.
+	 */
+	unsigned short_inquiry:1;
+
+	/*
 	 * Countdown for host blocking with no commands outstanding.
 	 */
 	unsigned int max_host_blocked;