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


Groups > linux.kernel > #1514567 > unrolled thread

[PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state

Started bySebastian Andrzej Siewior <bigeasy@linutronix.de>
First post2016-11-03 16:00 +0100
Last post2016-11-07 18:30 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-03 16:00 +0100
    Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the  ONLINE state Borislav Petkov <bp@alien8.de> - 2016-11-07 11:40 +0100
      Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the  ONLINE state Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-07 11:50 +0100
        Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the  ONLINE state Borislav Petkov <bp@alien8.de> - 2016-11-07 13:40 +0100
          Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the  ONLINE state Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-07 18:30 +0100

#1514567 — [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-11-03 16:00 +0100
Subject[PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state
Message-ID<szrEO-5cN-11@gated-at.bofh.it>
If we try a CPU down and fail in the middle then we roll back to the
online state. This  means we would perform CPU_ONLINE()
without invoking CPU_DEAD() for the cleanup of what was allocated in
CPU_ONLINE.
Be prepared for this and don't allocate the struct if we have it
already.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: linux-edac@vger.kernel.org
Cc: x86@kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/cpu/mcheck/mce.c     | 4 ++++
 arch/x86/kernel/cpu/mcheck/mce_amd.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index a7fdf453d895..e9ffd6d9e32d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2409,6 +2409,10 @@ static int mce_device_create(unsigned int cpu)
 	if (!mce_available(&boot_cpu_data))
 		return -EIO;
 
+	dev = per_cpu(mce_device, cpu);
+	if (dev)
+		return 0;
+
 	dev = kzalloc(sizeof *dev, GFP_KERNEL);
 	if (!dev)
 		return -ENOMEM;
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 55cd018bc1ae..3e529fd747f8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -1097,6 +1097,9 @@ static int threshold_create_device(unsigned int cpu)
 	struct threshold_bank **bp;
 	int err = 0;
 
+	bp = per_cpu(threshold_banks, cpu);
+	if (bp)
+		return 0;
 	bp = kzalloc(sizeof(struct threshold_bank *) * mca_cfg.banks,
 		     GFP_KERNEL);
 	if (!bp)
-- 
2.10.2

[toc] | [next] | [standalone]


#1515990 — Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state

FromBorislav Petkov <bp@alien8.de>
Date2016-11-07 11:40 +0100
SubjectRe: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state
Message-ID<sAPvj-1Se-13@gated-at.bofh.it>
In reply to#1514567
On Thu, Nov 03, 2016 at 03:50:16PM +0100, Sebastian Andrzej Siewior wrote:
> If we try a CPU down and fail in the middle then we roll back to the
> online state. This  means we would perform CPU_ONLINE()
> without invoking CPU_DEAD() for the cleanup of what was allocated in

Are CPU_ONLINE() and CPU_DEAD() functions? Those are the states, right?

> CPU_ONLINE.
> Be prepared for this and don't allocate the struct if we have it
> already.
> 
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: linux-edac@vger.kernel.org
> Cc: x86@kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86/kernel/cpu/mcheck/mce.c     | 4 ++++
>  arch/x86/kernel/cpu/mcheck/mce_amd.c | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index a7fdf453d895..e9ffd6d9e32d 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -2409,6 +2409,10 @@ static int mce_device_create(unsigned int cpu)
>  	if (!mce_available(&boot_cpu_data))
>  		return -EIO;
>  
> +	dev = per_cpu(mce_device, cpu);
> +	if (dev)
> +		return 0;
> +
>  	dev = kzalloc(sizeof *dev, GFP_KERNEL);
>  	if (!dev)
>  		return -ENOMEM;
> diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> index 55cd018bc1ae..3e529fd747f8 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> @@ -1097,6 +1097,9 @@ static int threshold_create_device(unsigned int cpu)
>  	struct threshold_bank **bp;
>  	int err = 0;
>  
> +	bp = per_cpu(threshold_banks, cpu);
> +	if (bp)
> +		return 0;

<--- newline here.

>  	bp = kzalloc(sizeof(struct threshold_bank *) * mca_cfg.banks,
>  		     GFP_KERNEL);
>  	if (!bp)
> -- 
> 2.10.2
> 
> 

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

[toc] | [prev] | [next] | [standalone]


#1515997 — Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-11-07 11:50 +0100
SubjectRe: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state
Message-ID<sAPEZ-1Vz-11@gated-at.bofh.it>
In reply to#1515990
On 2016-11-07 11:32:19 [+0100], Borislav Petkov wrote:
> On Thu, Nov 03, 2016 at 03:50:16PM +0100, Sebastian Andrzej Siewior wrote:
> > If we try a CPU down and fail in the middle then we roll back to the
> > online state. This  means we would perform CPU_ONLINE()
> > without invoking CPU_DEAD() for the cleanup of what was allocated in
> 
> Are CPU_ONLINE() and CPU_DEAD() functions? Those are the states, right?

those are states. I meant here the driver specific function invoked in
those states.

> > index 55cd018bc1ae..3e529fd747f8 100644
> > --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
> > +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> > @@ -1097,6 +1097,9 @@ static int threshold_create_device(unsigned int cpu)
> >  	struct threshold_bank **bp;
> >  	int err = 0;
> >  
> > +	bp = per_cpu(threshold_banks, cpu);
> > +	if (bp)
> > +		return 0;
> 
> <--- newline here.

okay.

Sebastian

[toc] | [prev] | [next] | [standalone]


#1516069 — Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state

FromBorislav Petkov <bp@alien8.de>
Date2016-11-07 13:40 +0100
SubjectRe: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state
Message-ID<sARnr-376-9@gated-at.bofh.it>
In reply to#1515997
On Mon, Nov 07, 2016 at 11:40:55AM +0100, Sebastian Andrzej Siewior wrote:
> On 2016-11-07 11:32:19 [+0100], Borislav Petkov wrote:
> > On Thu, Nov 03, 2016 at 03:50:16PM +0100, Sebastian Andrzej Siewior wrote:
> > > If we try a CPU down and fail in the middle then we roll back to the
> > > online state. This  means we would perform CPU_ONLINE()
> > > without invoking CPU_DEAD() for the cleanup of what was allocated in
> > 
> > Are CPU_ONLINE() and CPU_DEAD() functions? Those are the states, right?
> 
> those are states. I meant here the driver specific function invoked in
> those states.

Yeah, so say that please - slapping "()" after the state name doesn't
make it clear.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

[toc] | [prev] | [next] | [standalone]


#1516361 — Re: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state

FromSebastian Andrzej Siewior <bigeasy@linutronix.de>
Date2016-11-07 18:30 +0100
SubjectRe: [PATCH 20/25] x86/mcheck: Be prepared for a rollback back to the ONLINE state
Message-ID<sAVU5-6hX-25@gated-at.bofh.it>
In reply to#1516069
On 2016-11-07 13:31:29 [+0100], Borislav Petkov wrote:
> Yeah, so say that please - slapping "()" after the state name doesn't
> make it clear.

Updated.

Sebastian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web