[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANcMJZCDe5fL0qYjgmDWJeHWjNYY0pzZ6TcNJ_nzdzR1VKjCug@mail.gmail.com>
Date: Mon, 13 Dec 2021 20:55:39 -0800
From: John Stultz <john.stultz@...aro.org>
To: Bart Van Assche <bvanassche@....org>
Cc: Bean Huo <huobean@...il.com>, alim.akhtar@...sung.com,
avri.altman@....com, asutoshd@...eaurora.org, jejb@...ux.ibm.com,
martin.petersen@...cle.com, stanley.chu@...iatek.com,
beanhuo@...ron.com, tomas.winkler@...el.com, cang@...eaurora.org,
daejun7.park@...sung.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] scsi: ufs: Fix deadlock issue in ufshcd_wait_for_doorbell_clr()
On Mon, Dec 13, 2021 at 8:15 PM Bart Van Assche <bvanassche@....org> wrote:
>
> On 12/13/21 3:00 PM, Bean Huo wrote:
> > Call shost_for_each_device() with host->host_lock is held will cause
> > a deadlock situation, which will cause the system to stall (the log
> > as follow). Fix this issue by narrowing the scope of the lock.
>
> Hi Bean,
>
> As you probably know I do not have access to a test setup that supports clock
> scaling. Has the following patch been considered?
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 6d692aae67ce..244eddf0caf8 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1084,7 +1084,9 @@ static u32 ufshcd_pending_cmds(struct ufs_hba *hba)
> struct scsi_device *sdev;
> u32 pending = 0;
>
> - shost_for_each_device(sdev, hba->host)
> + lockdep_assert_held(hba->host->host_lock);
> +
> + __shost_for_each_device(sdev, hba->host)
> pending += sbitmap_weight(&sdev->budget_map);
We hit the same issue today as well, and this solution works on db845c.
Reported-by: YongQin Liu <yongqin.liu@...aro.org>
Reported-by: Amit Pundir <amit.pundir@...aro.org>
Tested-by: John Stultz <john.stultz@...aro.org>
thanks
-john
Powered by blists - more mailing lists