Re: [PATCH] Revert "uio: use threaded interrupts"
From: Chris Packham
Date: Thu Nov 05 2026 - 22:57:27 EST
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@xxxxxxxxxxxxxxxxxxx/
> https://github.com/torvalds/linux/commit/f8a27dfa4b82d442af1c0645a5acc70cc97c67f6
>
> Signed-off-by: Michael Schanne <mschanne@xxxxxxx>
Acked-by: Chris Packham <chris.packham@xxxxxxxxxxxxxxxxxxx>
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.