* Question on ata_gen_passthru_sense interpretation of fixed format sense buffer
@ 2020-08-03 16:44 Akshat Jain
2020-08-17 17:18 ` Akshat Jain
2020-08-17 17:42 ` Tejun Heo
0 siblings, 2 replies; 5+ messages in thread
From: Akshat Jain @ 2020-08-03 16:44 UTC (permalink / raw)
To: Tejun Heo; +Cc: Vishakha Channapattan, linux-ide, John Grass, Thieu Le
Hello Jens Tejun,
I have a question regarding the ata_gen_passthru_sense function (libata-scsi.c).
This function while generating fixed format sense blocks, puts the
INFORMATION field at offset 8 and COMMAND-SPECIFIC-INFORMATION at
offset 16.
While as per SCSI Primary commands - 4 specification, section 4.5.3
Fixed format sense data Table 53, the INFORMATION field is at offset 3
and COMMAND-SPECIFIC-INFORMATION is at offset 8.
Code snippet:
static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->result_tf;
unsigned char *sb = cmd->sense_buffer;
unsigned char *desc = sb + 8;
….
if ((cmd->sense_buffer[0] & 0x7f) >= 0x72) {
....
} else {
/* Fixed sense format */
desc[0] = tf->feature;
desc[1] = tf->command; /* status */
desc[2] = tf->device;
desc[3] = tf->nsect;
desc[7] = 0;
if (tf->flags & ATA_TFLAG_LBA48) {
desc[8] |= 0x80;
if (tf->hob_nsect)
desc[8] |= 0x40;
if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah)
desc[8] |= 0x20;
}
desc[9] = tf->lbal;
desc[10] = tf->lbam;
desc[11] = tf->lbah;
}
}
Link to spec: https://www.t10.org/cgi-bin/ac.pl?t=f&f=spc4r37a.pdf
My team has confirmed this observation. Do you believe our
interpretation of the specification is correct and if yes does this
need to be corrected?
Regards,
Akshat Jain
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on ata_gen_passthru_sense interpretation of fixed format sense buffer
2020-08-03 16:44 Question on ata_gen_passthru_sense interpretation of fixed format sense buffer Akshat Jain
@ 2020-08-17 17:18 ` Akshat Jain
2020-08-17 17:42 ` Tejun Heo
1 sibling, 0 replies; 5+ messages in thread
From: Akshat Jain @ 2020-08-17 17:18 UTC (permalink / raw)
To: Tejun Heo; +Cc: Vishakha Channapattan, linux-ide, John Grass, Thieu Le
Hello Tejun,
Gentle ping if you missed this email.
Regards,
Akshat
On Mon, Aug 3, 2020 at 9:44 AM Akshat Jain <akshatzen@google.com> wrote:
>
> Hello Jens Tejun,
> I have a question regarding the ata_gen_passthru_sense function (libata-scsi.c).
>
> This function while generating fixed format sense blocks, puts the
> INFORMATION field at offset 8 and COMMAND-SPECIFIC-INFORMATION at
> offset 16.
> While as per SCSI Primary commands - 4 specification, section 4.5.3
> Fixed format sense data Table 53, the INFORMATION field is at offset 3
> and COMMAND-SPECIFIC-INFORMATION is at offset 8.
>
> Code snippet:
>
> static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
> {
> struct scsi_cmnd *cmd = qc->scsicmd;
> struct ata_taskfile *tf = &qc->result_tf;
> unsigned char *sb = cmd->sense_buffer;
> unsigned char *desc = sb + 8;
> ….
> if ((cmd->sense_buffer[0] & 0x7f) >= 0x72) {
> ....
> } else {
> /* Fixed sense format */
> desc[0] = tf->feature;
> desc[1] = tf->command; /* status */
> desc[2] = tf->device;
> desc[3] = tf->nsect;
> desc[7] = 0;
> if (tf->flags & ATA_TFLAG_LBA48) {
> desc[8] |= 0x80;
> if (tf->hob_nsect)
> desc[8] |= 0x40;
> if (tf->hob_lbal || tf->hob_lbam || tf->hob_lbah)
> desc[8] |= 0x20;
> }
> desc[9] = tf->lbal;
> desc[10] = tf->lbam;
> desc[11] = tf->lbah;
> }
> }
>
> Link to spec: https://www.t10.org/cgi-bin/ac.pl?t=f&f=spc4r37a.pdf
>
> My team has confirmed this observation. Do you believe our
> interpretation of the specification is correct and if yes does this
> need to be corrected?
>
> Regards,
> Akshat Jain
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on ata_gen_passthru_sense interpretation of fixed format sense buffer
2020-08-03 16:44 Question on ata_gen_passthru_sense interpretation of fixed format sense buffer Akshat Jain
2020-08-17 17:18 ` Akshat Jain
@ 2020-08-17 17:42 ` Tejun Heo
2020-08-19 4:12 ` Akshat Jain
1 sibling, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2020-08-17 17:42 UTC (permalink / raw)
To: Akshat Jain; +Cc: Vishakha Channapattan, linux-ide, John Grass, Thieu Le
Hello,
On Mon, Aug 03, 2020 at 09:44:26AM -0700, Akshat Jain wrote:
> Hello Jens Tejun,
> I have a question regarding the ata_gen_passthru_sense function (libata-scsi.c).
>
> This function while generating fixed format sense blocks, puts the
> INFORMATION field at offset 8 and COMMAND-SPECIFIC-INFORMATION at
> offset 16.
> While as per SCSI Primary commands - 4 specification, section 4.5.3
> Fixed format sense data Table 53, the INFORMATION field is at offset 3
> and COMMAND-SPECIFIC-INFORMATION is at offset 8.
Sorry about the late reply. I could have been easily mistaken and don't
think the path has been under any kind of scrutiny. The best way to proceed
would be submitting a patch referencing the spec cc'ing linux-ide and
linux-scsi. Have you guys got bitten by this or is this discovered through
code review?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on ata_gen_passthru_sense interpretation of fixed format sense buffer
2020-08-17 17:42 ` Tejun Heo
@ 2020-08-19 4:12 ` Akshat Jain
2020-09-04 17:07 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Akshat Jain @ 2020-08-19 4:12 UTC (permalink / raw)
To: Tejun Heo
Cc: Vishakha Channapattan, linux-ide, John Grass, Thieu Le, linux-scsi
Hello Tejun,
Thank you very much for your reply.
To answer your question:
1. Yes we will start working on a patch and send it for review.
2. We found this issue during our code review.
Another information I need to bring to your attention is that many
user libraries today decode the fixed format sense block based on the
format today's kernel (ata_gen_passthru_sense) provides. Rather than
the format specified in the SCSI Primary commands - 4 specification.
If we were to correct the field offsets for the fixed format sense block.
It may break such libraries. How do you assess the impact
of such a change?
Regards,
Akshat
On Mon, Aug 17, 2020 at 10:42 AM Tejun Heo <tj@kernel.org> wrote:
>
> Hello,
>
> On Mon, Aug 03, 2020 at 09:44:26AM -0700, Akshat Jain wrote:
> > Hello Jens Tejun,
> > I have a question regarding the ata_gen_passthru_sense function (libata-scsi.c).
> >
> > This function while generating fixed format sense blocks, puts the
> > INFORMATION field at offset 8 and COMMAND-SPECIFIC-INFORMATION at
> > offset 16.
> > While as per SCSI Primary commands - 4 specification, section 4.5.3
> > Fixed format sense data Table 53, the INFORMATION field is at offset 3
> > and COMMAND-SPECIFIC-INFORMATION is at offset 8.
>
> Sorry about the late reply. I could have been easily mistaken and don't
> think the path has been under any kind of scrutiny. The best way to proceed
> would be submitting a patch referencing the spec cc'ing linux-ide and
> linux-scsi. Have you guys got bitten by this or is this discovered through
> code review?
>
> Thanks.
>
> --
> tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question on ata_gen_passthru_sense interpretation of fixed format sense buffer
2020-08-19 4:12 ` Akshat Jain
@ 2020-09-04 17:07 ` Tejun Heo
0 siblings, 0 replies; 5+ messages in thread
From: Tejun Heo @ 2020-09-04 17:07 UTC (permalink / raw)
To: Akshat Jain
Cc: Vishakha Channapattan, linux-ide, John Grass, Thieu Le, linux-scsi
Hello,
On Tue, Aug 18, 2020 at 09:12:13PM -0700, Akshat Jain wrote:
> To answer your question:
> 1. Yes we will start working on a patch and send it for review.
> 2. We found this issue during our code review.
>
> Another information I need to bring to your attention is that many
> user libraries today decode the fixed format sense block based on the
> format today's kernel (ata_gen_passthru_sense) provides. Rather than
> the format specified in the SCSI Primary commands - 4 specification.
> If we were to correct the field offsets for the fixed format sense block.
> It may break such libraries. How do you assess the impact
> of such a change?
So, I don't know. Given that nobody tripped over it till now, I doubt fixing
it would cause a lot of trouble but at the same time it isn't a real
problem, again, given that nobody has tripped over it yet. Maybe just fix it
and see how it goes?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-04 18:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 16:44 Question on ata_gen_passthru_sense interpretation of fixed format sense buffer Akshat Jain
2020-08-17 17:18 ` Akshat Jain
2020-08-17 17:42 ` Tejun Heo
2020-08-19 4:12 ` Akshat Jain
2020-09-04 17:07 ` Tejun Heo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.