mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>
Cc: Radu Rendec <radu@rendec.net>,
	linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] genirq/matrix: Update availability for offline managed IRQ changes
Date: Sun, 25 Oct 2026 18:40:46 +0200	[thread overview]
Message-ID: <20261025164045.2513933-2-thnkslprpt@gmail.com> (raw)

The IRQ matrix caches available vectors after a CPU's first online
transition. Managed IRQ reservations can be added or removed while
the CPU is offline, but irq_matrix_reserve_managed() and
irq_matrix_remove_managed() only update cm->available for online CPUs.

When the CPU comes back online, irq_matrix_online() adds the stale
count to m->global_available, causing vector availability to be
overestimated (or potentially underestimated).

Update cm->available whenever the CPU matrix has been initialized,
regardless of its online state. Continue updating global availability
only for online CPUs, leaving first-time initialization to account
for existing reservations.

Fixes: 651ca2c00405 ("genirq/matrix: Handle CPU offlining proper")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/irq/matrix.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c
index faafb43a4e611..5a6adf8844903 100644
--- a/kernel/irq/matrix.c
+++ b/kernel/irq/matrix.c
@@ -225,10 +225,10 @@ int irq_matrix_reserve_managed(struct irq_matrix *m, const struct cpumask *msk)
 		if (bit >= m->alloc_end)
 			goto cleanup;
 		cm->managed++;
-		if (cm->online) {
+		if (cm->initialized)
 			cm->available--;
+		if (cm->online)
 			m->global_available--;
-		}
 		trace_irq_matrix_reserve_managed(bit, cpu, m, cm);
 	}
 	return 0;
@@ -275,10 +275,10 @@ void irq_matrix_remove_managed(struct irq_matrix *m, const struct cpumask *msk)
 		clear_bit(bit, cm->managed_map);
 
 		cm->managed--;
-		if (cm->online) {
+		if (cm->initialized)
 			cm->available++;
+		if (cm->online)
 			m->global_available++;
-		}
 		trace_irq_matrix_remove_managed(bit, cpu, m, cm);
 	}
 }

base-commit: 21a7f44fd0765fcc5194130b28767786eba1d1e7
-- 
2.43.0


                 reply	other threads:[~2026-10-25 16:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261025164045.2513933-2-thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=radu@rendec.net \
    --cc=tglx@kernel.org \
    /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

all inboxes | Powered by JetHome®