Commit e0a195b5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-spinlocks-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 spinlock update from Ingo Molnar:
 "Convert an NMI lock to raw"

[ Clarification: it's not that the lock itself is NMI-safe, it's about
  NMI registration called from RT contexts  - Linus ]

* 'x86-spinlocks-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/nmi: Use raw lock
parents 0098410d c455fd92
...@@ -39,26 +39,26 @@ ...@@ -39,26 +39,26 @@
#include <trace/events/nmi.h> #include <trace/events/nmi.h>
struct nmi_desc { struct nmi_desc {
spinlock_t lock; raw_spinlock_t lock;
struct list_head head; struct list_head head;
}; };
static struct nmi_desc nmi_desc[NMI_MAX] = 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), .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), .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), .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), .head = LIST_HEAD_INIT(nmi_desc[3].head),
}, },
...@@ -163,7 +163,7 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action) ...@@ -163,7 +163,7 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action)
init_irq_work(&action->irq_work, nmi_max_handler); 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 * Indicate if there are multiple registrations on the
...@@ -181,7 +181,7 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action) ...@@ -181,7 +181,7 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action)
else else
list_add_tail_rcu(&action->list, &desc->head); list_add_tail_rcu(&action->list, &desc->head);
spin_unlock_irqrestore(&desc->lock, flags); raw_spin_unlock_irqrestore(&desc->lock, flags);
return 0; return 0;
} }
EXPORT_SYMBOL(__register_nmi_handler); EXPORT_SYMBOL(__register_nmi_handler);
...@@ -192,7 +192,7 @@ void unregister_nmi_handler(unsigned int type, const char *name) ...@@ -192,7 +192,7 @@ void unregister_nmi_handler(unsigned int type, const char *name)
struct nmiaction *n; struct nmiaction *n;
unsigned long flags; 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) { list_for_each_entry_rcu(n, &desc->head, list) {
/* /*
...@@ -207,7 +207,7 @@ void unregister_nmi_handler(unsigned int type, const char *name) ...@@ -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(); synchronize_rcu();
} }
EXPORT_SYMBOL_GPL(unregister_nmi_handler); EXPORT_SYMBOL_GPL(unregister_nmi_handler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment