All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 6/7] Input: gscps2 - serialize concurrent interrupt handlers
Date: Sun, 30 Aug 2026 21:07:19 +0000	[thread overview]
Message-ID: <20260830210719.DE8091F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260830-gscps2-v1-6-c733d4cae7f9@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Returning IRQ_NONE on lock contention in a shared hardware interrupt handler fails to clear the hardware interrupt, causing a spurious interrupt storm that permanently disables the IRQ line.
--

commit f58a76b080709bfb3ea6255a5211466eb9b5af11
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: gscps2 - serialize concurrent interrupt handlers

This commit serializes executions of gscps2_interrupt() using a new
gscps2_interrupt_lock. It uses a trylock and returns IRQ_NONE when the lock
cannot be acquired to prevent overlapping executions and avoid recursive
deadlocks.

> diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
> index 907fb1537595c..2afd53a163ffa 100644
> --- a/drivers/input/serio/gscps2.c
> +++ b/drivers/input/serio/gscps2.c

[ ... ]

> @@ -305,21 +307,31 @@ static irqreturn_t gscps2_interrupt(int irq, void *dev)
>  {
>  	struct gscps2port *ps2port;
>  	bool handled = false;
> +	bool more_data;
> +
> +	ACQUIRE(spinlock_irqsave_try, lock)(&gscps2_interrupt_lock);
> +	if (ACQUIRE_ERR(spinlock_irqsave_try, &lock))
> +		return IRQ_NONE;

[Severity: High]
Does returning IRQ_NONE on lock contention here fail to clear the hardware
interrupt, causing a spurious interrupt storm?

If CPU A calls gscps2_interrupt() manually (e.g., from gscps2_open()) and
acquires the lock:

CPU A
gscps2_interrupt()
    ACQUIRE(spinlock_irqsave_try, lock)(&gscps2_interrupt_lock); // succeeds

And concurrently, new data arrives causing a hardware interrupt on CPU B:

CPU B (Hardware Interrupt)
gscps2_interrupt()
    ACQUIRE(spinlock_irqsave_try, lock)(&gscps2_interrupt_lock); // fails
    return IRQ_NONE;

Because the interrupt is level-triggered and the source was not cleared, won't
the interrupt controller immediately re-assert the IRQ on CPU B as soon as the
handler returns?

This could trap CPU B in a tight interrupt storm loop. If CPU A takes
significant time in serio_interrupt() (e.g., due to input subsystem lock
contention or console writes), could the storm exceed the kernel's unhandled
interrupt threshold and permanently disable the shared IRQ line?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260830-gscps2-v1-0-c733d4cae7f9@gmail.com?part=6

  reply	other threads:[~2026-08-30 21:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30 20:52 [PATCH 0/7] Input: gscps2: cleanups and locking fixes Dmitry Torokhov
2026-08-30 20:52 ` [PATCH 1/7] Input: gscps2 - clean up driver code style and structure Dmitry Torokhov
2026-08-30 21:04   ` sashiko-bot
2026-08-30 20:52 ` [PATCH 2/7] Input: gscps2 - use RCU for ps2port_list and manage it in open/close Dmitry Torokhov
2026-08-30 20:52 ` [PATCH 3/7] Input: gscps2 - protect buffer access in read and report helpers Dmitry Torokhov
2026-08-30 21:05   ` sashiko-bot
2026-08-30 20:52 ` [PATCH 4/7] Input: gscps2 - serialize hardware and buffer access in gscps2_flush() Dmitry Torokhov
2026-08-30 21:02   ` sashiko-bot
2026-08-30 20:52 ` [PATCH 5/7] Input: gscps2 - return IRQ_NONE when interrupt is not handled Dmitry Torokhov
2026-08-30 21:05   ` sashiko-bot
2026-08-30 20:52 ` [PATCH 6/7] Input: gscps2 - serialize concurrent interrupt handlers Dmitry Torokhov
2026-08-30 21:07   ` sashiko-bot [this message]
2026-08-30 20:52 ` [PATCH 7/7] Input: gscps2 - drop busy-wait and manual interrupt pump on transmit Dmitry Torokhov
2026-08-30 21:05   ` sashiko-bot

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=20260830210719.DE8091F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.