public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: yangxingui <yangxingui@huawei.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
	linux-kernel@vger.kernel.org, liuyonglong@huawei.com,
	kangfenglong@huawei.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-sata: retry hardreset when device detected but PHY not established
Date: Thu, 30 Apr 2026 10:46:18 +0200	[thread overview]
Message-ID: <afMW2scJrBSI_jLo@ryzen> (raw)
In-Reply-To: <c78f6dad-b0fe-a2fb-8458-9fe182cd6b54@huawei.com>

On Wed, Apr 29, 2026 at 03:01:48PM +0800, yangxingui wrote:
> > > > > > This is preceeded by a call to sata_link_resume(), which calls
> > > > > > sata_link_debounce() and that function makes sure that DET is stable. So if
> > > > > > after that DET still shows that their is no PHY, there is likely a big problem
> > > > > > with it and it is super slow to be established.

I agree with Damien, sata_link_debounce() is supposed to make sure that
DET is stable.


sata_link_debounce() will not explicitly wait for SStatus.DET to turn 0x3.

If value is stable, and SStatus.DET == 1, and time is before "deadline",
sata_link_debounce() will continue looping.

Else, if value is stable, and has been stable for "duration" amount of time,
it will return.

Since your print shows that SStatus == 1, that most likely means that the
deadline expired in sata_link_debounce().

I suggest that you try to increase the deadline, perhaps start off by simply
multiplying it by some factor in sata_link_debounce().


It would also be helpful if your commit message explained why returning
-EAGAIN makes a difference, because from what I can see, if the deadline
expires, sata_link_debounce() returns 0, which should cause sata_link_resume()
to return 0, which should cause sata_link_hardreset() to
return 0, with online == false.

If that is the case ata_do_reset() would return 0, and
ata_eh_followup_srst_needed() (returns true only if -EAGAIN) would return false.

Which should eventually cause us to retry another hard reset, as long as
tries <= max_tries.


By making sata_link_hardreset() return -EAGAIN, the difference I see is that
we will for a software reset followed by the hardreset, but you commit message
did not mention that.

So, my question is, why is it not sufficient to retry another
hardreset/COMRESET?

Does it work to only do a hardreset (without if a follow up softreset) if you
increase the deadline?


Kind regards,
Niklas

  reply	other threads:[~2026-04-30  8:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-25  6:04 [PATCH] ata: libata-sata: retry hardreset when device detected but PHY not established Xingui Yang
2026-04-25 22:53 ` Damien Le Moal
2026-04-27  1:51   ` yangxingui
2026-04-27  4:45     ` Damien Le Moal
2026-04-29  1:14       ` yangxingui
2026-04-29  1:36         ` Damien Le Moal
2026-04-29  7:01           ` yangxingui
2026-04-30  8:46             ` Niklas Cassel [this message]
2026-04-30  9:28               ` Niklas Cassel
2026-04-27 13:17 ` Niklas Cassel
2026-04-29  1:06   ` yangxingui

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=afMW2scJrBSI_jLo@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=kangfenglong@huawei.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=yangxingui@huawei.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