From: Damien Le Moal <dlemoal@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Bart Van Assche <bvanassche@acm.org>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] Revert "scsi: sd: Do not repeat the starting disk message"
Date: Wed, 17 Jul 2024 19:46:14 +0900 [thread overview]
Message-ID: <bb277462-579b-4dc3-b63c-bf5768dd1ce4@kernel.org> (raw)
In-Reply-To: <ZpeIOsEbBIho9P_1@hovoldconsulting.com>
On 7/17/24 18:00, Johan Hovold wrote:
> On Wed, Jul 17, 2024 at 07:48:26AM +0900, Damien Le Moal wrote:
>> On 7/17/24 01:11, Johan Hovold wrote:
>>> This reverts commit 7a6bbc2829d4ab592c7e440a6f6f5deb3cd95db4.
>>>
>>> The offending commit tried to suppress a double "Starting disk" message
>>> for some drivers, but instead started spamming the log with bogus
>>> messages every five seconds:
>>>
>>> [ 311.798956] sd 0:0:0:0: [sda] Starting disk
>>> [ 316.919103] sd 0:0:0:0: [sda] Starting disk
>>> [ 322.040775] sd 0:0:0:0: [sda] Starting disk
>>> [ 327.161140] sd 0:0:0:0: [sda] Starting disk
>>> [ 332.281352] sd 0:0:0:0: [sda] Starting disk
>>> [ 337.401878] sd 0:0:0:0: [sda] Starting disk
>>> [ 342.521527] sd 0:0:0:0: [sda] Starting disk
>>> [ 345.850401] sd 0:0:0:0: [sda] Starting disk
>>> [ 350.967132] sd 0:0:0:0: [sda] Starting disk
>>> [ 356.090454] sd 0:0:0:0: [sda] Starting disk
>>> ...
>>>
>>> on machines that do not actually stop the disk on runtime suspend (e.g.
>>> the Qualcomm sc8280xp CRD with UFS).
>>
>> This is odd. If the disk is not being being suspended, why does the platform
>> even enable runtime PM for it ?
>
> This is clearly intended to be supported as sd_do_start_stop() returns
> false and that prevents sd_start_stop_device() from being called on
> resume (and similarly on suspend which is why there are no matching
> stopping disk messages above):
>
> [ 32.822189] sd 0:0:0:0: sd_resume_common - runtime = 1, sd_do_start_stop = 0, manage_runtime_start_stop = 0
Yes, so we can suppress the "Starting disk" message for runtime resume, to match
the runtime suspend not having the message.
>
>> Are you sure about this ? Or is it simply that
>> the runtime pm timer is set to a very low interval ?
>
> I haven't tried to determine why runtime pm is used this way, but your
> patch is clearly broken as it prints a message about starting the disk
> even when sd_do_start_stop() returns false.
The patch is not *that* broken, because sd_do_start_stop() returning false mean
only that the disk will *not* be started using a START STOP UNIT command. But
the underlying LLD must start the drive. So the message is not wrong, even
though it is probably best to suppress it for the runtime case.
The point here is that sd_runtime_resume() should NOT be called every 5s unless
there is also a runtime suspend in between the calls. As mentioned, this can
happen if the autosuspend timer is set to a very low timeout to aggressively
suspend the disk after a short idle time. That of course makes absolutely no
sense for HDDs given the spinup time needed, but I guess that is a possiblity
for UFS drives.
>
>> It almost sound like what we need to do here is suppress this message for the
>> runtime resume case, so something like:
>
> No, that would only make things worse as I assume you'd have a stopped
> disk message without a matching start message for driver that do end up
> stopping the disk here.
OK. so let's revert this patch and I will rework that message to be displayed
only on device removal, system suspend and system shutdown.
>> However, I would like to make sure that this platform is not calling
>> sd_resume_runtime() for nothing every 5s. If that is the case, then there is a
>> more fundamental problem here and reverting this patch is only hiding that.
>
> This is with the Qualcomm UFS driver, but it seems it just relies on the
> generic ufshcd_pltfrm_init() implementation.
>
> Also not sure why anyone would want to see these messages on every
> runtime suspend (for drivers that end up taking this path), but that's a
> separate discussion.
Not really. As mentioned above, it is probably best to suppress the start/stop
messages for runtime suspend. The separate discussion is why sd_runtime_resume
is called that often for this UFS drive: bug or aggressive autosuspend ? Given
that I do not have this hardware, I will let someone else look into that.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-07-17 10:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 16:11 [PATCH] Revert "scsi: sd: Do not repeat the starting disk message" Johan Hovold
2024-07-16 21:44 ` Bart Van Assche
2024-07-16 22:48 ` Damien Le Moal
2024-07-17 9:00 ` Johan Hovold
2024-07-17 10:46 ` Damien Le Moal [this message]
2024-07-17 11:25 ` Johan Hovold
2024-07-17 12:04 ` Damien Le Moal
2024-07-17 12:05 ` Damien Le Moal
2024-07-23 0:30 ` Martin K. Petersen
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=bb277462-579b-4dc3-b63c-bf5768dd1ce4@kernel.org \
--to=dlemoal@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bvanassche@acm.org \
--cc=johan+linaro@kernel.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stable@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