Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752220AbdHPSn5 (ORCPT ); Wed, 16 Aug 2017 14:43:57 -0400 Received: from terminus.zytor.com ([65.50.211.136]:50521 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635AbdHPSn4 (ORCPT ); Wed, 16 Aug 2017 14:43:56 -0400 Date: Wed, 16 Aug 2017 11:42:43 -0700 From: tip-bot for Scott Wood Message-ID: Cc: hpa@zytor.com, swood@redhat.com, linux-kernel@vger.kernel.org, dzickus@redhat.com, mingo@kernel.org, tglx@linutronix.de Reply-To: tglx@linutronix.de, mingo@kernel.org, dzickus@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, swood@redhat.com In-Reply-To: <20170724213242.27598-1-swood@redhat.com> References: <20170724213242.27598-1-swood@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/spinlocks] x86/nmi: Use raw lock Git-Commit-ID: c455fd9235b6bd2802db86109cfa0ec105992f68 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2949 Lines: 94 Commit-ID: c455fd9235b6bd2802db86109cfa0ec105992f68 Gitweb: http://git.kernel.org/tip/c455fd9235b6bd2802db86109cfa0ec105992f68 Author: Scott Wood AuthorDate: Mon, 24 Jul 2017 16:32:42 -0500 Committer: Thomas Gleixner CommitDate: Wed, 16 Aug 2017 20:40:09 +0200 x86/nmi: Use raw lock register_nmi_handler() can be called from PREEMPT_RT atomic context (e.g. wakeup_cpu_via_init_nmi() or native_stop_other_cpus()), and thus ordinary spinlocks cannot be used. Signed-off-by: Scott Wood Signed-off-by: Thomas Gleixner Acked-by: Don Zickus Link: http://lkml.kernel.org/r/20170724213242.27598-1-swood@redhat.com --- arch/x86/kernel/nmi.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c index 446c8aa..35aafc9 100644 --- a/arch/x86/kernel/nmi.c +++ b/arch/x86/kernel/nmi.c @@ -39,26 +39,26 @@ #include struct nmi_desc { - spinlock_t lock; + raw_spinlock_t lock; struct list_head head; }; static struct nmi_desc nmi_desc[NMI_MAX] = { { - .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[0].lock), + .lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[0].lock), .head = LIST_HEAD_INIT(nmi_desc[0].head), }, { - .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock), + .lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock), .head = LIST_HEAD_INIT(nmi_desc[1].head), }, { - .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[2].lock), + .lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[2].lock), .head = LIST_HEAD_INIT(nmi_desc[2].head), }, { - .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[3].lock), + .lock = __RAW_SPIN_LOCK_UNLOCKED(&nmi_desc[3].lock), .head = LIST_HEAD_INIT(nmi_desc[3].head), }, @@ -163,7 +163,7 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action) init_irq_work(&action->irq_work, nmi_max_handler); - spin_lock_irqsave(&desc->lock, flags); + raw_spin_lock_irqsave(&desc->lock, flags); /* * Indicate if there are multiple registrations on the @@ -181,7 +181,7 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action) else list_add_tail_rcu(&action->list, &desc->head); - spin_unlock_irqrestore(&desc->lock, flags); + raw_spin_unlock_irqrestore(&desc->lock, flags); return 0; } EXPORT_SYMBOL(__register_nmi_handler); @@ -192,7 +192,7 @@ void unregister_nmi_handler(unsigned int type, const char *name) struct nmiaction *n; unsigned long flags; - spin_lock_irqsave(&desc->lock, flags); + raw_spin_lock_irqsave(&desc->lock, flags); list_for_each_entry_rcu(n, &desc->head, list) { /* @@ -207,7 +207,7 @@ void unregister_nmi_handler(unsigned int type, const char *name) } } - spin_unlock_irqrestore(&desc->lock, flags); + raw_spin_unlock_irqrestore(&desc->lock, flags); synchronize_rcu(); } EXPORT_SYMBOL_GPL(unregister_nmi_handler);