From: Jonathan Cameron <jic23@kernel.org>
To: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Bert Karwatzki <spasswolf@web.de>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
Jiri Kosina <jikos@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [tip: irq/core] genirq: Warn about using IRQF_ONESHOT without a threaded handler
Date: Sat, 14 Feb 2026 15:00:42 +0000 [thread overview]
Message-ID: <20260214150042.51a14483@jic23-huawei> (raw)
In-Reply-To: <a69abd18ea5a30fdb32478183ad16d9aaacd73a3.camel@linux.intel.com>
On Sun, 08 Feb 2026 18:00:53 -0800
srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> On Sat, 2026-02-07 at 15:46 +0000, Jonathan Cameron wrote:
> > On Tue, 3 Feb 2026 15:58:56 +0100
> > Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:
> >
> > > On 2026-02-03 11:43:53 [+0100], Bert Karwatzki wrote:
> > > > Yes, this should call warn_no_thread() when the interrupt is
> > > > triggered, but
> > > > I don't know if these sensors are actually functional on my
> > > > laptop (I've never
> > > > tried to use them).
> > > >
> > > > So I installed libiio-utils from debian and this is the output
> > > > from
> > > > iio_info:
> > > …
> > > >
> > > > The iio:device* sensors all report 0 for the "offset value", so
> > > > these
> > > > sensors are maybe non-fuctional.
> > > >
> > > >
> > > > > What did I miss?
> > > >
> > > > I don't think you missed something, but the thread function being
> > > > NULL here
> > > > could a problem on devices where these sensors actually work. (Or
> > > > perhaps these sensors
> > > > need to be polled and the interrupts never trigger (?))
> > >
> > > I only found one handler where the thread handler was NULL and it
> > > returned WAKE_THREAD. So this _is_ broken.
> > > Was it one of the driver I mentioned? If so I suggest to fix those
> > > first. I have no idea how this should work…
> > Both the drivers that are called out in this discussion look to
> > be registering a triggered buffer, but are not using a trigger to
> > fill
> > it. So they should not be doing that in the first place.
>
> Replacing with devm_iio_kfifo_buffer_setup_ext() breaks user space on
> laptops as they expect current_trigger. This is not available for
> INDIO_BUFFER_SOFTWARE. Using INDIO_BUFFER_TRIGGERED doesn't help
> without poll function. Still breaks user space. This all works from
> Linux 3.1x in this mode.
Ah ok. So I wouldn't have gone in this direction in the first
place. Obviously I missed it at the time ;(
Given where we are we can't remove it without breaking backwards compatibility.
I thought we'd long ago taught userspace to handle devices with untriggered
buffers but as ever with ABI we can never assume that's universal (and maybe
not even common!) IIRC the reason untriggered buffers became common
was when device with hardware FIFOs came along and the trigger is still there
but never visible to software. Which is kind of similar to the cases you
are referring to I think.
>
> Sensors are powered off till user space writes to current_trigger which
> results in call to .set_trigger_state() via
> iio_trigger_attach_poll_func().
With hindsight I'm not sure why we'd do that rather than doing it in the
buffer enable, but we are stuck so that doesn't matter now.
>
> Here the hub is pushing data, not pulled to register a thread handler
> and read.
>
> So not sure what to add to thread handler other than dummy function.
Yes, let's do that but add a note to it saying that it should not
be copied into new drivers + can we throw a big warning print in the
dummy handler and stop proving a meaningless top half?
We have a few really annoying corner cases where a 'fake' current trigger
is used to switch between types of trigger. This is usually for wiring
up various in device signals rather than having software in the path.
Those would need a different rethink if we get a new one of those.
They aren't common.
Jonathan
>
>
> Thanks,
> Srinivas
>
> >
> > The right fix is either to not use those helpers at all and register
> > the kfifo directly (so none of the problem infrastructure is used) or
> > implement a proper trigger / buffer separation by having their
> > interrupt
> > handlers as the trigger then moving the data reading into the
> > pollfuncs.
> > At that point there would be a thread here to do that read and we'd
> > not have the bug.
> >
> > Jonathan
> >
> > >
> > > > Bert Karwatzki
> > >
> > > Sebastian
>
next prev parent reply other threads:[~2026-02-14 15:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 13:40 [PATCH] " Sebastian Andrzej Siewior
2026-01-12 17:46 ` Laurent Pinchart
2026-01-14 10:29 ` Stefan Klug
2026-01-13 8:58 ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2026-01-13 12:05 ` Sebastian Andrzej Siewior
2026-01-13 15:26 ` Thomas Gleixner
2026-02-02 23:27 ` Bert Karwatzki
2026-02-03 8:38 ` Sebastian Andrzej Siewior
2026-02-03 10:43 ` Bert Karwatzki
2026-02-03 14:58 ` Sebastian Andrzej Siewior
2026-02-07 15:46 ` Jonathan Cameron
2026-02-09 2:00 ` srinivas pandruvada
2026-02-14 15:00 ` Jonathan Cameron [this message]
2026-02-14 15:08 ` Jonathan Cameron
2026-02-03 17:29 ` srinivas pandruvada
2026-02-07 15:42 ` Jonathan Cameron
2026-03-01 23:17 ` David Lechner
2026-03-01 23:57 ` David Lechner
2026-03-01 22:45 ` David Lechner
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=20260214150042.51a14483@jic23-huawei \
--to=jic23@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=jikos@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=spasswolf@web.de \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tglx@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
all inboxes | Powered by JetHome®