linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Herve Codina <herve.codina@bootlin.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Saravana Kannan <saravanak@google.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v2 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal
Date: Wed, 28 Feb 2024 08:29:19 +0800	[thread overview]
Message-ID: <20240228002919.GA4381@rigel> (raw)
In-Reply-To: <CAMRc=MeSMTnPUYGyJir4fc=6=Gnw_MVP9wfEKMQ6Ck33FYCrRA@mail.gmail.com>

On Tue, Feb 27, 2024 at 08:31:33PM +0100, Bartosz Golaszewski wrote:
> On Tue, Feb 27, 2024 at 12:34 PM Herve Codina <herve.codina@bootlin.com> wrote:
> >
> > Hi,
> >
> > When a gpio chip device is removed while some related gpio are used by
> > the user-space (gpiomon for instance), the following warning can appear:
> >   remove_proc_entry: removing non-empty directory 'irq/233', leaking at least 'gpiomon'
> >   WARNING: CPU: 2 PID: 72 at fs/proc/generic.c:717 remove_proc_entry+0x190/0x19c
> >   ...
> >   Call trace:
> >     remove_proc_entry+0x190/0x19c
> >     unregister_irq_proc+0xd0/0x104
> >     free_desc+0x4c/0xc4
> >     irq_free_descs+0x6c/0x90
> >     irq_dispose_mapping+0x104/0x14c
> >     gpiochip_irqchip_remove+0xcc/0x1a4
> >     gpiochip_remove+0x48/0x100
> >   ...
> >
> > Indeed, even if the gpio removal is notified to the gpio-cdev, the
> > IRQ used is not released when it should be.
> >
> > This series calls the gpio removal notifier sooner in the removal
> > process in order to give a chance to a notifier function to release
> > the IRQ before releasing the IRQ mapping and adds the needed
> > operations to release the IRQ in the gpio cdev notifier function.
> >
> > Compared to the previous iteration:
> >   https://lore.kernel.org/linux-kernel/20240220111019.133697-1-herve.codina@bootlin.com/
> > this v2 series set gdev->chip to NULL before calling gcdev_unregister().
> >
> > Also, this v2 series was rebased on top of for-next branch of the GPIO
> > tree.
> >
> > Best regards,
> > Hervé Codina
> >
> > Changes v1 -> v2:
> >   - Patch 1
> >     Set gdev->chip to NULL before calling gcdev_unregister()
> >
> >   - Patch 2
> >     No changes
> >
> > Herve Codina (2):
> >   gpiolib: call gcdev_unregister() sooner in the removal operations
> >   gpiolib: cdev: release IRQs when the gpio chip device is removed
> >
> >  drivers/gpio/gpiolib-cdev.c | 33 ++++++++++++++++++++++-----------
> >  drivers/gpio/gpiolib.c      |  6 +++++-
> >  2 files changed, 27 insertions(+), 12 deletions(-)
> >
> > --
> > 2.43.0
> >
>
> Sorry but this is just papering over the real issue. I'd say NAK for
> now as I'd really prefer to get to the root of the problem and fix it
> for all GPIO interrupt users.
>
> Kent, Linus: what do you think?
>

Agreed - a broader solution makes sense to me.

Cheers,
Kent.

  reply	other threads:[~2024-02-28  0:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 11:34 [PATCH v2 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal Herve Codina
2024-02-27 11:34 ` [PATCH v2 1/2] gpiolib: call gcdev_unregister() sooner in the removal operations Herve Codina
2024-02-27 11:34 ` [PATCH v2 2/2] gpiolib: cdev: release IRQs when the gpio chip device is removed Herve Codina
2024-02-27 19:31 ` [PATCH v2 0/2] gpio-cdev: Release IRQ used by gpio-cdev on gpio chip removal Bartosz Golaszewski
2024-02-28  0:29   ` Kent Gibson [this message]
2024-02-29 14:09   ` Linus Walleij
2024-03-01  7:21     ` Bartosz Golaszewski
2024-03-01 20:15       ` Linus Walleij
2024-03-02  8:59         ` Bartosz Golaszewski
2024-03-03  8:48           ` Linus Walleij
2024-04-08 13:27       ` Herve Codina
2024-04-08 18:57         ` Bartosz Golaszewski
2024-09-23 13:05 ` Herve Codina

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=20240228002919.GA4381@rigel \
    --to=warthog618@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=herve.codina@bootlin.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=saravanak@google.com \
    --cc=thomas.petazzoni@bootlin.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;
as well as URLs for NNTP newsgroup(s).