Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anisa Su" <anisa.su887@gmail.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2 3/4] cxl/events: Bound the per-log Get Event Records loop
Date: Tue, 01 Sep 2026 00:43:46 +0000	[thread overview]
Message-ID: <20260901004346.A8F9C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901002912.958-4-anisa.su@samsung.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Returning -EIO after capping the event log passes causes an infinite IRQ storm rather than letting the caller give up on the log.
--

commit f19a605d6e7399b93479014db2d4bf98656f2614
Author: Anisa Su <anisa.su887@gmail.com>

cxl/events: Bound the per-log Get Event Records loop

This commit bounds the cxl_mem_get_records_log() loop to prevent a misbehaving
device from permanently stalling the event thread. It introduces a 128-pass cap,
returning an error if the cap is reached, and yields the CPU via cond_resched()
between passes.

> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 7c6c5b7450a54..5e49589727d59 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
[ ... ]
> @@ -1109,34 +1137,72 @@ static void cxl_mem_get_records_log(struct cxl_memdev_state *mds,
>  				type, rc);
>  			break;
>  		}
> +
> +		if (++passes == CXL_EVENT_LOG_MAX_PASSES) {
> +			dev_warn_ratelimited(dev,
> +				"Event log '%d': Still reporting records after %d passes, giving up",
> +				type, passes);
> +			rc = -EIO;
> +			break;
> +		}
> +		cond_resched();
>  	} while (nr_rec);

[Severity: High]
Does returning -EIO here cause an infinite interrupt storm rather than letting
the caller give up on the log?

When the 128-pass cap is reached, cxl_mem_get_records_log() returns -EIO. This
propagates to cxl_event_thread(), which breaks out of its event reading loop
and returns IRQ_HANDLED.

Because the event log is not empty, the device will immediately fire another
MSI. Since the thread returned IRQ_HANDLED, the kernel's spurious interrupt
detector won't disable the interrupt line. This wakes up cxl_event_thread()
again, which performs another 128 passes and exits, repeating endlessly.

Should the interrupt be persistently disabled or the log masked when we give
up on reading it?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260901002912.958-1-anisa.su@samsung.com?part=3

  reply	other threads:[~2026-09-01  0:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  0:26 [PATCH v2 0/4] cxl/events: Robustify event interrupt handling Anisa Su
2026-09-01  0:26 ` [PATCH v2 1/4] cxl/events: Bound get records loop in cxl_event_thread() Anisa Su
2026-09-01  0:41   ` sashiko-bot
2026-09-01 11:48   ` Li Ming
2026-09-01 17:59     ` Anisa Su
2026-09-01 19:17   ` Cheatham, Benjamin
2026-09-01  0:26 ` [PATCH v2 2/4] cxl/events: Validate the record count reported by the device Anisa Su
2026-09-01 19:19   ` Cheatham, Benjamin
2026-09-01  0:26 ` [PATCH v2 3/4] cxl/events: Bound the per-log Get Event Records loop Anisa Su
2026-09-01  0:43   ` sashiko-bot [this message]
2026-09-01 19:19   ` Cheatham, Benjamin
2026-09-01  0:26 ` [PATCH v2 4/4] cxl/events: Return IRQ_NONE when no events were processed Anisa Su
2026-09-01  0:38   ` sashiko-bot
2026-09-01 19:19   ` Cheatham, Benjamin
2026-09-02  8:27 ` [PATCH v2 0/4] cxl/events: Robustify event interrupt handling Anisa Su
2026-09-02 19:06   ` Davidlohr Bueso

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=20260901004346.A8F9C1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anisa.su887@gmail.com \
    --cc=linux-cxl@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox