From: "Asutosh Das (asd)" <asutoshd@codeaurora.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Bart Van Assche <bvanassche@acm.org>,
Adrian Hunter <adrian.hunter@intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
cang@codeaurora.org,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"open list:TARGET SUBSYSTEM" <linux-scsi@vger.kernel.org>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Stanley Chu <stanley.chu@mediatek.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Kiwoong Kim <kwmad.kim@samsung.com>,
Bean Huo <beanhuo@micron.com>, Lee Jones <lee.jones@linaro.org>,
Wei Yongjun <weiyongjun1@huawei.com>,
Dinghao Liu <dinghao.liu@zju.edu.cn>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Tomas Winkler <tomas.winkler@intel.com>,
Jaegeuk Kim <jaegeuk@kernel.org>,
Satya Tangirala <satyat@google.com>,
open list <linux-kernel@vger.kernel.org>,
"moderated list:ARM/SAMSUNG S3C,
S5P AND EXYNOS ARM ARCHITECTURES"
<linux-arm-kernel@lists.infradead.org>,
"open list:ARM/SAMSUNG S3C,
S5P AND EXYNOS ARM ARCHITECTURES"
<linux-samsung-soc@vger.kernel.org>,
"moderated list:UNIVERSAL FLASH STORAGE HOST CONTROLLER
DRIVER..." <linux-mediatek@lists.infradead.org>,
Linux-PM mailing list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v10 1/2] scsi: ufs: Enable power management for wlun
Date: Tue, 9 Mar 2021 20:04:53 -0800 [thread overview]
Message-ID: <6b985880-f23a-adb3-8b7a-7ee1b56e6fa7@codeaurora.org> (raw)
In-Reply-To: <20210310031438.GB203516@rowland.harvard.edu>
On 3/9/2021 7:14 PM, Alan Stern wrote:
> On Tue, Mar 09, 2021 at 07:04:34PM -0800, Asutosh Das (asd) wrote:
>> Hello
>> I & Can (thanks CanG) debugged this further:
>>
>> Looks like this issue can occur if the sd probe is asynchronous.
>>
>> Essentially, the sd_probe() is done asynchronously and driver_probe_device()
>> invokes pm_runtime_get_suppliers() before invoking sd_probe().
>>
>> But scsi_probe_and_add_lun() runs in a separate context.
>> So the scsi_autopm_put_device() invoked from scsi_scan_host() context
>> reduces the link->rpm_active to 1. And sd_probe() invokes
>> scsi_autopm_put_device() and starts a timer. And then driver_probe_device()
>> invoked from __device_attach_async_helper context reduces the
>> link->rpm_active to 1 thus enabling the supplier to suspend before the
>> consumer suspends.
>
>> I don't see a way around this. Please let me know if you
>> (@Alan/@Bart/@Adrian) have any thoughts on this.
>
> How about changing the SCSI core so that it does a runtime_get before
> starting an async probe, and the async probe routine does a
> runtime_put when it is finished? In other words, don't allow a device
> to go into runtime suspend while it is waiting to be probed.
>
> I don't think that would be too intrusive.
>
> Alan Stern
>
Hi Alan
Thanks for the suggestion.
Am trying to understand:
Do you mean something like this:
int scsi_sysfs_add_sdev(struct scsi_device *sdev)
{
scsi_autopm_get_device(sdev);
pm_runtime_get_noresume(&sdev->sdev_gendev);
[...]
scsi_autopm_put_device(sdev);
[...]
}
static int sd_probe(struct device *dev)
{
[...]
pm_runtime_put_noidle(dev);
scsi_autopm_put_device(sdp);
[...]
}
This may work (I'm limited by my imagination in scsi layer :) ).
But the pm_runtime_put_noidle() would have to be added to all registered
scsi_driver{}, perhaps? Or may be I can check for sdp->type?
-asd
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
Linux Foundation Collaborative Project
next prev parent reply other threads:[~2021-03-10 4:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1614725302.git.asutoshd@codeaurora.org>
2021-03-02 22:52 ` [PATCH v10 1/2] scsi: ufs: Enable power management for wlun Asutosh Das
2021-03-04 15:35 ` Adrian Hunter
2021-03-06 2:54 ` Asutosh Das (asd)
2021-03-06 16:16 ` Alan Stern
2021-03-08 16:21 ` Rafael J. Wysocki
2021-03-08 17:17 ` Rafael J. Wysocki
2021-03-09 15:56 ` Asutosh Das (asd)
2021-03-10 3:04 ` Asutosh Das (asd)
2021-03-10 3:14 ` Alan Stern
2021-03-10 4:04 ` Asutosh Das (asd) [this message]
2021-03-10 16:27 ` Alan Stern
2021-03-10 16:39 ` Asutosh Das (asd)
2021-03-14 9:11 ` Adrian Hunter
2021-03-15 22:22 ` Asutosh Das (asd)
2021-03-16 7:48 ` Adrian Hunter
2021-03-16 20:35 ` Asutosh Das (asd)
2021-03-17 6:37 ` Adrian Hunter
2021-03-18 14:00 ` Rafael J. Wysocki
2021-03-18 17:27 ` Asutosh Das (asd)
2021-03-18 17:54 ` Rafael J. Wysocki
2021-03-18 17:58 ` Asutosh Das (asd)
2021-03-18 19:16 ` Adrian Hunter
2021-03-19 0:40 ` Asutosh Das (asd)
2021-03-02 22:52 ` [PATCH v10 2/2] ufs: sysfs: Resume the proper scsi device Asutosh Das
2021-03-03 4:31 ` Can Guo
2021-03-04 7:45 ` Adrian Hunter
2021-03-04 15:32 ` Asutosh Das
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=6b985880-f23a-adb3-8b7a-7ee1b56e6fa7@codeaurora.org \
--to=asutoshd@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=agross@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bjorn.andersson@linaro.org \
--cc=bvanassche@acm.org \
--cc=cang@codeaurora.org \
--cc=dinghao.liu@zju.edu.cn \
--cc=gustavoars@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=krzk@kernel.org \
--cc=kwmad.kim@samsung.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=satyat@google.com \
--cc=stanley.chu@mediatek.com \
--cc=stern@rowland.harvard.edu \
--cc=tomas.winkler@intel.com \
--cc=weiyongjun1@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;
as well as URLs for NNTP newsgroup(s).