From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 0/5] gpio: cdev: bail out of poll() if the device goes down
Date: Thu, 17 Aug 2023 15:37:02 +0800 [thread overview]
Message-ID: <ZN3OHqzT3grSdefP@sol> (raw)
In-Reply-To: <CAMRc=MfwK6_m0N4cZqkpMX0Rka4WnWmtKTjq-cwbTR5+sjw9vw@mail.gmail.com>
On Thu, Aug 17, 2023 at 09:27:37AM +0200, Bartosz Golaszewski wrote:
> On Thu, Aug 17, 2023 at 6:41 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > On Wed, Aug 16, 2023 at 11:41:06PM +0200, Linus Walleij wrote:
> > > On Wed, Aug 16, 2023 at 2:20 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > > >
> > > > Wake up all three wake queues (the one associated with the character
> > > > device file, the one for V1 line events and the V2 line request one)
> > > > when the underlying GPIO device is unregistered. This way we won't get
> > > > stuck in poll() after the chip is gone as user-space will be forced to
> > > > go back into a new system call and will see that gdev->chip is NULL.
> > > >
> > > > Bartosz Golaszewski (5):
> > > > gpio: cdev: ignore notifications other than line status changes
> > > > gpio: cdev: rename the notifier block and notify callback
> > > > gpio: cdev: wake up chardev poll() on device unbind
> > > > gpio: cdev: wake up linereq poll() on device unbind
> > > > gpio: cdev: wake up lineevent poll() on device unbind
> > >
> > > I see why this is needed and while the whole notification chain
> > > is a bit clunky I really cannot think about anything better so:
> > > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> > >
> >
> > The issue I have is with the repurposing/reuse of the existing notifier
> > block that sends line changed events to the chardev.
> > Correct me if I'm wrong, but now all line requests will receive those
> > events as well.
> > They have no business receiving those events, and it scales badly.
> >
> > My preference would be for a separate nb for the chip removal to keep
> > those two classes of events distinct.
> >
>
> I would normally agree if there was a risk of abuse of those
> notifications by drivers but this is all private to gpiolib. And line
> requests that receive line state notifications simply ignore them.
> This isn't a bottleneck codepath IMO so where's the issue? We would be
> using a second notifier head of 40 bytes to struct gpio_device for no
> reason.
>
Yeah, this is a space/time trade-off, and you've gone with space over
time. I would select time over space.
40 bytes per device is negligable, and there is never a case where the
line request wants to see a change event - it either relates to a
different request, or it was triggered by the request itself.
Is there an echo in here ;-)?
Cheers,
Kent.
next prev parent reply other threads:[~2023-08-17 7:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 12:20 [PATCH 0/5] gpio: cdev: bail out of poll() if the device goes down Bartosz Golaszewski
2023-08-16 12:20 ` [PATCH 1/5] gpio: cdev: ignore notifications other than line status changes Bartosz Golaszewski
2023-08-16 12:20 ` [PATCH 2/5] gpio: cdev: rename the notifier block and notify callback Bartosz Golaszewski
2023-08-16 12:20 ` [PATCH 3/5] gpio: cdev: wake up chardev poll() on device unbind Bartosz Golaszewski
2023-08-16 12:20 ` [PATCH 4/5] gpio: cdev: wake up linereq " Bartosz Golaszewski
2023-08-16 12:20 ` [PATCH 5/5] gpio: cdev: wake up lineevent " Bartosz Golaszewski
2023-08-17 9:12 ` kernel test robot
2023-08-16 21:41 ` [PATCH 0/5] gpio: cdev: bail out of poll() if the device goes down Linus Walleij
2023-08-17 4:41 ` Kent Gibson
2023-08-17 7:00 ` Linus Walleij
2023-08-17 7:27 ` Bartosz Golaszewski
2023-08-17 7:37 ` Kent Gibson [this message]
2023-08-17 7:41 ` Bartosz Golaszewski
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=ZN3OHqzT3grSdefP@sol \
--to=warthog618@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).