Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1178295

[tip:x86/urgent] x86/irq: Retrieve irq data after locking irq_desc

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From tip-bot for Thomas Gleixner <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:x86/urgent] x86/irq: Retrieve irq data after locking irq_desc
Date Tue, 07 Jul 2015 12:00:02 +0200
Message-ID <pJxPs-41F-17@gated-at.bofh.it> (permalink)
References <pIVKa-5x7-23@gated-at.bofh.it>
X-Original-To linux-tip-commits@vger.kernel.org
Reply-To yanmin_zhang@linux.intel.com, bp@suse.de, linux-kernel@vger.kernel.org, jroedel@suse.de, jin.xiao@intel.com, mingo@kernel.org, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de
Git-Commit-ID 09cf92b784fae6109450c5d64f9908066d605249
X-Mailer tip-git-log-daemon
Robot-ID <tip-bot.git.kernel.org>
Robot-Unsubscribe Contact <mailto:hpa@kernel.org> to get blacklisted from these emails
MIME-Version 1.0
Content-Transfer-Encoding 8bit
Content-Type text/plain; charset=UTF-8
Content-Disposition inline
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 59
Organization linux.* mail to news gateway
X-Original-Cc bp@suse.de, linux-kernel@vger.kernel.org, yanmin_zhang@linux.intel.com, peterz@infradead.org, mingo@kernel.org, jroedel@suse.de, jin.xiao@intel.com, tglx@linutronix.de, hpa@zytor.com
X-Original-Date Tue, 7 Jul 2015 02:58:14 -0700
X-Original-Message-ID <tip-09cf92b784fae6109450c5d64f9908066d605249@git.kernel.org>
X-Original-References <20150705171102.331320612@linutronix.de>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1178295

Show key headers only | View raw


Commit-ID:  09cf92b784fae6109450c5d64f9908066d605249
Gitweb:     http://git.kernel.org/tip/09cf92b784fae6109450c5d64f9908066d605249
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sun, 5 Jul 2015 17:12:35 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 7 Jul 2015 11:54:04 +0200

x86/irq: Retrieve irq data after locking irq_desc

irq_data is protected by irq_desc->lock, so retrieving the irq chip
from irq_data outside the lock is racy vs. an concurrent update. Move
it into the lock held region.

While at it add a comment why the vector walk does not require
vector_lock.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: xiao jin <jin.xiao@intel.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Yanmin Zhang <yanmin_zhang@linux.intel.com>
Link: http://lkml.kernel.org/r/20150705171102.331320612@linutronix.de
---
 arch/x86/kernel/irq.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 85ca76e..c7dfe1b 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -497,6 +497,11 @@ void fixup_irqs(void)
 	 */
 	mdelay(1);
 
+	/*
+	 * We can walk the vector array of this cpu without holding
+	 * vector_lock because the cpu is already marked !online, so
+	 * nothing else will touch it.
+	 */
 	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
 		unsigned int irr;
 
@@ -508,9 +513,9 @@ void fixup_irqs(void)
 			irq = __this_cpu_read(vector_irq[vector]);
 
 			desc = irq_to_desc(irq);
+			raw_spin_lock(&desc->lock);
 			data = irq_desc_get_irq_data(desc);
 			chip = irq_data_get_irq_chip(data);
-			raw_spin_lock(&desc->lock);
 			if (chip->irq_retrigger) {
 				chip->irq_retrigger(data);
 				__this_cpu_write(vector_irq[vector], VECTOR_RETRIGGERED);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[tip:x86/urgent] x86/irq:   Retrieve irq data after locking irq_desc tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2015-07-07 12:00 +0200

csiph-web