public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: John David Anglin <dave.anglin@bell.net>,
	Helge Deller <deller@gmx.de>,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org,
	Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] linux/export: fix reference to exported functions for parisc64
Date: Thu, 14 Sep 2023 11:24:43 +0900	[thread overview]
Message-ID: <bed98fc9-fb84-4912-6c73-5b7db575c375@kernel.org> (raw)
In-Reply-To: <3e4040cf-bb54-7652-72cc-0ad2d1288cb8@bell.net>

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

On 9/14/23 09:29, John David Anglin wrote:
> I think the issue is with the root ST373207LW drive.  The console output indicates that the
> ROOT drive doesn't exist when the boot fails.
> 
> Your change only appeared to affect actual SCSI drives.  That's why I tried disabling CDL.
>>
>> Could you send a full dmesg output for a clean boot and for a failed one so that
>> I can compare ?
> I'll try to get this together tomorrow.

Please try the attached patch. That should address the issue with your drive.


-- 
Damien Le Moal
Western Digital Research

[-- Attachment #2: 0001-scsi-Do-no-try-to-probe-for-CDL-on-old-drives.patch --]
[-- Type: text/x-patch, Size: 3238 bytes --]

From 94d05ce51d5c8a6f47383afd14134f3c779d89e2 Mon Sep 17 00:00:00 2001
From: Damien Le Moal <dlemoal@kernel.org>
Date: Thu, 14 Sep 2023 11:08:58 +0900
Subject: [PATCH] scsi: Do no try to probe for CDL on old drives

Some old drives (e.g. an Ultra320 SCSI disk as reported by John) do not
seem to execute MAINTENANCE_IN / MI_REPORT_SUPPORTED_OPERATION_CODES
commands correctly and hang when a non-zero service action is specified
(one command format with service action case in scsi_report_opcode()).

Currently, CDL probing with scsi_cdl_check_cmd() is the only caller
using a non zero service action for scsi_report_opcode(). To avoid
issues with these old drives, do not attempt CDL probe if the device
reports support for an SPC version lower than 5 (CDL was introduced in
SPC-5). To keep things working with ATA devices which probe for the CDL
T2A and T2B pages introduced with SPC-6, modify ata_scsiop_inq_std() to
claim SPC-6 version compatibility for ATA drives supporting CDL.

include/scsi/scsi.h is also modified to add the missing definitions for
the SCSI_SPC_4 and SCSI_SPC_5 versions. SCSI_SPC_6 is not added as,
oddly, the latest SPC-6 specification defines the same 7h version code
as SPC-5.

Reported-by: John David Anglin <dave.anglin@bell.net>
Fixes: 624885209f31 ("scsi: core: Detect support for command duration limits")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/libata-scsi.c |  3 +++
 drivers/scsi/scsi.c       | 11 +++++++++++
 include/scsi/scsi.h       |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 92ae4b4f30ac..654ee9a0c064 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1828,6 +1828,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 		hdr[2] = 0x7; /* claim SPC-5 version compatibility */
 	}
 
+	if (args->dev->flags & ATA_DFLAG_CDL)
+		hdr[2] = 0x7; /* claim SPC-6 version compatibility */
+
 	memcpy(rbuf, hdr, sizeof(hdr));
 	memcpy(&rbuf[8], "ATA     ", 8);
 	ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index d0911bc28663..89367c4bf0ef 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -613,6 +613,17 @@ void scsi_cdl_check(struct scsi_device *sdev)
 	bool cdl_supported;
 	unsigned char *buf;
 
+	/*
+	 * Support for CDL was defined in SPC-5. Ignore devices reporting an
+	 * lower SPC version. This also avoids problems with old drives choking
+	 * on MAINTENANCE_IN / MI_REPORT_SUPPORTED_OPERATION_CODES with a
+	 * service action specified, as done in scsi_cdl_check_cmd().
+	 */
+	if (sdev->scsi_level < SCSI_SPC_5) {
+		sdev->cdl_supported = 0;
+		return;
+	}
+
 	buf = kmalloc(SCSI_CDL_CHECK_BUF_LEN, GFP_KERNEL);
 	if (!buf) {
 		sdev->cdl_supported = 0;
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index ec093594ba53..39f6bc7bff0f 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -157,6 +157,8 @@ enum scsi_disposition {
 #define SCSI_3          4        /* SPC */
 #define SCSI_SPC_2      5
 #define SCSI_SPC_3      6
+#define SCSI_SPC_4	7
+#define SCSI_SPC_5	8
 
 /*
  * INQ PERIPHERAL QUALIFIERS
-- 
2.41.0


  parent reply	other threads:[~2023-09-14  2:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 19:08 [PATCH] linux/export: fix reference to exported functions for parisc64 Masahiro Yamada
2023-09-05 21:57 ` John David Anglin
2023-09-05 23:59   ` John David Anglin
2023-09-07 22:02     ` John David Anglin
2023-09-09 17:20       ` Masahiro Yamada
2023-09-09 19:20         ` Masahiro Yamada
2023-09-10  7:47           ` Masahiro Yamada
2023-09-10 21:30             ` John David Anglin
2023-09-12 13:01               ` Helge Deller
2023-09-12 13:20                 ` John David Anglin
2023-09-12 14:05                   ` Helge Deller
2023-09-12 14:53                     ` John David Anglin
2023-09-12 21:53               ` John David Anglin
2023-09-13 17:58                 ` John David Anglin
2023-09-13 21:22                   ` John David Anglin
2023-09-13 23:45                     ` Damien Le Moal
2023-09-14  0:29                       ` John David Anglin
2023-09-14  0:45                         ` Damien Le Moal
2023-09-14  1:15                         ` Damien Le Moal
2023-09-14  2:24                         ` Damien Le Moal [this message]
2023-09-14 15:07                           ` John David Anglin
2023-09-14 21:59                             ` Damien Le Moal
2023-09-05 22:14 ` John David Anglin
     [not found] ` <1MbRk3-1q6Cp42Bcv-00bwDk@mail.gmx.net>
2023-09-09 17:15   ` Masahiro Yamada

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=bed98fc9-fb84-4912-6c73-5b7db575c375@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=ndesaulniers@google.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