mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manisadhasivam.linux@gmail.com>
To: Avri Altman <Avri.Altman@wdc.com>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH] scsi: ufs: core: Ensure clk_gating.lock is used only after initialization
Date: Wed, 22 Jan 2025 22:37:02 +0530	[thread overview]
Message-ID: <20250122170702.jzwd57tk5dl7epwz@thinkpad> (raw)
In-Reply-To: <BL0PR04MB6564A6B239E652983AC5A878FCE12@BL0PR04MB6564.namprd04.prod.outlook.com>

On Wed, Jan 22, 2025 at 11:04:12AM +0000, Avri Altman wrote:
> > > To fix this issue, we use the existing `is_initialized` flag in the
> > > `clk_gating` structure to ensure that the spinlock is only used after
> > > it has been properly initialized. We check this flag before using the
> > > spinlock in the `ufshcd_setup_clocks` function.
> > >
> > > It was incorrect in the first place to call `setup_clocks()` before
> > > `ufshcd_init_clk_gating()`, and the introduction of the new lock
> > > unmasked this bug.
> > 
> > If calling setup_clocks() before ufshcd_init_clk_gating() is incorrect, why are
> > you not reordering it?
> > 
> > Checking for 'clk_gating.is_initialized' looks like a hack.
> Actually 'clk_gating.is_initialized' seems like the standard way to do this - see e.g. in hold and release.
> As for moving setup_clocks() around, I have some concerns about moving it out of ufshcd_hba_init.
> Having considered the alternatives, it seems that using 'clk_gating.is_initialized' ,
> despite its limitations, is the most practical solution we have.
> 
> I am open though for other suggestions.
> 

Looking at the code again, I think it is OK to have this fix for now. But
someone should spend some time to revisit the locking part in this driver.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2025-01-22 17:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  6:27 Avri Altman
2025-01-22  8:17 ` Manivannan Sadhasivam
2025-01-22 11:04   ` Avri Altman
2025-01-22 17:07     ` Manivannan Sadhasivam [this message]
2025-01-22 19:15 ` Bart Van Assche
2025-01-23  7:43   ` Avri Altman
2025-01-23 15:20 ` Geert Uytterhoeven
2025-01-23 20:03   ` Avri Altman

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=20250122170702.jzwd57tk5dl7epwz@thinkpad \
    --to=manisadhasivam.linux@gmail.com \
    --cc=Avri.Altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®