[EXT] Re: [PATCH v9 2/4] irqchip: Add IMX MU MSI controller driver

Frank Li frank.li at nxp.com
Fri Sep 9 07:59:01 PDT 2022



> -----Original Message-----
> From: Marc Zyngier <maz at kernel.org>
> Sent: Friday, September 9, 2022 7:08 AM
> To: Frank Li <frank.li at nxp.com>
> Cc: tglx at linutronix.de; robh+dt at kernel.org;
> krzysztof.kozlowski+dt at linaro.org; shawnguo at kernel.org;
> s.hauer at pengutronix.de; kw at linux.com; bhelgaas at google.com; linux-
> kernel at vger.kernel.org; devicetree at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; linux-pci at vger.kernel.org; Peng Fan
> <peng.fan at nxp.com>; Aisheng Dong <aisheng.dong at nxp.com>;
> jdmason at kudzu.us; kernel at pengutronix.de; festevam at gmail.com; dl-linux-
> imx <linux-imx at nxp.com>; kishon at ti.com; lorenzo.pieralisi at arm.com;
> ntb at lists.linux.dev; lznuaa at gmail.com; imx at lists.linux.dev;
> manivannan.sadhasivam at linaro.org
> Subject: Re: [EXT] Re: [PATCH v9 2/4] irqchip: Add IMX MU MSI controller
> driver
> 
> Caution: EXT Email
> 
> On Thu, 08 Sep 2022 16:35:20 +0100,
> Frank Li <frank.li at nxp.com> wrote:
> 
> > > > > > +struct imx_mu_msi {
> > > > > > +     spinlock_t                      lock;
> > > > > > +     raw_spinlock_t                  reglock;
> > > > >
> > > > > Why two locks? Isn't one enough to protect both MSI allocation
> (which
> > > > > happens once in a blue moon) and register access?
> > > >
> > > > [Frank Li] Previously your comment, ask me to use raw_spinlock for
> > > > read\write register access.  I don't think raw_spinlock is good for
> > > > MSI allocation.
> > >
> > > Why wouldn't it be good enough? I'd really like to know.[Frank Li] '
> >
> > [Frank Li] According to my understand, raw_spinlock skip some lockdep
> > /debug feature to get better performance, which should be used when
> > Frequently call, such as irq handle\polling thread.
> 
> I'm afraid you are terribly misguided. They both have the same debug
> features because they are both using the same core implementation, and
> the only difference is whether this is preemptible for RT purposes or
> not.
> 
> > Spinlock have DEBUG feature to check wrong use lock.  Allocate MSI
> generally
> > only is call once when driver probe.
> 
> Again, you should really read the code and the documentation and stop
> making things up.

[Frank Li] Thanks. You give me the correct direction. Some stackoverflow's
Doc was misleaded.  I double checked spin_lock implementation.  PREEMPT_RT
Kernel map spin_lock to rt_mutex.

I am curious  why exist spin_lock_irqsave and raw_spin_lock_irqsave before
PREEMTP_RT merge into kernel tree. 

> 
> >
> > The basic principle,  lock should be used only when necessary.  Access reg
> and
> > Allocate msi is totally independence events.
> 
> Independent events that do not occur simultaneously. So no harm in
> sharing the same lock.
> 
>         M.
> 
> --
> Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list