From: Neil Armstrong <neil.armstrong@linaro.org>
To: Bart Van Assche <bvanassche@acm.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, "Bean Huo" <beanhuo@micron.com>,
stable@vger.kernel.org,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Peter Wang" <peter.wang@mediatek.com>,
"Avri Altman" <avri.altman@wdc.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Maramaina Naresh" <quic_mnaresh@quicinc.com>,
"Mike Bi" <mikebi@micron.com>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Luca Porzio" <lporzio@micron.com>
Subject: Re: [PATCH] scsi: ufs: Start the RTC update work later
Date: Mon, 4 Nov 2024 14:43:31 +0100 [thread overview]
Message-ID: <5a08460d-6907-41ad-b520-b191429a6eef@linaro.org> (raw)
In-Reply-To: <20241031212632.2799127-1-bvanassche@acm.org>
On 31/10/2024 22:26, Bart Van Assche wrote:
> The RTC update work involves runtime resuming the UFS controller. Hence,
> only start the RTC update work after runtime power management in the UFS
> driver has been fully initialized. This patch fixes the following kernel
> crash:
>
> Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
> Workqueue: events ufshcd_rtc_work
> Call trace:
> _raw_spin_lock_irqsave+0x34/0x8c (P)
> pm_runtime_get_if_active+0x24/0x9c (L)
> pm_runtime_get_if_active+0x24/0x9c
> ufshcd_rtc_work+0x138/0x1b4
> process_one_work+0x148/0x288
> worker_thread+0x2cc/0x3d4
> kthread+0x110/0x114
> ret_from_fork+0x10/0x20
>
> Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
> Closes: https://lore.kernel.org/linux-scsi/0c0bc528-fdc2-4106-bc99-f23ae377f6f5@linaro.org/
> Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
> Cc: Bean Huo <beanhuo@micron.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/ufs/core/ufshcd.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 585557eaa9a2..ed82ff329314 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8633,6 +8633,14 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
> ufshcd_init_clk_scaling_sysfs(hba);
> }
>
> + /*
> + * The RTC update code accesses the hba->ufs_device_wlun->sdev_gendev
> + * pointer and hence must only be started after the WLUN pointer has
> + * been initialized by ufshcd_scsi_add_wlus().
> + */
> + schedule_delayed_work(&hba->ufs_rtc_update_work,
> + msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
> +
> ufs_bsg_probe(hba);
> scsi_scan_host(hba->host);
>
> @@ -8727,8 +8735,6 @@ static int ufshcd_post_device_init(struct ufs_hba *hba)
> ufshcd_force_reset_auto_bkops(hba);
>
> ufshcd_set_timestamp_attr(hba);
> - schedule_delayed_work(&hba->ufs_rtc_update_work,
> - msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS));
>
> if (!hba->max_pwr_info.is_valid)
> return 0;
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Thanks!
Neil
next prev parent reply other threads:[~2024-11-04 13:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 21:26 [PATCH] scsi: ufs: Start the RTC update work later Bart Van Assche
2024-11-01 6:27 ` Peter Wang (王信友)
2024-11-01 7:53 ` Manivannan Sadhasivam
2024-11-01 16:31 ` Bart Van Assche
2024-11-02 10:21 ` Manivannan Sadhasivam
2024-11-01 21:03 ` Bean Huo
2024-11-04 13:43 ` Neil Armstrong [this message]
2024-11-05 2:31 ` Martin K. Petersen
2024-11-05 3:48 ` James Bottomley
2024-11-05 18:54 ` Bart Van Assche
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=5a08460d-6907-41ad-b520-b191429a6eef@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=lporzio@micron.com \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=mikebi@micron.com \
--cc=peter.wang@mediatek.com \
--cc=quic_mnaresh@quicinc.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