All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, johan@kernel.org,
	maz@kernel.org, warthog618@gmail.com, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] gpiolib: Avoid side effects in gpio_is_visible()
Date: Fri, 19 May 2023 13:08:50 +0300	[thread overview]
Message-ID: <CAHp75Vcd8Q+-XMyfg3Y_hv_AL00PGgqg0jo7Yd7TTC4GrxPOuQ@mail.gmail.com> (raw)
In-Reply-To: <20230519050702.3681791-1-chris.packham@alliedtelesis.co.nz>

On Fri, May 19, 2023 at 8:07 AM Chris Packham
<chris.packham@alliedtelesis.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.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2023-05-19 10:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  5:07 [PATCH v2] gpiolib: Avoid side effects in gpio_is_visible() Chris Packham
2023-05-19 10:08 ` Andy Shevchenko [this message]
2023-05-26 13:01   ` Bartosz Golaszewski
2023-05-26 13:23     ` Johan Hovold
2023-05-28 21:21       ` Chris Packham
2023-05-29  4:08         ` Chris Packham

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=CAHp75Vcd8Q+-XMyfg3Y_hv_AL00PGgqg0jo7Yd7TTC4GrxPOuQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=johan@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=warthog618@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.