Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shaikh Kamaluddin" <shaikhkamal2012@gmail.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH] cxl/events: Return IRQ_NONE when no event is pending
Date: Sun, 06 Sep 2026 16:09:00 +0000	[thread overview]
Message-ID: <20260906160901.49F851F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260906155705.13252-1-shaikhkamal2012@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The `cxl_event_thread` can enter an infinite loop on device surprise removal or mailbox hardware failure, hanging the CPU and permanently masking a shared IRQ line.
--

commit f6cda8d59c7a077a8328222a63290241e9b118c0
Author: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>
cxl/events: Return IRQ_NONE when no event is pending

This commit tracks whether at least one supported event status bit was observed
during interrupt handling. It returns IRQ_NONE when there was no event to
service, allowing the shared interrupt handler to behave correctly.

> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index c7c91e8dc51dc..8b560cae91f2e 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -515,6 +515,7 @@ static irqreturn_t cxl_event_thread(int irq, void *id)

[ ... ]

>  		status &= CXLDEV_EVENT_STATUS_ALL;
>  		if (!status)
>  			break;
> +
> +		handled = true;
>  		cxl_mem_get_event_records(mds, status);
>  		cond_resched();
>  	} while (status);

[Severity: High]
This is a pre-existing issue, but can cxl_event_thread() get stuck in an
infinite loop here?

If a CXL device undergoes a surprise removal or a mailbox failure,
cxl_mem_get_records_log() can abort early without clearing the hardware
event status:

drivers/cxl/core/mbox.c:cxl_mem_get_records_log() {
    ...
		if (rc) {
			dev_err_ratelimited(dev,
				"Event log '%d': Failed to query event records : %d",
				type, rc);
			break;
		}
    ...
}

Because the local status variable evaluated in the while condition remains
non-zero, the loop will restart. If the memory-mapped read at the top of the
loop then returns 0xFFFFFFFF or the stuck status, the loop will spin endlessly,
permanently masking the shared interrupt line.

Should we add a mechanism to break out of this loop or track whether the
hardware status is actively being cleared?

>  
> -	return IRQ_HANDLED;
> +	return handled ? IRQ_HANDLED : IRQ_NONE;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260906155705.13252-1-shaikhkamal2012@gmail.com?part=1

  reply	other threads:[~2026-09-06 16:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06 15:57 [PATCH] cxl/events: Return IRQ_NONE when no event is pending Shaikh Kamaluddin
2026-09-06 16:09 ` sashiko-bot [this message]
2026-09-07 18:44   ` Jonathan Cameron
2026-09-07 18:48 ` Jonathan Cameron
2026-09-09  2:08   ` Li Ming
2026-09-09 19:11     ` Jonathan Cameron
2026-09-09 16:13   ` Shaikh Kamaluddin
2026-09-08 18:22 ` Anisa Su
2026-09-09 16:55   ` Shaikh Kamaluddin
2026-09-09 18:43     ` Anisa Su
2026-09-10 16:22       ` Shaikh Kamaluddin

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=20260906160901.49F851F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shaikhkamal2012@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox