diff options
author | Jiri Kosina <jkosina@suse.cz> | 2015-03-27 05:05:00 -0400 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2015-04-27 15:35:33 -0400 |
commit | 6fe9e7c26a97105645fd24f264f1b94e21aade3e (patch) | |
tree | a636b710834338a34af1dbc932afa1ced659e03a /drivers/acpi/apei | |
parent | 2383844d4850888cfdf6d202563d2ddb4125a4e9 (diff) |
GHES: Make NMI handler have a single reader
Since GHES sources are global, we theoretically need only a single CPU
reading them per NMI instead of a thundering herd of CPUs waiting on a
spinlock in NMI context for no reason at all.
Do that.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/acpi/apei')
-rw-r--r-- | drivers/acpi/apei/ghes.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 94a44bad5576..2bfd53cbfe80 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
@@ -729,10 +729,10 @@ static struct llist_head ghes_estatus_llist; | |||
729 | static struct irq_work ghes_proc_irq_work; | 729 | static struct irq_work ghes_proc_irq_work; |
730 | 730 | ||
731 | /* | 731 | /* |
732 | * NMI may be triggered on any CPU, so ghes_nmi_lock is used for | 732 | * NMI may be triggered on any CPU, so ghes_in_nmi is used for |
733 | * mutual exclusion. | 733 | * having only one concurrent reader. |
734 | */ | 734 | */ |
735 | static DEFINE_RAW_SPINLOCK(ghes_nmi_lock); | 735 | static atomic_t ghes_in_nmi = ATOMIC_INIT(0); |
736 | 736 | ||
737 | static LIST_HEAD(ghes_nmi); | 737 | static LIST_HEAD(ghes_nmi); |
738 | 738 | ||
@@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) | |||
840 | struct ghes *ghes; | 840 | struct ghes *ghes; |
841 | int sev, ret = NMI_DONE; | 841 | int sev, ret = NMI_DONE; |
842 | 842 | ||
843 | raw_spin_lock(&ghes_nmi_lock); | 843 | if (!atomic_add_unless(&ghes_in_nmi, 1, 1)) |
844 | return ret; | ||
845 | |||
844 | list_for_each_entry_rcu(ghes, &ghes_nmi, list) { | 846 | list_for_each_entry_rcu(ghes, &ghes_nmi, list) { |
845 | if (ghes_read_estatus(ghes, 1)) { | 847 | if (ghes_read_estatus(ghes, 1)) { |
846 | ghes_clear_estatus(ghes); | 848 | ghes_clear_estatus(ghes); |
@@ -863,7 +865,7 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) | |||
863 | #ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG | 865 | #ifdef CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG |
864 | irq_work_queue(&ghes_proc_irq_work); | 866 | irq_work_queue(&ghes_proc_irq_work); |
865 | #endif | 867 | #endif |
866 | raw_spin_unlock(&ghes_nmi_lock); | 868 | atomic_dec(&ghes_in_nmi); |
867 | return ret; | 869 | return ret; |
868 | } | 870 | } |
869 | 871 | ||