[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DM6PR04MB6575245460C01A2A88701ECCFC222@DM6PR04MB6575.namprd04.prod.outlook.com>
Date: Thu, 21 Nov 2024 21:39:39 +0000
From: Avri Altman <Avri.Altman@....com>
To: Bart Van Assche <bvanassche@....org>, "Martin K . Petersen"
<martin.petersen@...cle.com>
CC: "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Bean Huo
<beanhuo@...ron.com>
Subject: RE: [PATCH v4 2/3] scsi: ufs: core: Introduce a new clock_gating lock
> On 11/21/24 1:06 PM, Avri Altman wrote:
> >> On 11/18/24 6:41 AM, Avri Altman wrote:
> >>> + spin_lock_irqsave(hba->host->host_lock, flags);
> >>> + if (ufshcd_has_pending_tasks(hba) ||
> >>> + hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL) {
> >>> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> >>> + return;
> >>> + }
> >>> + spin_unlock_irqrestore(hba->host->host_lock, flags);
> >>
> >> Why explicit lock/unlock calls instead of using scoped_guard()?
> > Should I apply those to host_lock as well?
>
> Yes, please use scoped_guard() and guard() in new code. I expect that using
> scoped_guard() here will lead to code that is easier to read.
Done.
>
> >>> + * @clk_gating_workq: workqueue for clock gating work.
> >>> + * @lock: serialize access to some struct ufs_clk_gating members
> >>
> >> Please document that @lock is the outer lock relative to the host lock.
> > Not sure what you mean?
> > host_lock is nested in one place only, should this goes to the @lock
> documentation?
>
> Whenever locks are nested, the nesting order must be consistent
> everywhere. Otherwise there is a risk of triggering an ABBA deadlock.
> So I think it is a good practice to document in which order locks should be
> nested.
Done.
Thanks,
Avri
>
> Thanks,
>
> Bart.
Powered by blists - more mailing lists