linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync
@ 2016-03-21 23:19 Davidlohr Bueso
  2016-03-23  8:30 ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: Davidlohr Bueso @ 2016-03-21 23:19 UTC (permalink / raw)
  To: bp, tony.luck, mingo; +Cc: linux-kernel, dave, Davidlohr Bueso

mce_start() has an explicit smp_wmb to serialize writes to
global_nwo and mce_callin. However, atomic_inc_return() implies
barriers on both sides of the call, as such simply rely on this
full smp barrier.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index f0c921b03e42..6b7039c166b8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -830,9 +830,9 @@ static int mce_start(int *no_way_out)
 
 	atomic_add(*no_way_out, &global_nwo);
 	/*
-	 * global_nwo should be updated before mce_callin
+	 * Rely on the implied barrier below, such that global_nwo
+	 * is updated before mce_callin.
 	 */
-	smp_wmb();
 	order = atomic_inc_return(&mce_callin);
 
 	/*
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync
  2016-03-21 23:19 [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync Davidlohr Bueso
@ 2016-03-23  8:30 ` Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2016-03-23  8:30 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: tony.luck, mingo, linux-kernel, Davidlohr Bueso

On Mon, Mar 21, 2016 at 04:19:56PM -0700, Davidlohr Bueso wrote:
> mce_start() has an explicit smp_wmb to serialize writes to
> global_nwo and mce_callin. However, atomic_inc_return() implies
> barriers on both sides of the call, as such simply rely on this
> full smp barrier.
> 
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
>  arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] x86/mce: Avoid using object after free in genpool.
@ 2016-03-23 16:14 Tony Luck
  2016-03-23 17:33 ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: Tony Luck @ 2016-03-23 16:14 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-kernel, Chen, Gong

When we loop over all queued machine check error records to pass
them to the registered notifiers we use llist_for_each_entry().
But the loop calls gen_pool_free() for the entry in the body of
the loop - and then the iterator looks at node->next after the
free.

Use llist_for_each_entry_safe() instead.

Cc: stable@vger.kernel.org
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-genpool.c b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
index 0a850100c594..2658e2af74ec 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
@@ -29,7 +29,7 @@ static char gen_pool_buf[MCE_POOLSZ];
 void mce_gen_pool_process(void)
 {
 	struct llist_node *head;
-	struct mce_evt_llist *node;
+	struct mce_evt_llist *node, *tmp;
 	struct mce *mce;
 
 	head = llist_del_all(&mce_event_llist);
@@ -37,7 +37,7 @@ void mce_gen_pool_process(void)
 		return;
 
 	head = llist_reverse_order(head);
-	llist_for_each_entry(node, head, llnode) {
+	llist_for_each_entry_safe(node, tmp, head, llnode) {
 		mce = &node->mce;
 		atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
 		gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] x86/mce: Avoid using object after free in genpool.
  2016-03-23 16:14 [PATCH] " Tony Luck
@ 2016-03-23 17:33 ` Borislav Petkov
  2016-03-23 20:47   ` Luck, Tony
  0 siblings, 1 reply; 12+ messages in thread
From: Borislav Petkov @ 2016-03-23 17:33 UTC (permalink / raw)
  To: Tony Luck; +Cc: linux-kernel, Chen, Gong

On Wed, Mar 23, 2016 at 09:14:40AM -0700, Tony Luck wrote:
> When we loop over all queued machine check error records to pass
> them to the registered notifiers we use llist_for_each_entry().
> But the loop calls gen_pool_free() for the entry in the body of
> the loop - and then the iterator looks at node->next after the
> free.
> 
> Use llist_for_each_entry_safe() instead.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
>  arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce-genpool.c b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
> index 0a850100c594..2658e2af74ec 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
> @@ -29,7 +29,7 @@ static char gen_pool_buf[MCE_POOLSZ];
>  void mce_gen_pool_process(void)
>  {
>  	struct llist_node *head;
> -	struct mce_evt_llist *node;
> +	struct mce_evt_llist *node, *tmp;
>  	struct mce *mce;
>  
>  	head = llist_del_all(&mce_event_llist);
> @@ -37,7 +37,7 @@ void mce_gen_pool_process(void)
>  		return;
>  
>  	head = llist_reverse_order(head);
> -	llist_for_each_entry(node, head, llnode) {
> +	llist_for_each_entry_safe(node, tmp, head, llnode) {
>  		mce = &node->mce;
>  		atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
>  		gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));
> -- 

Acked-by: Borislav Petkov <bp@suse.de>

I have a couple more RAS patches for tip, want me to pick that one up
too? I'm going to send my pile to tip guys after -rc1 is out.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] x86/mce: Avoid using object after free in genpool.
  2016-03-23 17:33 ` Borislav Petkov
@ 2016-03-23 20:47   ` Luck, Tony
  0 siblings, 0 replies; 12+ messages in thread
From: Luck, Tony @ 2016-03-23 20:47 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: linux-kernel, Chen, Gong

> Acked-by: Borislav Petkov <bp@suse.de>

Thanks

> I have a couple more RAS patches for tip, want me to pick that one up
> too? I'm going to send my pile to tip guys after -rc1 is out.

Yes please ... throw this one on the pile.

-Tony

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 0/3] x86/RAS: Some small things for tip
@ 2016-04-06  8:05 Borislav Petkov
  2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Borislav Petkov @ 2016-04-06  8:05 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

Hi,

just a couple of smallish fixes. Tony's is CC:stable so please queue
this into tip:x86/urgent.

Thanks.

Borislav Petkov (1):
  x86/RAS: Rename AMD MCE injectior config item

Davidlohr Bueso (1):
  x86/mce: Remove explicit smp_rmb() when starting CPUs sync

Tony Luck (1):
  x86/mce: Avoid using object after free in genpool

 arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
 arch/x86/kernel/cpu/mcheck/mce.c         | 4 ++--
 arch/x86/ras/Kconfig                     | 2 +-
 arch/x86/ras/Makefile                    | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.7.3

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item
  2016-04-06  8:05 [PATCH 0/3] x86/RAS: Some small things for tip Borislav Petkov
@ 2016-04-06  8:05 ` Borislav Petkov
  2016-04-13 11:35   ` [tip:ras/core] x86/RAS: Rename AMD MCE injector " tip-bot for Borislav Petkov
  2016-04-06  8:05 ` [PATCH 2/3] x86/mce: Remove explicit smp_rmb() when starting CPUs sync Borislav Petkov
  2016-04-06  8:05 ` [PATCH 3/3] x86/mce: Avoid using object after free in genpool Borislav Petkov
  2 siblings, 1 reply; 12+ messages in thread
From: Borislav Petkov @ 2016-04-06  8:05 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

... to be the same like the file name of injection module itself to
avoid confusion when grepping.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/ras/Kconfig  | 2 +-
 arch/x86/ras/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ras/Kconfig b/arch/x86/ras/Kconfig
index df280da34825..d957d5f21a86 100644
--- a/arch/x86/ras/Kconfig
+++ b/arch/x86/ras/Kconfig
@@ -1,4 +1,4 @@
-config AMD_MCE_INJ
+config MCE_AMD_INJ
 	tristate "Simple MCE injection interface for AMD processors"
 	depends on RAS && EDAC_DECODE_MCE && DEBUG_FS && AMD_NB
 	default n
diff --git a/arch/x86/ras/Makefile b/arch/x86/ras/Makefile
index dd2c98b84037..5f94546db280 100644
--- a/arch/x86/ras/Makefile
+++ b/arch/x86/ras/Makefile
@@ -1,2 +1,2 @@
-obj-$(CONFIG_AMD_MCE_INJ)		+= mce_amd_inj.o
+obj-$(CONFIG_MCE_AMD_INJ)		+= mce_amd_inj.o
 
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] x86/mce: Remove explicit smp_rmb() when starting CPUs sync
  2016-04-06  8:05 [PATCH 0/3] x86/RAS: Some small things for tip Borislav Petkov
  2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
@ 2016-04-06  8:05 ` Borislav Petkov
  2016-04-13 11:35   ` [tip:ras/core] " tip-bot for Davidlohr Bueso
  2016-04-06  8:05 ` [PATCH 3/3] x86/mce: Avoid using object after free in genpool Borislav Petkov
  2 siblings, 1 reply; 12+ messages in thread
From: Borislav Petkov @ 2016-04-06  8:05 UTC (permalink / raw)
  To: X86 ML
  Cc: LKML, H. Peter Anvin, Ingo Molnar, linux-edac, Thomas Gleixner,
	Tony Luck

From: Davidlohr Bueso <dave@stgolabs.net>

mce_start() has an explicit smp_wmb() to serialize writes to global_nwo
and mce_callin. However, atomic_inc_return() implies barriers on both
sides of the call, as such simply rely on this full SMP barrier.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/1458602396-840-1-git-send-email-dave@stgolabs.net
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index f0c921b03e42..6b7039c166b8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -830,9 +830,9 @@ static int mce_start(int *no_way_out)
 
 	atomic_add(*no_way_out, &global_nwo);
 	/*
-	 * global_nwo should be updated before mce_callin
+	 * Rely on the implied barrier below, such that global_nwo
+	 * is updated before mce_callin.
 	 */
-	smp_wmb();
 	order = atomic_inc_return(&mce_callin);
 
 	/*
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] x86/mce: Avoid using object after free in genpool
  2016-04-06  8:05 [PATCH 0/3] x86/RAS: Some small things for tip Borislav Petkov
  2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
  2016-04-06  8:05 ` [PATCH 2/3] x86/mce: Remove explicit smp_rmb() when starting CPUs sync Borislav Petkov
@ 2016-04-06  8:05 ` Borislav Petkov
  2016-04-13 11:35   ` [tip:ras/core] " tip-bot for Tony Luck
  2 siblings, 1 reply; 12+ messages in thread
From: Borislav Petkov @ 2016-04-06  8:05 UTC (permalink / raw)
  To: X86 ML
  Cc: LKML, stable, Gong Chen, H. Peter Anvin, Ingo Molnar, linux-edac,
	Thomas Gleixner, Tony Luck

From: Tony Luck <tony.luck@intel.com>

When we loop over all queued machine check error records to pass them
to the registered notifiers we use llist_for_each_entry(). But the loop
calls gen_pool_free() for the entry in the body of the loop - and then
the iterator looks at node->next after the free.

Use llist_for_each_entry_safe() instead.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Cc: <stable@vger.kernel.org>
Cc: Gong Chen <gong.chen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/0205920@agluck-desk.sc.intel.com
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-genpool.c b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
index 0a850100c594..2658e2af74ec 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
@@ -29,7 +29,7 @@ static char gen_pool_buf[MCE_POOLSZ];
 void mce_gen_pool_process(void)
 {
 	struct llist_node *head;
-	struct mce_evt_llist *node;
+	struct mce_evt_llist *node, *tmp;
 	struct mce *mce;
 
 	head = llist_del_all(&mce_event_llist);
@@ -37,7 +37,7 @@ void mce_gen_pool_process(void)
 		return;
 
 	head = llist_reverse_order(head);
-	llist_for_each_entry(node, head, llnode) {
+	llist_for_each_entry_safe(node, tmp, head, llnode) {
 		mce = &node->mce;
 		atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
 		gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:ras/core] x86/mce: Avoid using object after free in genpool
  2016-04-06  8:05 ` [PATCH 3/3] x86/mce: Avoid using object after free in genpool Borislav Petkov
@ 2016-04-13 11:35   ` tip-bot for Tony Luck
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Tony Luck @ 2016-04-13 11:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-edac, stable, tony.luck, gong.chen, tglx, linux-kernel,
	mingo, hpa, torvalds, bp, peterz

Commit-ID:  a3125494cff084b098c80bb36fbe2061ffed9d52
Gitweb:     http://git.kernel.org/tip/a3125494cff084b098c80bb36fbe2061ffed9d52
Author:     Tony Luck <tony.luck@intel.com>
AuthorDate: Wed, 6 Apr 2016 10:05:16 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 10:54:00 +0200

x86/mce: Avoid using object after free in genpool

When we loop over all queued machine check error records to pass them
to the registered notifiers we use llist_for_each_entry(). But the loop
calls gen_pool_free() for the entry in the body of the loop - and then
the iterator looks at node->next after the free.

Use llist_for_each_entry_safe() instead.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Cc: Gong Chen <gong.chen@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/0205920@agluck-desk.sc.intel.com
Link: http://lkml.kernel.org/r/1459929916-12852-4-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/mcheck/mce-genpool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-genpool.c b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
index 0a85010..2658e2a 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
@@ -29,7 +29,7 @@ static char gen_pool_buf[MCE_POOLSZ];
 void mce_gen_pool_process(void)
 {
 	struct llist_node *head;
-	struct mce_evt_llist *node;
+	struct mce_evt_llist *node, *tmp;
 	struct mce *mce;
 
 	head = llist_del_all(&mce_event_llist);
@@ -37,7 +37,7 @@ void mce_gen_pool_process(void)
 		return;
 
 	head = llist_reverse_order(head);
-	llist_for_each_entry(node, head, llnode) {
+	llist_for_each_entry_safe(node, tmp, head, llnode) {
 		mce = &node->mce;
 		atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
 		gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:ras/core] x86/RAS: Rename AMD MCE injector config item
  2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
@ 2016-04-13 11:35   ` tip-bot for Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Borislav Petkov @ 2016-04-13 11:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, mingo, tglx, peterz, tony.luck, bp, torvalds, linux-kernel

Commit-ID:  69385f8879344f4a1f078f761bd3523fcf697131
Gitweb:     http://git.kernel.org/tip/69385f8879344f4a1f078f761bd3523fcf697131
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Wed, 6 Apr 2016 10:05:14 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 10:54:23 +0200

x86/RAS: Rename AMD MCE injector config item

... to be the same like the file name of injection module itself to
avoid confusion when grepping.

No functionality change.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/1459929916-12852-2-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/ras/Kconfig  | 2 +-
 arch/x86/ras/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/ras/Kconfig b/arch/x86/ras/Kconfig
index df280da..d957d5f 100644
--- a/arch/x86/ras/Kconfig
+++ b/arch/x86/ras/Kconfig
@@ -1,4 +1,4 @@
-config AMD_MCE_INJ
+config MCE_AMD_INJ
 	tristate "Simple MCE injection interface for AMD processors"
 	depends on RAS && EDAC_DECODE_MCE && DEBUG_FS && AMD_NB
 	default n
diff --git a/arch/x86/ras/Makefile b/arch/x86/ras/Makefile
index dd2c98b..5f94546 100644
--- a/arch/x86/ras/Makefile
+++ b/arch/x86/ras/Makefile
@@ -1,2 +1,2 @@
-obj-$(CONFIG_AMD_MCE_INJ)		+= mce_amd_inj.o
+obj-$(CONFIG_MCE_AMD_INJ)		+= mce_amd_inj.o
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [tip:ras/core] x86/mce: Remove explicit smp_rmb() when starting CPUs sync
  2016-04-06  8:05 ` [PATCH 2/3] x86/mce: Remove explicit smp_rmb() when starting CPUs sync Borislav Petkov
@ 2016-04-13 11:35   ` tip-bot for Davidlohr Bueso
  0 siblings, 0 replies; 12+ messages in thread
From: tip-bot for Davidlohr Bueso @ 2016-04-13 11:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-edac, dbueso, mingo, tony.luck, hpa, linux-kernel,
	torvalds, bp, tglx, dave, peterz

Commit-ID:  bf92b1feb658f6a262daf3a87d790997a1dca0ff
Gitweb:     http://git.kernel.org/tip/bf92b1feb658f6a262daf3a87d790997a1dca0ff
Author:     Davidlohr Bueso <dave@stgolabs.net>
AuthorDate: Wed, 6 Apr 2016 10:05:15 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 10:54:23 +0200

x86/mce: Remove explicit smp_rmb() when starting CPUs sync

mce_start() has an explicit smp_wmb() to serialize writes to global_nwo
and mce_callin. However, atomic_inc_return() implies barriers on both
sides of the call, as such simply rely on this full SMP barrier.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/1458602396-840-1-git-send-email-dave@stgolabs.net
Link: http://lkml.kernel.org/r/1459929916-12852-3-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index f0c921b..6b7039c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -830,9 +830,9 @@ static int mce_start(int *no_way_out)
 
 	atomic_add(*no_way_out, &global_nwo);
 	/*
-	 * global_nwo should be updated before mce_callin
+	 * Rely on the implied barrier below, such that global_nwo
+	 * is updated before mce_callin.
 	 */
-	smp_wmb();
 	order = atomic_inc_return(&mce_callin);
 
 	/*

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-04-13 11:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06  8:05 [PATCH 0/3] x86/RAS: Some small things for tip Borislav Petkov
2016-04-06  8:05 ` [PATCH 1/3] x86/RAS: Rename AMD MCE injectior config item Borislav Petkov
2016-04-13 11:35   ` [tip:ras/core] x86/RAS: Rename AMD MCE injector " tip-bot for Borislav Petkov
2016-04-06  8:05 ` [PATCH 2/3] x86/mce: Remove explicit smp_rmb() when starting CPUs sync Borislav Petkov
2016-04-13 11:35   ` [tip:ras/core] " tip-bot for Davidlohr Bueso
2016-04-06  8:05 ` [PATCH 3/3] x86/mce: Avoid using object after free in genpool Borislav Petkov
2016-04-13 11:35   ` [tip:ras/core] " tip-bot for Tony Luck
  -- strict thread matches above, loose matches on Subject: below --
2016-03-23 16:14 [PATCH] " Tony Luck
2016-03-23 17:33 ` Borislav Petkov
2016-03-23 20:47   ` Luck, Tony
2016-03-21 23:19 [PATCH -tip] x86/mce: Use atomic_inc_return barrier when starting monad sync Davidlohr Bueso
2016-03-23  8:30 ` Borislav Petkov

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).