public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Pylypiv <ipylypiv@google.com>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Niklas Cassel <cassel@kernel.org>, Hannes Reinecke <hare@suse.de>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v1 1/4] ata: libata: Remove redundant sense_buffer memsets
Date: Tue, 18 Jun 2024 19:31:59 +0000	[thread overview]
Message-ID: <ZnHgr2mgWGTDFXaT@google.com> (raw)
In-Reply-To: <2e89e829-9caa-470a-9ec8-5e8162fb5559@kernel.org>

On Mon, Jun 17, 2024 at 08:13:51AM +0900, Damien Le Moal wrote:
> On 6/15/24 04:18, Igor Pylypiv wrote:
> > scsi_queue_rq() memsets sense_buffer before a command is dispatched.
> > 
> > Libata is not memsetting sense_buffer before setting sense data that
> > was obtained from a disk so there should be no reason to do a memset
> > for ATA PASS-THROUGH / ATAPI.
> 
> This sentence is not very clear at all... I assume that the first part of the
> sentence is for non passthrough commands. In this case, libata does not clear
> the sense buffer because the scsi layer did that already, in scsi_queue_rq() as
> noted above.
> 
> For passthrough commands, the same should be happening as well since passthrough
> commands are also executed through blk_execute_rq() -> scsi_queue_rq(). So I do
> not really understand (but I do agree that the memset() in libata seem useless).

Thanks! I'll update the commit message to make it more clear.

> 
> > Memsetting the sense_buffer in ata_gen_passthru_sense() is erasing valid
> > sense data that was previously obtained from a disk. A follow-up patch
> > will modify ata_gen_passthru_sense() to stop generating sense data based
> > on ATA status register bits if a valid sense data is already present.
> 
> This fix should come first in the series, since that commit will likely need to
> go into current rc and cc-stable. And that will simplify this patch as well.
>
Ack. I'll reorder the commits.

> > 
> > Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> > ---
> >  drivers/ata/libata-eh.c   | 2 --
> >  drivers/ata/libata-scsi.c | 4 ----
> >  2 files changed, 6 deletions(-)
> > 
> > diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> > index 214b935c2ced..b5e05efe73f6 100644
> > --- a/drivers/ata/libata-eh.c
> > +++ b/drivers/ata/libata-eh.c
> > @@ -1479,8 +1479,6 @@ unsigned int atapi_eh_request_sense(struct ata_device *dev,
> >  	struct ata_port *ap = dev->link->ap;
> >  	struct ata_taskfile tf;
> >  
> > -	memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
> > -
> >  	/* initialize sense_buf with the error register,
> >  	 * for the case where they are -not- overwritten
> >  	 */
> > diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> > index cdf29b178ddc..032cf11d0bcc 100644
> > --- a/drivers/ata/libata-scsi.c
> > +++ b/drivers/ata/libata-scsi.c
> > @@ -858,8 +858,6 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
> >  	unsigned char *desc = sb + 8;
> >  	u8 sense_key, asc, ascq;
> >  
> > -	memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
> > -
> >  	/*
> >  	 * Use ata_to_sense_error() to map status register bits
> >  	 * onto sense key, asc & ascq.
> > @@ -953,8 +951,6 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
> >  	u64 block;
> >  	u8 sense_key, asc, ascq;
> >  
> > -	memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
> > -
> >  	if (ata_dev_disabled(dev)) {
> >  		/* Device disabled after error recovery */
> >  		/* LOGICAL UNIT NOT READY, HARD RESET REQUIRED */
> 
> -- 
> Damien Le Moal
> Western Digital Research
> 

Thank you,
Igor

  reply	other threads:[~2024-06-18 19:32 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 19:18 [PATCH v1 0/4] ATA PASS-THROUGH sense data fixes Igor Pylypiv
2024-06-14 19:18 ` [PATCH v1 1/4] ata: libata: Remove redundant sense_buffer memsets Igor Pylypiv
2024-06-16 23:13   ` Damien Le Moal
2024-06-18 19:31     ` Igor Pylypiv [this message]
2024-06-17 10:41   ` Niklas Cassel
2024-06-18 19:58     ` Igor Pylypiv
2024-06-20 11:51       ` Niklas Cassel
2024-06-20 23:21         ` Igor Pylypiv
2024-06-14 19:18 ` [PATCH v1 2/4] ata: libata-scsi: Generate ATA PT sense data when ATA ERR/DF are set Igor Pylypiv
2024-06-16 23:22   ` Damien Le Moal
2024-06-18  1:13     ` Igor Pylypiv
2024-06-20 13:12       ` Niklas Cassel
2024-06-20 23:24         ` Igor Pylypiv
2024-06-17 11:29   ` Niklas Cassel
2024-06-17 12:37     ` Niklas Cassel
2024-06-18 21:51     ` Igor Pylypiv
2024-06-20 12:55       ` Niklas Cassel
2024-06-21  0:05         ` Damien Le Moal
2024-06-21 11:41           ` Niklas Cassel
2024-06-14 19:18 ` [PATCH v1 3/4] ata: libata-scsi: Report valid sense data for ATA PT if present Igor Pylypiv
2024-06-16 23:25   ` Damien Le Moal
2024-06-18  0:02     ` Igor Pylypiv
2024-06-18  2:20       ` Damien Le Moal
2024-06-17 10:49   ` Niklas Cassel
2024-06-17 23:31     ` Igor Pylypiv
2024-06-20 14:24       ` Niklas Cassel
2024-06-20 14:39         ` Niklas Cassel
2024-06-20 23:34         ` Igor Pylypiv
2024-06-14 19:18 ` [PATCH v1 4/4] ata: libata-scsi: Fix offsets for the fixed format sense data Igor Pylypiv
2024-06-16 23:37   ` Damien Le Moal
2024-06-18  1:51     ` Igor Pylypiv

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=ZnHgr2mgWGTDFXaT@google.com \
    --to=ipylypiv@google.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /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