[PATCH 5/9] x86/irq: place for_each_active_irq() in rcu read section
From: Pingfan Liu
Date: Wed Apr 20 2022 - 10:06:10 EST
Since there are access to irq_desc, and no preemption is provided at the
involved, it requires rcu read lock to protect irq_desc.
Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: "Maciej W. Rozycki" <macro@xxxxxxxxxxx>
Cc: Marc Zyngier <maz@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
To: x86@xxxxxxxxxx
---
arch/x86/kernel/apic/io_apic.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index c1bb384935b0..4bb16edcbe4d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1333,6 +1333,7 @@ void __init print_IO_APICs(void)
print_IO_APIC(ioapic_idx);
printk(KERN_DEBUG "IRQ to pin mappings:\n");
+ rcu_read_lock();
for_each_active_irq(irq) {
struct irq_pin_list *entry;
struct irq_chip *chip;
@@ -1352,6 +1353,7 @@ void __init print_IO_APICs(void)
pr_cont("-> %d:%d", entry->apic, entry->pin);
pr_cont("\n");
}
+ rcu_read_unlock();
printk(KERN_INFO ".................................... done.\n");
}
@@ -2009,6 +2011,7 @@ static inline void init_IO_APIC_traps(void)
struct irq_cfg *cfg;
unsigned int irq;
+ /* The early boot stage is free of irq_desc release */
for_each_active_irq(irq) {
cfg = irq_cfg(irq);
if (IO_APIC_IRQ(irq) && cfg && !cfg->vector) {
--
2.31.1