linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pingfan Liu <kernelfans@gmail.com>
To: x86@kernel.org
Cc: Pingfan Liu <kernelfans@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	Marc Zyngier <maz@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/9] x86/irq: place for_each_active_irq() in rcu read section
Date: Wed, 20 Apr 2022 22:05:17 +0800	[thread overview]
Message-ID: <20220420140521.45361-6-kernelfans@gmail.com> (raw)
In-Reply-To: <20220420140521.45361-1-kernelfans@gmail.com>

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@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Marc Zyngier <maz@kernel.org>
Cc: linux-kernel@vger.kernel.org
To: x86@kernel.org
---
 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


  parent reply	other threads:[~2022-04-20 14:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 14:05 [PATCH 0/9] trival fix or improvement about irq_desc access Pingfan Liu
2022-04-20 14:05 ` [PATCH 1/9] irq/irqdesc: put the lock at the exact place in irq_sysfs_init() Pingfan Liu
2022-04-20 14:05 ` [PATCH 2/9] irq/irqdesc: change the name of delete_irq_desc() to irq_delete_desc() Pingfan Liu
2022-04-20 14:05 ` [PATCH 3/9] irq/manage: remove some unreferenced code Pingfan Liu
2022-04-20 20:56   ` Miguel Ojeda
2022-04-20 14:05 ` [PATCH 4/9] s390/irq: utilize RCU instead of irq_lock_sparse() in show_msi_interrupt() Pingfan Liu
2022-04-20 18:16   ` Heiko Carstens
2022-04-21  3:36     ` Pingfan Liu
2022-04-21 11:42       ` Heiko Carstens
2022-04-22  9:56         ` Pingfan Liu
2022-04-22 10:02   ` [PATCHv2] " Pingfan Liu
2022-04-25 11:39     ` Heiko Carstens
2022-04-20 14:05 ` Pingfan Liu [this message]
2022-04-20 14:05 ` [PATCH 6/9] pm/irq: make for_each_irq_desc() safe of irq_desc release Pingfan Liu
2022-04-20 16:23   ` Rafael J. Wysocki
2022-04-21  3:31     ` Pingfan Liu
2022-04-21 10:57       ` Rafael J. Wysocki
2022-04-22 10:43         ` Pingfan Liu
2022-04-27  6:03   ` [PATCHv2] genirq/PM: Make " Pingfan Liu
2022-04-20 14:05 ` [PATCH 7/9] irq: remove needless lock in takedown_cpu() Pingfan Liu
2022-04-21 16:11   ` Thomas Gleixner
2022-04-25  2:57     ` Pingfan Liu
2022-04-25  9:43       ` Thomas Gleixner
2022-04-27  6:01         ` Pingfan Liu
2022-04-20 14:05 ` [PATCH 8/9] irq: make irq_lock_sparse() independent of CONFIG_SPARSE_IRQ Pingfan Liu
2022-04-20 14:05 ` [PATCH 9/9] irq/irqdesc: rename sparse_irq_lock to bitmap_lock Pingfan Liu

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=20220420140521.45361-6-kernelfans@gmail.com \
    --to=kernelfans@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).