From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Sergei Shtylyov <sergei.shtylyov@gmail.com>,
Wenchao Hao <haowenchao@huawei.com>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: liuzhiqiang26@huawei.com, linfeilong@huawei.com
Subject: Re: [PATCH v2] ata:libata-eh:Cleanup ata_scsi_cmd_error_handler
Date: Thu, 15 Dec 2022 20:34:09 +0900 [thread overview]
Message-ID: <d991d4fd-3b5f-f0ef-5c96-2352a08e1262@opensource.wdc.com> (raw)
In-Reply-To: <f552f2ab-895a-14dd-d391-a7b1c9930c88@gmail.com>
On 12/15/22 20:30, Sergei Shtylyov wrote:
> Hello!
>
> The subject should really look like "ata: libata-eh: Cleanup
> ata_scsi_cmd_error_handler()"...
>
> On 12/15/22 1:57 PM, Wenchao Hao wrote:
>
>> If ap->ops->error_handler is NULL, just return.
>>
>> V2:
>> - Check ap->ops->error_handler without taking the spin lock
>
> This normally belongs under ---...
I should read all emails before replying. I commented exactly the same :)
>
>> Signed-off-by: Wenchao Hao <haowenchao@huawei.com>
>> ---
>> drivers/ata/libata-eh.c | 96 ++++++++++++++++++++---------------------
>> 1 file changed, 48 insertions(+), 48 deletions(-)
>>
>> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
>> index 34303ce67c14..c445c272e77f 100644
>> --- a/drivers/ata/libata-eh.c
>> +++ b/drivers/ata/libata-eh.c
> [...]
>> @@ -584,62 +589,57 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
>> * timed out iff its associated qc is active and not failed.
>> */
>> spin_lock_irqsave(ap->lock, flags);
>> - if (ap->ops->error_handler) {
>> - struct scsi_cmnd *scmd, *tmp;
>> - int nr_timedout = 0;
>> -
>> - /* This must occur under the ap->lock as we don't want
>> - a polled recovery to race the real interrupt handler
>> -
>> - The lost_interrupt handler checks for any completed but
>> - non-notified command and completes much like an IRQ handler.
>>
>> - We then fall into the error recovery code which will treat
>> - this as if normal completion won the race */
>> -
>> - if (ap->ops->lost_interrupt)
>> - ap->ops->lost_interrupt(ap);
>> + /* This must occur under the ap->lock as we don't want
>
> The multi-line comments should start with /* on its own line...
>
>> + * a polled recovery to race the real interrupt handler
>> + *
>> + * The lost_interrupt handler checks for any completed but
>> + * non-notified command and completes much like an IRQ handler.
>> + *
>> + * We then fall into the error recovery code which will treat
>> + * this as if normal completion won the race
>> + */
>> + if (ap->ops->lost_interrupt)
>> + ap->ops->lost_interrupt(ap);
>>
>> - list_for_each_entry_safe(scmd, tmp, eh_work_q, eh_entry) {
>> - struct ata_queued_cmd *qc;
>> + list_for_each_entry_safe(scmd, tmp, eh_work_q, eh_entry) {
>> + struct ata_queued_cmd *qc;
>>
>> - ata_qc_for_each_raw(ap, qc, i) {
>> - if (qc->flags & ATA_QCFLAG_ACTIVE &&
>> - qc->scsicmd == scmd)
>> - break;
>> - }
>> + ata_qc_for_each_raw(ap, qc, i) {
>> + if (qc->flags & ATA_QCFLAG_ACTIVE &&
>> + qc->scsicmd == scmd)
>> + break;
>> + }
>>
>> - if (i < ATA_MAX_QUEUE) {
>> - /* the scmd has an associated qc */
>> - if (!(qc->flags & ATA_QCFLAG_FAILED)) {
>> - /* which hasn't failed yet, timeout */
>> - qc->err_mask |= AC_ERR_TIMEOUT;
>> - qc->flags |= ATA_QCFLAG_FAILED;
>> - nr_timedout++;
>> - }
>> - } else {
>> - /* Normal completion occurred after
>> - * SCSI timeout but before this point.
>> - * Successfully complete it.
>> - */
>> - scmd->retries = scmd->allowed;
>> - scsi_eh_finish_cmd(scmd, &ap->eh_done_q);
>> + if (i < ATA_MAX_QUEUE) {
>> + /* the scmd has an associated qc */
>> + if (!(qc->flags & ATA_QCFLAG_FAILED)) {
>> + /* which hasn't failed yet, timeout */
>> + qc->err_mask |= AC_ERR_TIMEOUT;
>> + qc->flags |= ATA_QCFLAG_FAILED;
>> + nr_timedout++;
>> }
>> + } else {
>> + /* Normal completion occurred after
>
> Here as well...
>
>> + * SCSI timeout but before this point.
>> + * Successfully complete it.
>> + */
>> + scmd->retries = scmd->allowed;
>> + scsi_eh_finish_cmd(scmd, &ap->eh_done_q);
>> }
>> + }
>>
>> - /* If we have timed out qcs. They belong to EH from
>> - * this point but the state of the controller is
>> - * unknown. Freeze the port to make sure the IRQ
>> - * handler doesn't diddle with those qcs. This must
>> - * be done atomically w.r.t. setting QCFLAG_FAILED.
>> - */
>> - if (nr_timedout)
>> - __ata_port_freeze(ap);
>> -
>> + /* If we have timed out qcs. They belong to EH from
>
> And here...
>
> [...]
>
> MBR, Sergey
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2022-12-15 11:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 10:57 [PATCH v2] ata:libata-eh:Cleanup ata_scsi_cmd_error_handler Wenchao Hao
2022-12-15 11:30 ` Sergei Shtylyov
2022-12-15 11:34 ` Damien Le Moal [this message]
2022-12-15 15:20 ` Wenchao Hao
2022-12-15 11:33 ` Damien Le Moal
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=d991d4fd-3b5f-f0ef-5c96-2352a08e1262@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=haowenchao@huawei.com \
--cc=linfeilong@huawei.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuzhiqiang26@huawei.com \
--cc=sergei.shtylyov@gmail.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