Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-05-04 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 02:44:28PM -0400, Don Zickus wrote: > RAS doesn't go through the legacy ports (ie get_nmi_reason()). Instead it > triggers the external NMI through a different bit (ioapic I think). Well, I see it getting registered with __register_nmi_handler() which adds it to the

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-05-04 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 02:44:28PM -0400, Don Zickus wrote: RAS doesn't go through the legacy ports (ie get_nmi_reason()). Instead it triggers the external NMI through a different bit (ioapic I think). Well, I see it getting registered with __register_nmi_handler() which adds it to the

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-05-01 Thread Zheng, Lv
Hi, > From: Borislav Petkov [mailto:b...@alien8.de] > Sent: Thursday, April 30, 2015 4:49 PM > > On Thu, Apr 30, 2015 at 08:05:12AM +, Zheng, Lv wrote: > > Are there any such data around the SC and LL (MIPS)? > > What, you can't search the internet yourself? I mean if LL can do what you

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-05-01 Thread Zheng, Lv
Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Thursday, April 30, 2015 4:49 PM On Thu, Apr 30, 2015 at 08:05:12AM +, Zheng, Lv wrote: Are there any such data around the SC and LL (MIPS)? What, you can't search the internet yourself? I mean if LL can do what you exactly

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-30 Thread Borislav Petkov
On Thu, Apr 30, 2015 at 08:05:12AM +, Zheng, Lv wrote: > Are there any such data around the SC and LL (MIPS)? What, you can't search the internet yourself? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-30 Thread Zheng, Lv
Hi, > From: Borislav Petkov [mailto:b...@alien8.de] > Sent: Wednesday, April 29, 2015 4:14 PM > Subject: Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader > > On Wed, Apr 29, 2015 at 12:49:59AM +, Zheng, Lv wrote: > > > > We absolutely want to use ato

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-30 Thread Zheng, Lv
Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Wednesday, April 29, 2015 4:14 PM Subject: Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader On Wed, Apr 29, 2015 at 12:49:59AM +, Zheng, Lv wrote: We absolutely want to use atomic_add_unless() because we get

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-30 Thread Borislav Petkov
On Thu, Apr 30, 2015 at 08:05:12AM +, Zheng, Lv wrote: Are there any such data around the SC and LL (MIPS)? What, you can't search the internet yourself? -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-29 Thread Borislav Petkov
On Wed, Apr 29, 2015 at 12:49:59AM +, Zheng, Lv wrote: > > > We absolutely want to use atomic_add_unless() because we get to save us > > > the expensive > > > > > > LOCK; CMPXCHG > > > > > > if the value was already 1. Which is exactly what this patch is trying > > > to avoid - a thundering

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-29 Thread Borislav Petkov
On Wed, Apr 29, 2015 at 12:49:59AM +, Zheng, Lv wrote: We absolutely want to use atomic_add_unless() because we get to save us the expensive LOCK; CMPXCHG if the value was already 1. Which is exactly what this patch is trying to avoid - a thundering herd of cores

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Zheng, Lv
Hi, > From: Zheng, Lv > Sent: Wednesday, April 29, 2015 8:25 AM > Subject: RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader > > Hi, > > > From: Borislav Petkov [mailto:b...@alien8.de] > > Sent: Tuesday, April 28, 2015 9:59 PM > > Subject

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Zheng, Lv
Hi, > From: Borislav Petkov [mailto:b...@alien8.de] > Sent: Tuesday, April 28, 2015 9:59 PM > Subject: Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader > > On Tue, Apr 28, 2015 at 01:38:41PM +, Zheng, Lv wrote: > > > - raw_spin_lock(_nmi_lock); > &

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Tue, Apr 28, 2015 at 06:22:29PM +0200, Borislav Petkov wrote: > On Tue, Apr 28, 2015 at 11:35:21AM -0400, Don Zickus wrote: > > Your solution seems much simpler. :-) > > ... and I love simpler :-) > > > I followed up in another email stating I mis-spoke. I forgot this still > > uses the

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 11:35:21AM -0400, Don Zickus wrote: > Your solution seems much simpler. :-) ... and I love simpler :-) > I followed up in another email stating I mis-spoke. I forgot this still > uses the NMI_LOCAL shared NMI. So every perf NMI, will also call the GHES > handler to make

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Tue, Apr 28, 2015 at 04:55:48PM +0200, Borislav Petkov wrote: > On Tue, Apr 28, 2015 at 10:30:09AM -0400, Don Zickus wrote: > > On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: > > > On Fri, 27 Mar 2015, Borislav Petkov wrote: > > > > > > > From: Jiri Kosina > > > > > > > > Since

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 10:30:09AM -0400, Don Zickus wrote: > On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: > > On Fri, 27 Mar 2015, Borislav Petkov wrote: > > > > > From: Jiri Kosina > > > > > > Since GHES sources are global, we theoretically need only a single CPU > > > reading

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Tue, Apr 28, 2015 at 10:30:09AM -0400, Don Zickus wrote: > On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: > > On Fri, 27 Mar 2015, Borislav Petkov wrote: > > > > > From: Jiri Kosina > > > > > > Since GHES sources are global, we theoretically need only a single CPU > > > reading

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: > On Fri, 27 Mar 2015, Borislav Petkov wrote: > > > From: Jiri Kosina > > > > 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 > >

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 01:38:41PM +, Zheng, Lv wrote: > > - raw_spin_lock(_nmi_lock); > > + if (!atomic_add_unless(_in_nmi, 1, 1)) > > + return ret; > > + > > if (atomic_cmpxchg(_in_nmi, 0, 1)) > return ret; Ok, now I understand what you mean. We absolutely want to use

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Zheng, Lv
Hi, I was talking about this patch. > From: Borislav Petkov [mailto:b...@alien8.de] > Sent: Friday, March 27, 2015 5:23 PM > Subject: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader > > From: Jiri Kosina > > Since GHES sources are global, we theoretically need only a single CPU >

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 02:24:16AM +, Zheng, Lv wrote: > > > #APP > > > # 177 "./arch/x86/include/asm/atomic.h" 1 > > > .pushsection .smp_locks,"a" > > > .balign 4 > > > .long 671f - . > > > .popsection > > > 671: > > > lock; cmpxchgl %edx,ghes_in_nmi(%rip) # D.37056, MEM[(volatile u32

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Tue, Apr 28, 2015 at 10:30:09AM -0400, Don Zickus wrote: On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: On Fri, 27 Mar 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz Since GHES sources are global, we theoretically need only a single CPU reading

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 01:38:41PM +, Zheng, Lv wrote: - raw_spin_lock(ghes_nmi_lock); + if (!atomic_add_unless(ghes_in_nmi, 1, 1)) + return ret; + if (atomic_cmpxchg(ghes_in_nmi, 0, 1)) return ret; Ok, now I understand what you mean. We absolutely want to use

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: On Fri, 27 Mar 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz 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

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Zheng, Lv
Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Tuesday, April 28, 2015 9:59 PM Subject: Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader On Tue, Apr 28, 2015 at 01:38:41PM +, Zheng, Lv wrote: - raw_spin_lock(ghes_nmi_lock); + if (!atomic_add_unless

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Zheng, Lv
Hi, From: Zheng, Lv Sent: Wednesday, April 29, 2015 8:25 AM Subject: RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Tuesday, April 28, 2015 9:59 PM Subject: Re: [RFC PATCH 5/5] GHES: Make NMI handler have

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Zheng, Lv
Hi, I was talking about this patch. From: Borislav Petkov [mailto:b...@alien8.de] Sent: Friday, March 27, 2015 5:23 PM Subject: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader From: Jiri Kosina jkos...@suse.cz Since GHES sources are global, we theoretically need only a

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 10:30:09AM -0400, Don Zickus wrote: On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: On Fri, 27 Mar 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz Since GHES sources are global, we theoretically need only a single CPU reading

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Tue, Apr 28, 2015 at 04:55:48PM +0200, Borislav Petkov wrote: On Tue, Apr 28, 2015 at 10:30:09AM -0400, Don Zickus wrote: On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: On Fri, 27 Mar 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz Since GHES

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 11:35:21AM -0400, Don Zickus wrote: Your solution seems much simpler. :-) ... and I love simpler :-) I followed up in another email stating I mis-spoke. I forgot this still uses the NMI_LOCAL shared NMI. So every perf NMI, will also call the GHES handler to make

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Borislav Petkov
On Tue, Apr 28, 2015 at 02:24:16AM +, Zheng, Lv wrote: #APP # 177 ./arch/x86/include/asm/atomic.h 1 .pushsection .smp_locks,a .balign 4 .long 671f - . .popsection 671: lock; cmpxchgl %edx,ghes_in_nmi(%rip) # D.37056, MEM[(volatile u32 *)ghes_in_nmi] # 0 2

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-28 Thread Don Zickus
On Tue, Apr 28, 2015 at 06:22:29PM +0200, Borislav Petkov wrote: On Tue, Apr 28, 2015 at 11:35:21AM -0400, Don Zickus wrote: Your solution seems much simpler. :-) ... and I love simpler :-) I followed up in another email stating I mis-spoke. I forgot this still uses the NMI_LOCAL

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Zheng, Lv
Hi, > From: Zheng, Lv > Sent: Tuesday, April 28, 2015 8:44 AM > > Hi, > > > From: Borislav Petkov [mailto:b...@alien8.de] > > Sent: Monday, April 27, 2015 4:47 PM > > > > On Mon, Apr 27, 2015 at 03:16:00AM +, Zheng, Lv wrote: > > > > @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Zheng, Lv
Hi, > From: Borislav Petkov [mailto:b...@alien8.de] > Sent: Monday, April 27, 2015 4:47 PM > > On Mon, Apr 27, 2015 at 03:16:00AM +, Zheng, Lv wrote: > > > @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct > > > pt_regs *regs) > > > struct ghes *ghes; > > > int

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Borislav Petkov
On Thu, Apr 23, 2015 at 06:00:15PM +, Luck, Tony wrote: > > I think we should apply this. > > > > Here's why: nothing in the ghes_notify_nmi() handler does CPU-specific > > accesses > > This looks to be true. > > > Tony, objections? > > No objections. Thanks, queued for 4.2, pending one

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Borislav Petkov
On Mon, Apr 27, 2015 at 03:16:00AM +, Zheng, Lv wrote: > > @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct > > pt_regs *regs) > > struct ghes *ghes; > > int sev, ret = NMI_DONE; > > > > - raw_spin_lock(_nmi_lock); > > + if (!atomic_add_unless(_in_nmi, 1,

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Borislav Petkov
On Thu, Apr 23, 2015 at 06:00:15PM +, Luck, Tony wrote: I think we should apply this. Here's why: nothing in the ghes_notify_nmi() handler does CPU-specific accesses This looks to be true. Tony, objections? No objections. Thanks, queued for 4.2, pending one last test I'm

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Borislav Petkov
On Mon, Apr 27, 2015 at 03:16:00AM +, Zheng, Lv wrote: @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) struct ghes *ghes; int sev, ret = NMI_DONE; - raw_spin_lock(ghes_nmi_lock); + if (!atomic_add_unless(ghes_in_nmi, 1, 1)) +

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Zheng, Lv
Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Monday, April 27, 2015 4:47 PM On Mon, Apr 27, 2015 at 03:16:00AM +, Zheng, Lv wrote: @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) struct ghes *ghes; int sev, ret =

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-27 Thread Zheng, Lv
Hi, From: Zheng, Lv Sent: Tuesday, April 28, 2015 8:44 AM Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Monday, April 27, 2015 4:47 PM On Mon, Apr 27, 2015 at 03:16:00AM +, Zheng, Lv wrote: @@ -840,7 +840,9 @@ static int ghes_notify_nmi(unsigned int cmd, struct

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-26 Thread Zheng, Lv
Hi, > From: Borislav Petkov [mailto:b...@alien8.de] > Sent: Friday, March 27, 2015 5:23 PM > > From: Jiri Kosina > > 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

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-26 Thread Zheng, Lv
Hi, From: Borislav Petkov [mailto:b...@alien8.de] Sent: Friday, March 27, 2015 5:23 PM From: Jiri Kosina jkos...@suse.cz 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

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-23 Thread Luck, Tony
> I think we should apply this. > > Here's why: nothing in the ghes_notify_nmi() handler does CPU-specific > accesses This looks to be true. > Tony, objections? No objections. -Tony N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z�

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-23 Thread Borislav Petkov
On Thu, Apr 23, 2015 at 10:39:58AM +0200, Jiri Kosina wrote: > Three weeks have passed, therefore I find this an appropriate time for a > friendly ping :) > > Rafael? Naoya? Huang? > > This fixes a contention spinlock problem in NMI observed on a real HW, so > it would be really nice to have

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-23 Thread Jiri Kosina
On Wed, 1 Apr 2015, Borislav Petkov wrote: > > > From: Jiri Kosina > > > > > > 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. > > > > I

RE: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-23 Thread Luck, Tony
I think we should apply this. Here's why: nothing in the ghes_notify_nmi() handler does CPU-specific accesses This looks to be true. Tony, objections? No objections. -Tony N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z�

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-23 Thread Borislav Petkov
On Thu, Apr 23, 2015 at 10:39:58AM +0200, Jiri Kosina wrote: Three weeks have passed, therefore I find this an appropriate time for a friendly ping :) Rafael? Naoya? Huang? This fixes a contention spinlock problem in NMI observed on a real HW, so it would be really nice to have it

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-23 Thread Jiri Kosina
On Wed, 1 Apr 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz 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. I

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-01 Thread Borislav Petkov
On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: > On Fri, 27 Mar 2015, Borislav Petkov wrote: > > > From: Jiri Kosina > > > > 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 > >

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-01 Thread Jiri Kosina
On Fri, 27 Mar 2015, Borislav Petkov wrote: > From: Jiri Kosina > > 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. I originally wasn't 100% sure

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-01 Thread Jiri Kosina
On Fri, 27 Mar 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz 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. I originally wasn't 100%

Re: [RFC PATCH 5/5] GHES: Make NMI handler have a single reader

2015-04-01 Thread Borislav Petkov
On Wed, Apr 01, 2015 at 09:45:53AM +0200, Jiri Kosina wrote: On Fri, 27 Mar 2015, Borislav Petkov wrote: From: Jiri Kosina jkos...@suse.cz 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