[PATCH 1/2] mmc: sdhci-esdhc-imx: fix access hardirq-unsafe lock in atomic context

Dong Aisheng b29396 at freescale.com
Mon Dec 23 21:13:56 EST 2013


On Mon, Dec 23, 2013 at 08:47:01PM +0800, Shawn Guo wrote:
> On Mon, Dec 23, 2013 at 07:02:23PM +0800, Dong Aisheng wrote:
> > Sometimes we may meet the following lockdep issue.
> > The root cause is .set_clock callback is executed with spin_lock_irqsave
> > in sdhci_do_set_ios. However, the IMX set_clock callback will try to access
> > clk_get_rate which is using a mutex lock.
> > 
> > The fix avoids access mutex in .set_clock callback by initializing the
> > pltfm_host->clock at probe time and use it later instead of calling
> > clk_get_rate again in atomic context.
> 
> While I agree this is the way less intrusive, I'm also wondering why
> sdhci_do_set_ios() needs a spinlock at all, or at least it's
> questionable if the lock should necessarily be held for such a long
> running section.

Per my understanding, it's for protecting the host structure including
register r/w where can also be accessed from ISR, so we need it.

> 
> Nevertheless, as long as we can guarantee that the rate of
> pltfm_host->clk does not change after the driver is probed, I'm fine
> with the patch.
> 

We does not change the host parent clock always currently.

Regards
Dong Aisheng
> Shawn
> 




More information about the linux-arm-kernel mailing list