* [PATCH] Revert "uio: use threaded interrupts"
@ 2026-11-05 23:22 Mike Schanne
2026-11-06 3:57 ` Chris Packham
2026-11-06 10:41 ` 'Sebastian Andrzej Siewior'
0 siblings, 2 replies; 3+ messages in thread
From: Mike Schanne @ 2026-11-05 23:22 UTC (permalink / raw)
To: 'gregkh@linuxfoundation.org'
Cc: 'LKML', 'linux-rt-devel@lists.linux.dev',
'linux-rt-users', 'Sebastian Andrzej Siewior',
'Thomas Gleixner', 'Steven Rostedt',
'chris.packham@alliedtelesis.co.nz',
Todd Leitzel
This reverts commit f8a27dfa4b82d442af1c0645a5acc70cc97c67f6.
The original solution breaks the threadirqs case including PREEMPT_RT
Under PREEMPT_RT, it adds an extra kthread per UIO irq,
which adds a context switch per interrupt.
See:
https://lore.kernel.org/all/20240326195927.3265297-1-chris.packham@alliedtelesis.co.nz/
https://github.com/torvalds/linux/commit/f8a27dfa4b82d442af1c0645a5acc70cc97c67f6
Signed-off-by: Michael Schanne <mschanne@kns.com>
---
drivers/uio/uio.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index f8fa20522660..9ef5b276b090 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -442,30 +442,21 @@ EXPORT_SYMBOL_GPL(uio_event_notify);
* @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer
* @dev_id: Pointer to the devices uio_device structure
*/
-static irqreturn_t uio_interrupt_handler(int irq, void *dev_id)
+static irqreturn_t uio_interrupt(int irq, void *dev_id)
{
struct uio_device *idev = (struct uio_device *)dev_id;
irqreturn_t ret;
ret = idev->info->handler(irq, idev->info);
if (ret == IRQ_HANDLED)
- ret = IRQ_WAKE_THREAD;
-
- return ret;
-}
-
/**
* uio_interrupt_thread - irq thread handler
* @irq: IRQ number
* @dev_id: Pointer to the devices uio_device structure
*/
-static irqreturn_t uio_interrupt_thread(int irq, void *dev_id)
-{
- struct uio_device *idev = (struct uio_device *)dev_id;
+ uio_event_notify(idev->info);
- uio_event_notify(idev->info);
-
- return IRQ_HANDLED;
+ return ret;
}
struct uio_listener {
@@ -1044,8 +1035,8 @@ int __uio_register_device(struct module *owner,
* FDs at the time of unregister and therefore may not be
* freed until they are released.
*/
- ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread,
- info->irq_flags, info->name, idev);
+ ret = request_irq(info->irq, uio_interrupt,
+ info->irq_flags, info->name, idev);
if (ret) {
info->uio_dev = NULL;
goto err_request_irq;
--
2.53.0
This email is non-binding, is subject to contract, and neither Kulicke and Soffa Industries, Inc. nor its subsidiaries (each and collectively “K&S”) shall have any obligation to you to consummate the transactions herein or to enter into any agreement, other than in accordance with the terms and conditions of a definitive agreement if and when negotiated, finalized and executed between the parties. This email and all its contents are protected by International and United States copyright laws. Any reproduction or use of all or any part of this email without the express written consent of K&S is prohibited.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "uio: use threaded interrupts"
2026-11-05 23:22 [PATCH] Revert "uio: use threaded interrupts" Mike Schanne
@ 2026-11-06 3:57 ` Chris Packham
2026-11-06 10:41 ` 'Sebastian Andrzej Siewior'
1 sibling, 0 replies; 3+ messages in thread
From: Chris Packham @ 2026-11-06 3:57 UTC (permalink / raw)
To: Mike Schanne, 'gregkh@linuxfoundation.org'
Cc: 'LKML', 'linux-rt-devel@lists.linux.dev',
'linux-rt-users', 'Sebastian Andrzej Siewior',
'Thomas Gleixner', 'Steven Rostedt',
Todd Leitzel
Hi Mike,
On 06/11/2026 12:22, Mike Schanne wrote:
> This reverts commit f8a27dfa4b82d442af1c0645a5acc70cc97c67f6.
>
> The original solution breaks the threadirqs case including PREEMPT_RT
> Under PREEMPT_RT, it adds an extra kthread per UIO irq,
> which adds a context switch per interrupt.
>
> See:
> https://lore.kernel.org/all/20240326195927.3265297-1-chris.packham@alliedtelesis.co.nz/
> https://github.com/torvalds/linux/commit/f8a27dfa4b82d442af1c0645a5acc70cc97c67f6
>
> Signed-off-by: Michael Schanne <mschanne@kns.com>
Acked-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
I'll have to dig out the board that had the original problem and look
for a different fix.
> ---
> drivers/uio/uio.c | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> index f8fa20522660..9ef5b276b090 100644
> --- a/drivers/uio/uio.c
> +++ b/drivers/uio/uio.c
> @@ -442,30 +442,21 @@ EXPORT_SYMBOL_GPL(uio_event_notify);
> * @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer
> * @dev_id: Pointer to the devices uio_device structure
> */
> -static irqreturn_t uio_interrupt_handler(int irq, void *dev_id)
> +static irqreturn_t uio_interrupt(int irq, void *dev_id)
> {
> struct uio_device *idev = (struct uio_device *)dev_id;
> irqreturn_t ret;
>
> ret = idev->info->handler(irq, idev->info);
> if (ret == IRQ_HANDLED)
> - ret = IRQ_WAKE_THREAD;
> -
> - return ret;
> -}
> -
> /**
> * uio_interrupt_thread - irq thread handler
> * @irq: IRQ number
> * @dev_id: Pointer to the devices uio_device structure
> */
> -static irqreturn_t uio_interrupt_thread(int irq, void *dev_id)
> -{
> - struct uio_device *idev = (struct uio_device *)dev_id;
> + uio_event_notify(idev->info);
>
> - uio_event_notify(idev->info);
> -
> - return IRQ_HANDLED;
> + return ret;
> }
>
> struct uio_listener {
> @@ -1044,8 +1035,8 @@ int __uio_register_device(struct module *owner,
> * FDs at the time of unregister and therefore may not be
> * freed until they are released.
> */
> - ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread,
> - info->irq_flags, info->name, idev);
> + ret = request_irq(info->irq, uio_interrupt,
> + info->irq_flags, info->name, idev);
> if (ret) {
> info->uio_dev = NULL;
> goto err_request_irq;
> --
> 2.53.0
>
> This email is non-binding, is subject to contract, and neither Kulicke and Soffa Industries, Inc. nor its subsidiaries (each and collectively “K&S”) shall have any obligation to you to consummate the transactions herein or to enter into any agreement, other than in accordance with the terms and conditions of a definitive agreement if and when negotiated, finalized and executed between the parties. This email and all its contents are protected by International and United States copyright laws. Any reproduction or use of all or any part of this email without the express written consent of K&S is prohibited.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Revert "uio: use threaded interrupts"
2026-11-05 23:22 [PATCH] Revert "uio: use threaded interrupts" Mike Schanne
2026-11-06 3:57 ` Chris Packham
@ 2026-11-06 10:41 ` 'Sebastian Andrzej Siewior'
1 sibling, 0 replies; 3+ messages in thread
From: 'Sebastian Andrzej Siewior' @ 2026-11-06 10:41 UTC (permalink / raw)
To: Mike Schanne
Cc: 'gregkh@linuxfoundation.org', 'LKML',
'linux-rt-devel@lists.linux.dev',
'linux-rt-users', 'Thomas Gleixner',
'Steven Rostedt',
'chris.packham@alliedtelesis.co.nz',
Todd Leitzel
On 2026-11-05 23:22:17 [+0000], Mike Schanne wrote:
> This reverts commit f8a27dfa4b82d442af1c0645a5acc70cc97c67f6.
>
> The original solution breaks the threadirqs case including PREEMPT_RT
> Under PREEMPT_RT, it adds an extra kthread per UIO irq,
> which adds a context switch per interrupt.
You need to explain a bit more. I did bring a few items why the patch
was bad and a revert is in order. Let me try this as a commit message:
This reverts commit f8a27dfa4b82d442af1c0645a5acc70cc97c67f6.
The patch claims to fix the issue with nested interrupts by using
request_threaded_irq(). Should an IRQ be nested then __setup_irq() will
overwrite the primary handler and the submitted uio_interrupt_handler()
will not be called (only the threaded handler).
On non-nested interrupts, both handler are installed and work
properly. In forced threaded environments, such as PREEMPT_RT, it
results in two threads adding additional overhead.
Therefore revert the change.
What do you think?
> See:
> https://lore.kernel.org/all/20240326195927.3265297-1-chris.packham@alliedtelesis.co.nz/
> https://github.com/torvalds/linux/commit/f8a27dfa4b82d442af1c0645a5acc70cc97c67f6
The commit can be looked by everyone with a git tree. So the two links
aren't needed. I think a
Fixes: f8a27dfa4b82d ("uio: use threaded interrupts")
would be in order.
> Signed-off-by: Michael Schanne <mschanne@kns.com>
> ---
Here, in this space, could please add a revision history of the patch to
the initial posting, and this v2? Something like
v1: https://lore.kernel.org/all/TY0PR0101MB48676D503A7F6C5CAC112B3BD2A52@TY0PR0101MB4867.apcprd01.prod.exchangelabs.com/
- Instead of an ifdef revert the cited commit.
> drivers/uio/uio.c | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
>
Sebastian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-06 10:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 23:22 [PATCH] Revert "uio: use threaded interrupts" Mike Schanne
2026-11-06 3:57 ` Chris Packham
2026-11-06 10:41 ` 'Sebastian Andrzej Siewior'
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®