[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MdHMiqhcpd2rFwjfKvwMWtTeTxG4fK+7zbzgSq9MHmGew@mail.gmail.com>
Date: Fri, 26 May 2023 15:01:01 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Chris Packham <chris.packham@...iedtelesis.co.nz>,
linus.walleij@...aro.org, johan@...nel.org, maz@...nel.org,
warthog618@...il.com, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] gpiolib: Avoid side effects in gpio_is_visible()
On Fri, May 19, 2023 at 12:09 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Fri, May 19, 2023 at 8:07 AM Chris Packham
> <chris.packham@...iedtelesis.co.nz> wrote:
> >
> > On a system with pca9555 GPIOs that have been exported via sysfs the
> > following warning could be triggered on kexec().
> >
> > WARNING: CPU: 0 PID: 265 at drivers/gpio/gpiolib.c:3411 gpiochip_disable_irq
> > Call trace:
> > gpiochip_disable_irq
> > machine_crash_shutdown
> > __crash_kexec
> > panic
> > sysrq_reset_seq_param_set
> > __handle_sysrq
> > write_sysrq_trigger
> >
> > The warning is triggered because there is an irq_desc for the GPIO but
> > it does not have the FLAG_USED_AS_IRQ set. This is because when the GPIO
> > is exported via gpiod_export(), gpio_is_visible() is used to determine
> > if the "edge" attribute should be provided but in doing so it ends up
> > calling gpiochip_to_irq() which creates the irq_desc.
> >
> > Remove the call to gpiod_to_irq() from gpio_is_visible(). The actual
> > intended creation of the irq_desc comes via edge_store() when requested
> > by the user.
>
> To me it still sounds like a hack and the real solution should be done
> differently/elsewhere.
>
> Also I'm worrying that not having this file visible or not may affect
> existing user space custom scripts we will never hear about.
>
> P.S. TBH, I don't care much about sysfs, so if this patch finds its
> way upstream, I won't be unhappy.
>
Same. Which is why - if there'll be no more objections, I will apply it.
Bart
Powered by blists - more mailing lists