mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq/matrix: Update availability for offline managed IRQ changes
@ 2026-10-25 16:40 Avi Weiss
  0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-10-25 16:40 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Radu Rendec, linux-kernel, Avi Weiss

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-25 16:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 16:40 [PATCH] genirq/matrix: Update availability for offline managed IRQ changes Avi Weiss

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®