public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Eyal Lebedinsky <eyal@eyal.emu.id.au>
Cc: list linux-ide <linux-ide@vger.kernel.org>
Subject: Re: ata timeout exceptions
Date: Sun, 9 Nov 2025 21:40:26 +0100	[thread overview]
Message-ID: <aRD8OoDwE2fyP_JM@ryzen> (raw)
In-Reply-To: <acf2fa9f-f98d-4eb0-b18b-a04aa123201b@eyal.emu.id.au>

Hello Eyal,

On Mon, Nov 03, 2025 at 03:13:34PM +1100, Eyal Lebedinsky wrote:
> 
> I want to understand what is going on:
> 
> 1) Why do I not see an I/O error and the writes to the disk (rsync) seem to complete?
>    Which layer absorbs the errors, hiding them from the application?

SCSI layer.

For a timed out command, libata will set DID_TIME_OUT:
https://github.com/torvalds/linux/blob/v6.18-rc4/drivers/ata/libata-eh.c#L652-L654

For most commands SCSI layer, SCSI will set cmd->allowed to sdkp->max_retries:
https://github.com/torvalds/linux/blob/v6.18-rc4/drivers/scsi/sd.c#L1411

which by default is 5:
https://github.com/torvalds/linux/blob/v6.18-rc4/drivers/scsi/sd.c#L3962

Thus, most commands will be retried up to 5 times:
https://github.com/torvalds/linux/blob/v6.18-rc4/drivers/scsi/scsi_error.c#L2225

Thus, the user will only see the I/O as an error if the command failed
6 times.

(Note that if the command returns sense data instead of timeout, depending on
the sense data returned, we might report an I/O error to the user immediately.


> 
> 2) Why do I get only one command_timeout counted (originally, with ncq active) and none when ncq is disabled?

You are right that even if it is only a single command that times out,
the whole queue will be drained and retried.
(Because we always do a hard reset after a command timeout.)

command_timeout is most likely increased only by one because it was
only a single command that timed out. (The other commands might have
been queued but were never executed/finished.)

I have no idea why a command timeout, when NCQ has been disabled,
does not increase the command_timeout counter. My expectation would
have been for the counter to still be increased by one.


Kind regards,
Niklas

  reply	other threads:[~2025-11-09 20:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03  4:13 ata timeout exceptions Eyal Lebedinsky
2025-11-09 20:40 ` Niklas Cassel [this message]
2025-11-09 22:41   ` Eyal Lebedinsky
2025-11-10 13:11     ` Niklas Cassel
2025-11-14  4:32 ` Eyal Lebedinsky
2025-11-18 15:17   ` Niklas Cassel
2025-11-18 23:05     ` Eyal Lebedinsky
2025-11-19  5:41       ` Damien Le Moal
2025-11-19 13:37         ` Eyal Lebedinsky
2025-11-20  3:34           ` Damien Le Moal
2025-11-20 11:38             ` Eyal Lebedinsky
2025-11-20 12:18               ` Damien Le Moal
2025-11-20 23:53                 ` Eyal Lebedinsky
2025-12-16 23:39 ` Eyal Lebedinsky
2025-12-17  1:35   ` Damien Le Moal
2025-12-17 11:56     ` Eyal Lebedinsky
2025-12-17 12:02       ` Niklas Cassel
2025-12-20  4:03         ` Eyal Lebedinsky
2025-12-21  8:34           ` Damien Le Moal
2025-12-21 12:12             ` Eyal Lebedinsky
2025-12-21 22:43               ` Eyal Lebedinsky
2025-12-21 23:14                 ` Damien Le Moal
2025-12-22  2:10                   ` Eyal Lebedinsky
2025-12-22  3:43                     ` Damien Le Moal
2025-12-22  5:57                       ` Eyal Lebedinsky
2025-12-30 22:43                         ` Eyal Lebedinsky
2026-01-02  1:21                           ` Damien Le Moal
2026-01-02  6:30                             ` Eyal Lebedinsky

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=aRD8OoDwE2fyP_JM@ryzen \
    --to=cassel@kernel.org \
    --cc=eyal@eyal.emu.id.au \
    --cc=linux-ide@vger.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