Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-23 Thread Thomas Gleixner
On Sat, 23 Jun 2018, Fenghua Yu wrote: > On Sun, Jun 24, 2018 at 02:55:08AM +0200, Thomas Gleixner wrote: > > On Sat, 23 Jun 2018, Fenghua Yu wrote: > > > On Sat, Jun 23, 2018 at 11:17:03AM +0200, Thomas Gleixner wrote: > > > > On Fri, 22 Jun 2018, Fenghua Yu wrote: > > It's not treated as failure

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-23 Thread Fenghua Yu
On Sun, Jun 24, 2018 at 02:55:08AM +0200, Thomas Gleixner wrote: > On Sat, 23 Jun 2018, Fenghua Yu wrote: > > On Sat, Jun 23, 2018 at 11:17:03AM +0200, Thomas Gleixner wrote: > > > On Fri, 22 Jun 2018, Fenghua Yu wrote: > It's not treated as failure. The firmware simply does not have an handler > f

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-23 Thread Thomas Gleixner
On Sat, 23 Jun 2018, Fenghua Yu wrote: > On Sat, Jun 23, 2018 at 11:17:03AM +0200, Thomas Gleixner wrote: > > On Fri, 22 Jun 2018, Fenghua Yu wrote: > > > Should I add kernel parameter or control knob to opt-out the feature? > > > > A simple command line option 'acoff' or something more sensible s

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-23 Thread Fenghua Yu
On Sat, Jun 23, 2018 at 11:17:03AM +0200, Thomas Gleixner wrote: > On Fri, 22 Jun 2018, Fenghua Yu wrote: > > On Fri, Jun 22, 2018 at 12:49:00PM +0200, Thomas Gleixner wrote: > > > On Sun, 27 May 2018, Fenghua Yu wrote: > > > > +static void wait_for_reexecution(void) > > > > +{ > > > > + whil

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-23 Thread Thomas Gleixner
On Fri, 22 Jun 2018, Fenghua Yu wrote: > On Fri, Jun 22, 2018 at 12:49:00PM +0200, Thomas Gleixner wrote: > > On Sun, 27 May 2018, Fenghua Yu wrote: > > > +static void wait_for_reexecution(void) > > > +{ > > > + while (time_before(jiffies, disable_split_lock_jiffies + > > > +ree

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-23 Thread Thomas Gleixner
On Fri, 22 Jun 2018, Fenghua Yu wrote: > On Fri, Jun 22, 2018 at 01:59:44PM +0200, Thomas Gleixner wrote: > > On Fri, 22 Jun 2018, Thomas Gleixner wrote: > > > The whole thing is simply: > > > > > > handle_ac() > > > { > > > if (user_mode(regs)) { > > >do_trap(AC, SIGBUS, ...); > > >

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Fenghua Yu
On Fri, Jun 22, 2018 at 12:49:00PM +0200, Thomas Gleixner wrote: > On Sun, 27 May 2018, Fenghua Yu wrote: > > +static void wait_for_reexecution(void) > > +{ > > + while (time_before(jiffies, disable_split_lock_jiffies + > > + reenable_split_lock_delay)) > > + cpu_re

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Fenghua Yu
On Fri, Jun 22, 2018 at 01:59:44PM +0200, Thomas Gleixner wrote: > On Fri, 22 Jun 2018, Thomas Gleixner wrote: > > The whole thing is simply: > > > > handle_ac() > > { > > if (user_mode(regs)) { > > do_trap(AC, SIGBUS, ...); > > } else { > > disable_ac_on_local_cpu

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Thomas Gleixner
On Sat, 23 Jun 2018, Thomas Gleixner wrote: > On Fri, 22 Jun 2018, Fenghua Yu wrote: > > On Fri, Jun 22, 2018 at 01:59:44PM +0200, Thomas Gleixner wrote: > > > Aside of that the spec says: > > > > > > 31 Disable LOCK# assertion for split locked access. > > > > > > Can you pretty please make sur

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Thomas Gleixner
On Fri, 22 Jun 2018, Fenghua Yu wrote: > On Fri, Jun 22, 2018 at 01:59:44PM +0200, Thomas Gleixner wrote: > > Aside of that the spec says: > > > > 31 Disable LOCK# assertion for split locked access. > > > > Can you pretty please make sure that this bit enforces #AC enable? If 31 is > > ever set

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Fenghua Yu
On Fri, Jun 22, 2018 at 01:59:44PM +0200, Thomas Gleixner wrote: > On Fri, 22 Jun 2018, Thomas Gleixner wrote: > > The whole thing is simply: > > > > handle_ac() > > { > > if (user_mode(regs)) { > > do_trap(AC, SIGBUS, ...); > > } else { > > disable_ac_on_local_cpu

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Thomas Gleixner
On Fri, 22 Jun 2018, Thomas Gleixner wrote: > The whole thing is simply: > > handle_ac() > { > if (user_mode(regs)) { >do_trap(AC, SIGBUS, ...); > } else { > disable_ac_on_local_cpu(); > WARN_ONCE(1); > } > } > > That wants #AC enabled

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-22 Thread Thomas Gleixner
On Sun, 27 May 2018, Fenghua Yu wrote: > +static void wait_for_reexecution(void) > +{ > + while (time_before(jiffies, disable_split_lock_jiffies + > +reenable_split_lock_delay)) > + cpu_relax(); > +} > + > +/* > + * TEST_CTL MSR is shared among threads on the

Re: [RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-06-21 Thread Peter Zijlstra
On Sun, May 27, 2018 at 08:45:51AM -0700, Fenghua Yu wrote: > When #AC exception for split lock is triggered from a kernel instruction, > by default we don't want the exception to panic the whole system. Instead, > the exception handler should log the fault information for debug and > continue the

[RFC PATCH 02/16] x86/split_lock: Handle #AC exception for split lock in kernel mode

2018-05-27 Thread Fenghua Yu
When #AC exception for split lock is triggered from a kernel instruction, by default we don't want the exception to panic the whole system. Instead, the exception handler should log the fault information for debug and continue the instruction execution. CPU generates #AC exception if split lock op