Re: [PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-29 Thread Peter Zijlstra
On Fri, May 29, 2020 at 10:28:33AM -0700, Andy Lutomirski wrote: > > +static __always_inline unsigned long local_db_save(void) > > +{ > > +unsigned long dr7; > > + > > +get_debugreg(, 7); > > +dr7 ^= 0x400; > > Why xor? This seems extra confusing. I'll do the normal mask thing ..

Re: [PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-29 Thread Andy Lutomirski
> On May 28, 2020, at 2:34 PM, Peter Zijlstra wrote: > > On Thu, May 28, 2020 at 11:15:50PM +0200, Peter Zijlstra wrote: >>> On Thu, May 28, 2020 at 09:52:30PM +0100, Andrew Cooper wrote: >>> On 28/05/2020 21:19, Peter Zijlstra wrote: --- a/arch/x86/include/asm/debugreg.h +++

Re: [PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-28 Thread Andrew Cooper
On 28/05/2020 22:15, Peter Zijlstra wrote: > On Thu, May 28, 2020 at 09:52:30PM +0100, Andrew Cooper wrote: >> On 28/05/2020 21:19, Peter Zijlstra wrote: >>> --- a/arch/x86/include/asm/debugreg.h >>> +++ b/arch/x86/include/asm/debugreg.h >>> @@ -113,6 +113,31 @@ static inline void

Re: [PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-28 Thread Peter Zijlstra
On Thu, May 28, 2020 at 11:15:50PM +0200, Peter Zijlstra wrote: > On Thu, May 28, 2020 at 09:52:30PM +0100, Andrew Cooper wrote: > > On 28/05/2020 21:19, Peter Zijlstra wrote: > > > --- a/arch/x86/include/asm/debugreg.h > > > +++ b/arch/x86/include/asm/debugreg.h > > > @@ -113,6 +113,31 @@ static

Re: [PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-28 Thread Peter Zijlstra
On Thu, May 28, 2020 at 09:52:30PM +0100, Andrew Cooper wrote: > On 28/05/2020 21:19, Peter Zijlstra wrote: > > --- a/arch/x86/include/asm/debugreg.h > > +++ b/arch/x86/include/asm/debugreg.h > > @@ -113,6 +113,31 @@ static inline void debug_stack_usage_inc > > static inline void

Re: [PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-28 Thread Andrew Cooper
On 28/05/2020 21:19, Peter Zijlstra wrote: > --- a/arch/x86/include/asm/debugreg.h > +++ b/arch/x86/include/asm/debugreg.h > @@ -113,6 +113,31 @@ static inline void debug_stack_usage_inc > static inline void debug_stack_usage_dec(void) { } > #endif /* X86_64 */ > > +static __always_inline void

[PATCH 1/6] x86/entry: Introduce local_db_{save,restore}()

2020-05-28 Thread Peter Zijlstra
In order to allow other exceptions than #DB to disable breakpoints, provide a common helper. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/debugreg.h | 25 + arch/x86/kernel/traps.c | 18 ++ 2 files changed, 27 insertions(+),