Re: [PATCH v2 5/6] gpiolib: switch the line state notifier to atomic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 14, 2024 at 11:32:24AM +0200, Bartosz Golaszewski wrote:
> On Mon, Oct 14, 2024 at 11:30 AM Kent Gibson <warthog618@xxxxxxxxx> wrote:
> >
> > On Mon, Oct 14, 2024 at 11:27:05AM +0200, Bartosz Golaszewski wrote:
> > > On Mon, Oct 14, 2024 at 11:24 AM Kent Gibson <warthog618@xxxxxxxxx> wrote:
> > > >
> > > > On Mon, Oct 14, 2024 at 09:48:16AM +0200, Bartosz Golaszewski wrote:
> > > > > On Mon, Oct 14, 2024 at 4:11 AM Kent Gibson <warthog618@xxxxxxxxx> wrote:
> > > > > > >
> > > > > > > +     /*
> > > > > > > +      * This is called from atomic context (with a spinlock taken by the
> > > > > > > +      * atomic notifier chain). Any sleeping calls must be done outside of
> > > > > > > +      * this function in process context of the dedicated workqueue.
> > > > > > > +      *
> > > > > > > +      * Let's gather as much info as possible from the descriptor and
> > > > > > > +      * postpone just the call to pinctrl_gpio_can_use_line() until the work
> > > > > > > +      * is executed.
> > > > > > > +      */
> > > > > > > +
> > > > > >
> > > > > > Should be in patch 4?  You aren't otherwise changing that function here.
> > > > > >
> > > > >
> > > > > Until this patch, the comment isn't really true, so I figured it makes
> > > > > more sense here.
> > > > >
> > > >
> > > > So the validity of the comment depends on how the function is being called?
> > > > Then perhaps you should reword it as well.
> > > >
> > >
> > > The validity of the comment depends on the type of the notifier used.
> > > As long as it's a blocking notifier, it's called with a mutex taken -
> > > it's process context. When we switch to the atomic notifier, this
> > > function is now called with a spinlock taken, so it's considered
> > > atomic.
> > >
> >
> > Indeed - so the comment is brittle.
> >
>
> I'm not sure what you're saying. We know it's an atomic notifier, we
> assign this callback to the block and register by calling
> atomic_notifier_chain_register(). I fail to see why you consider it
> "brittle".
>


I realise that - I'm not sure how to rephrase.
The comment is describing changes in behaviour that were added in a previous
patch.  The comment should describe the change in behaviour there and in a
generic way that is independent of the notifier chain type.  Tying it to the
notifier chain type is what makes it brittle - if that is changed in the
future then the comment becomes confusing or invalid.

I'm not sure that adds anything to what I've already said.
It isn't a deal breaker - just seems like poor form to me.

Cheers,
Kent.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux