Skip to contentSkip to conversation

Honor VPD check in usb/storage for SanDisk device

PATCH In review Marcos Paulo de Souza 4 participants 18 messages Jun 18, 2019 – Jul 12, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Honor VPD check in usb/storage for SanDisk device

Before this patch, USB storage devices disabled VPD check by always setting skip_vpd_check.

The first patch add a new entry to scsi_static_device_list related to SanDisk Cruzer Blade, which have VPD, adding BLIST_TRY_VPD_PAGES flag, which implies try_vpd_pages.

The second patch check try_vpd_pages, and only set skip_vpd_pages if try_vpd_pages is not set.

This patches along the wwid one [1], makes SanDisk Cruzer Blade device to present correctly wwid, vpd_pg80 and vpd_pg83 in sysfs, and let the window open to support another USB storage devices to support and present VPD.

[1]: https://lkml.org/lkml/2019/6/11/1408

Marcos Paulo de Souza (2):
scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade
usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

 drivers/scsi/scsi_devinfo.c    | 2 ++
 drivers/usb/storage/scsiglue.c | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/2 scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

Currently, all USB devices skip VPD pages, even when the device supports them (SPC-3 and later), but some of them support VPD, like Cruzer Blade.

---
 drivers/scsi/scsi_devinfo.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/scsi_devinfo.c +2 -0
index a08ff3bd6310..df14597752ec 100644
@@ -239,6 +239,8 @@ static struct {
 	{"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
 	{"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
 	{"LENOVO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
+	{"SanDisk", "Cruzer Blade", NULL, BLIST_TRY_VPD_PAGES |
+		BLIST_INQUIRY_36},
 	{"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
 	{"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
 	{"SONY", "TSL", NULL, BLIST_FORCELUN},		/* DDS3 & DDS4 autoloaders */
Signature · 1 line
2.21.0
#9 lore raw

PATCH 2/2 usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

In reply to Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +5 -2
index 59190d88fa9f..0a9520780771 100644
@@ -195,8 +195,11 @@ static int slave_configure(struct scsi_device *sdev)
 		 */
 		sdev->skip_ms_page_8 = 1;
 
-		/* Some devices don't handle VPD pages correctly */
-		sdev->skip_vpd_pages = 1;
+		/*
+		 * Some devices don't handle VPD pages correctly, so skip vpd
+		 * pages if not forced by SCSI layer.
+		 */
+		sdev->skip_vpd_pages = sdev->try_vpd_pages == 0;
 
 		/* Do not attempt to use REPORT SUPPORTED OPERATION CODES */
 		sdev->no_report_opcodes = 1;
Signature · 1 line
2.21.0
#10 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 7 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Where is patch 1/2 of this series?

confused,

greg k-h

#11 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 10 lines · Greg Kroah-Hartman
Quoted 7 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Where is patch 1/2 of this series?

You can find it here:
https://lore.kernel.org/lkml/[email protected]/

Quoted 4 lines

confused,

greg k-h

Signature · 2 lines
Thanks,
Marcos
#12 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 10 lines · Marcos Paulo de Souza
Quoted 9 lines · Greg Kroah-Hartman
Quoted 7 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Quoted 4 lines
Quoted 1 line

Where is patch 1/2 of this series?

You can find it here:
https://lore.kernel.org/lkml/[email protected]/

So is this 2/2 patch independant of 1/2 and can go throught the USB tree, or do they both need to be together?

As it is, I have no idea what to do with this patch :(

thanks,

greg k-h

#13 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Marcos Paulo de Souza
Quoted 9 lines · Greg Kroah-Hartman
Quoted 7 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Where is patch 1/2 of this series?

You can find it here:
https://lore.kernel.org/lkml/[email protected]/

So is this 2/2 patch independant of 1/2 and can go throught the USB tree, or do they both need to be together?

I think it is, since we are not dealing with something specific to a device in this patch.

Quoted 2 lines

As it is, I have no idea what to do with this patch :(

Sorry, I relied in get_maintainer.pl only, so you weren't CCed in both patches. But feel free to grab this patch in your tree.

Quoted 4 lines

thanks,

greg k-h

Signature · 2 lines
Thanks,
Marcos
maintainer Acked-by on v1 2/2
#14 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

In reply to Marcos Paulo de Souza
Quoted 16 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +0 -0
index 59190d88fa9f..0a9520780771 100644
@@ -195,8 +195,11 @@ static int slave_configure(struct scsi_device *sdev)
 		 */
 		sdev->skip_ms_page_8 = 1;
 

drivers/usb/storage/scsiglue.c static int slave_configure(struct scsi_device *sdev) · line 205

Quoted 10 lines
drivers/usb/storage/scsiglue.c +5 -2
-		/* Some devices don't handle VPD pages correctly */
-		sdev->skip_vpd_pages = 1;
+		/*
+		 * Some devices don't handle VPD pages correctly, so skip vpd
+		 * pages if not forced by SCSI layer.
+		 */
+		sdev->skip_vpd_pages = sdev->try_vpd_pages == 0;
 
 		/* Do not attempt to use REPORT SUPPORTED OPERATION CODES */
 		sdev->no_report_opcodes = 1;

Although I think it would be clearer to write:

		sdev->skip_vpd_pages = !sdev->try_vpd_pages;

But that's just personal preference. This is okay as it is.

Alan Stern

#15 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 26 lines · Alan Stern
Quoted 24 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +5 -2
index 59190d88fa9f..0a9520780771 100644
@@ -195,8 +195,11 @@ static int slave_configure(struct scsi_device *sdev)
 		 */
 		sdev->skip_ms_page_8 = 1;
 
-		/* Some devices don't handle VPD pages correctly */
-		sdev->skip_vpd_pages = 1;
+		/*
+		 * Some devices don't handle VPD pages correctly, so skip vpd
+		 * pages if not forced by SCSI layer.
+		 */
+		sdev->skip_vpd_pages = sdev->try_vpd_pages == 0;
 
Quoted 8 lines

drivers/usb/storage/scsiglue.c static int slave_configure(struct scsi_device *sdev) · line 205

Quoted 2 lines
drivers/usb/storage/scsiglue.c +0 -0
 		/* Do not attempt to use REPORT SUPPORTED OPERATION CODES */
 		sdev->no_report_opcodes = 1;

Although I think it would be clearer to write:

		sdev->skip_vpd_pages = !sdev->try_vpd_pages;

I agree. Greg, would you like me to send a v2 of this patch with this change, or can you apply the change suggested by Alan?

Thanks,
Marcos

Quoted 5 lines

But that's just personal preference. This is okay as it is.

Alan Stern

Signature · 2 lines
Thanks,
Marcos
#16 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 32 lines · Marcos Paulo de Souza
Quoted 31 lines · Alan Stern
Quoted 16 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +0 -0
index 59190d88fa9f..0a9520780771 100644
@@ -195,8 +195,11 @@ static int slave_configure(struct scsi_device *sdev)
 		 */
 		sdev->skip_ms_page_8 = 1;
 

drivers/usb/storage/scsiglue.c static int slave_configure(struct scsi_device *sdev) · line 205

Quoted 10 lines
drivers/usb/storage/scsiglue.c +5 -2
-		/* Some devices don't handle VPD pages correctly */
-		sdev->skip_vpd_pages = 1;
+		/*
+		 * Some devices don't handle VPD pages correctly, so skip vpd
+		 * pages if not forced by SCSI layer.
+		 */
+		sdev->skip_vpd_pages = sdev->try_vpd_pages == 0;
 
 		/* Do not attempt to use REPORT SUPPORTED OPERATION CODES */
 		sdev->no_report_opcodes = 1;
Quoted 6 lines
Quoted 3 lines

Although I think it would be clearer to write:

		sdev->skip_vpd_pages = !sdev->try_vpd_pages;

I agree. Greg, would you like me to send a v2 of this patch with this change, or can you apply the change suggested by Alan?

I do not hand-edit patches, sorry. It does not scale, please resend.

greg k-h

#17 lore raw

Re: [PATCH 2/2] usb: storage: scsiglue: Do not skip VPD if try_vpd_pages is set

Quoted 33 lines · Greg Kroah-Hartman
Quoted 32 lines · Marcos Paulo de Souza
Quoted 31 lines · Alan Stern
Quoted 16 lines · Marcos Paulo de Souza

If BLIST_TRY_VPD_PAGES is set for a device, even for an USB, it should be honored, so only set skip_vpd_pages is try_vpd_pages is not set.

---
 drivers/usb/storage/scsiglue.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/storage/scsiglue.c +0 -0
index 59190d88fa9f..0a9520780771 100644
@@ -195,8 +195,11 @@ static int slave_configure(struct scsi_device *sdev)
 		 */
 		sdev->skip_ms_page_8 = 1;
 

drivers/usb/storage/scsiglue.c static int slave_configure(struct scsi_device *sdev) · line 205

Quoted 10 lines
drivers/usb/storage/scsiglue.c +5 -2
-		/* Some devices don't handle VPD pages correctly */
-		sdev->skip_vpd_pages = 1;
+		/*
+		 * Some devices don't handle VPD pages correctly, so skip vpd
+		 * pages if not forced by SCSI layer.
+		 */
+		sdev->skip_vpd_pages = sdev->try_vpd_pages == 0;
 
 		/* Do not attempt to use REPORT SUPPORTED OPERATION CODES */
 		sdev->no_report_opcodes = 1;
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Although I think it would be clearer to write:

		sdev->skip_vpd_pages = !sdev->try_vpd_pages;

I agree. Greg, would you like me to send a v2 of this patch with this change, or can you apply the change suggested by Alan?

I do not hand-edit patches, sorry. It does not scale, please resend.

No problem, v2 just sent:
https://lore.kernel.org/linux-usb/[email protected]/T/#u

Thanks Alan for the quick review!

Quoted 2 lines

greg k-h

#2 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

In reply to Marcos Paulo de Souza

Marcos,

Quoted 3 lines

Currently, all USB devices skip VPD pages, even when the device supports them (SPC-3 and later), but some of them support VPD, like Cruzer Blade.

What's your confidence level wrt. all Cruzer Blades handling this correctly? How many devices have you tested this change with?

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

Quoted 9 lines · Martin K. Petersen

Marcos,

Quoted 3 lines

Currently, all USB devices skip VPD pages, even when the device supports them (SPC-3 and later), but some of them support VPD, like Cruzer Blade.

What's your confidence level wrt. all Cruzer Blades handling this correctly? How many devices have you tested this change with?

I've tested three Cruzer Blades that I have at hand, and all of them have VPD support, and also checked with a friend of mine that also have one. I can't say about "all others" but so far, 4/4 devices that I tested have VPD. (They were all SPC-3 or SPC-4 compliant).

Quoted 3 lines
Signature · 2 lines
-- 
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

Quoted 8 lines · Marcos Paulo de Souza
Quoted 7 lines · Martin K. Petersen

Marcos,

Quoted 3 lines

Currently, all USB devices skip VPD pages, even when the device supports them (SPC-3 and later), but some of them support VPD, like Cruzer Blade.

Quoted 8 lines
Quoted 2 lines

What's your confidence level wrt. all Cruzer Blades handling this correctly? How many devices have you tested this change with?

I've tested three Cruzer Blades that I have at hand, and all of them have VPD support, and also checked with a friend of mine that also have one. I can't say about "all others" but so far, 4/4 devices that I tested have VPD. (They were all SPC-3 or SPC-4 compliant).

My first idea was to add a vendor:product mapping at SCSI layer, but so far I haven't found one, so I added the model/vendor found by INQUIRY. Would it be better to check for prod:vendor (as values, instead of the description)?

Thanks,
Marcos

Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
-- 
Martin K. Petersen	Oracle Linux Engineering
#7 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

In reply to Marcos Paulo de Souza

Marcos,

Quoted 7 lines
Quoted 2 lines

What's your confidence level wrt. all Cruzer Blades handling this correctly? How many devices have you tested this change with?

I've tested three Cruzer Blades that I have at hand, and all of them have VPD support, and also checked with a friend of mine that also have one. I can't say about "all others" but so far, 4/4 devices that I tested have VPD. (They were all SPC-3 or SPC-4 compliant).

That's not a very large sample. However, SanDisk have traditionally been pretty good wrt. spec compliance.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

In reply to Marcos Paulo de Souza

Marcos,

Quoted 4 lines

My first idea was to add a vendor:product mapping at SCSI layer, but so far I haven't found one, so I added the model/vendor found by INQUIRY. Would it be better to check for prod:vendor (as values, instead of the description)?

Your patch is functionally fine. I'm just trying to establish how risky it is for me to pick it up.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#6 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

Quoted 10 lines · Martin K. Petersen

Marcos,

Quoted 4 lines

My first idea was to add a vendor:product mapping at SCSI layer, but so far I haven't found one, so I added the model/vendor found by INQUIRY. Would it be better to check for prod:vendor (as values, instead of the description)?

Your patch is functionally fine. I'm just trying to establish how risky it is for me to pick it up.

I've tried to find any official document about Cruzer Blade devices, stating that all of them have at least SPC-3 to support VPD, but no luck so far :(

So feel free to ignore the patch if you think it's too risky.

Thanks,
Marcos

Quoted 3 lines
Signature · 2 lines
-- 
Martin K. Petersen	Oracle Linux Engineering
#8 lore raw

Re: [PATCH 1/2] scsi: devinfo: BLIST_TRY_VPD_PAGES for SanDisk Cruzer Blade

In reply to Marcos Paulo de Souza

Marcos,

Quoted 3 lines

Currently, all USB devices skip VPD pages, even when the device supports them (SPC-3 and later), but some of them support VPD, like Cruzer Blade.

We'll try it and see what happens. As I mentioned, SanDisk have traditionally been pretty good wrt. spec compliance.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering