Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-22 Thread Josh Poimboeuf
On Wed, Mar 22, 2017 at 09:47:06AM +0100, Peter Zijlstra wrote: > > A little like so then. > > --- > Subject: x86: Implement __WARN using UD0 > From: Peter Zijlstra > Date: Thu Feb 2 14:43:51 CET 2017 > > By using "UD0" for WARNs we remove the function call and its

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-22 Thread Josh Poimboeuf
On Wed, Mar 22, 2017 at 09:47:06AM +0100, Peter Zijlstra wrote: > > A little like so then. > > --- > Subject: x86: Implement __WARN using UD0 > From: Peter Zijlstra > Date: Thu Feb 2 14:43:51 CET 2017 > > By using "UD0" for WARNs we remove the function call and its possible > __FILE__ and

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-22 Thread Peter Zijlstra
A little like so then. --- Subject: x86: Implement __WARN using UD0 From: Peter Zijlstra Date: Thu Feb 2 14:43:51 CET 2017 By using "UD0" for WARNs we remove the function call and its possible __FILE__ and __LINE__ immediate arguments from the instruction stream. Total

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-22 Thread Peter Zijlstra
A little like so then. --- Subject: x86: Implement __WARN using UD0 From: Peter Zijlstra Date: Thu Feb 2 14:43:51 CET 2017 By using "UD0" for WARNs we remove the function call and its possible __FILE__ and __LINE__ immediate arguments from the instruction stream. Total image size will not

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Peter Zijlstra
On Tue, Mar 21, 2017 at 09:03:40AM -0500, Josh Poimboeuf wrote: > On Fri, Mar 17, 2017 at 10:19:19PM +0100, Peter Zijlstra wrote: > > +/* > > + * Since some emulators terminate on UD2, we cannot use it for WARN. > > + * Since various instruction decoders disagree on the length of UD1, > > + * we

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Peter Zijlstra
On Tue, Mar 21, 2017 at 09:03:40AM -0500, Josh Poimboeuf wrote: > On Fri, Mar 17, 2017 at 10:19:19PM +0100, Peter Zijlstra wrote: > > +/* > > + * Since some emulators terminate on UD2, we cannot use it for WARN. > > + * Since various instruction decoders disagree on the length of UD1, > > + * we

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Peter Zijlstra
On Tue, Mar 21, 2017 at 10:32:52AM -0500, Josh Poimboeuf wrote: > On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote: > > > > +static int fixup_bug(struct pt_regs *regs, int trapnr) > > > > +{ > > > > + if (trapnr != X86_TRAP_UD) > > > > + return 0; > > > > + > > >

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Peter Zijlstra
On Tue, Mar 21, 2017 at 10:32:52AM -0500, Josh Poimboeuf wrote: > On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote: > > > > +static int fixup_bug(struct pt_regs *regs, int trapnr) > > > > +{ > > > > + if (trapnr != X86_TRAP_UD) > > > > + return 0; > > > > + > > >

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Josh Poimboeuf
On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote: > > to WARN, they should probably be renamed to describe their new purpose, > > like: > > > > "report_bug" -> "report_bug_or_warning" > > "fixup_bug" -> "fixup_bug_or_warning" > > > > On a related note, if warn and bug are

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Josh Poimboeuf
On Tue, Mar 21, 2017 at 04:14:46PM +0100, Peter Zijlstra wrote: > > to WARN, they should probably be renamed to describe their new purpose, > > like: > > > > "report_bug" -> "report_bug_or_warning" > > "fixup_bug" -> "fixup_bug_or_warning" > > > > On a related note, if warn and bug are

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Arjan van de Ven
On 3/21/2017 8:14 AM, Peter Zijlstra wrote: For self-documentation purposes, maybe use a define for the length of the ud0 instruction? #define TWO 2 ;-) some things make sense as a define, others don't (adding a comment, maybe)

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Arjan van de Ven
On 3/21/2017 8:14 AM, Peter Zijlstra wrote: For self-documentation purposes, maybe use a define for the length of the ud0 instruction? #define TWO 2 ;-) some things make sense as a define, others don't (adding a comment, maybe)

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Josh Poimboeuf
On Fri, Mar 17, 2017 at 10:19:19PM +0100, Peter Zijlstra wrote: > --- a/arch/x86/include/asm/bug.h > +++ b/arch/x86/include/asm/bug.h > @@ -1,36 +1,70 @@ > #ifndef _ASM_X86_BUG_H > #define _ASM_X86_BUG_H > > +#include > + > #define HAVE_ARCH_BUG > > -#ifdef CONFIG_DEBUG_BUGVERBOSE > +/* >

Re: [PATCH 1/5] x86: Implement __WARN using UD0

2017-03-21 Thread Josh Poimboeuf
On Fri, Mar 17, 2017 at 10:19:19PM +0100, Peter Zijlstra wrote: > --- a/arch/x86/include/asm/bug.h > +++ b/arch/x86/include/asm/bug.h > @@ -1,36 +1,70 @@ > #ifndef _ASM_X86_BUG_H > #define _ASM_X86_BUG_H > > +#include > + > #define HAVE_ARCH_BUG > > -#ifdef CONFIG_DEBUG_BUGVERBOSE > +/* >

[PATCH 1/5] x86: Implement __WARN using UD0

2017-03-17 Thread Peter Zijlstra
By using "UD0" for WARNs we remove the function call and its possible __FILE__ and __LINE__ immediate arguments from the instruction stream. Total image size will not change much, what we win in the instruction stream we'll loose because of the __bug_table entries. Still, saves on I$ footprint

[PATCH 1/5] x86: Implement __WARN using UD0

2017-03-17 Thread Peter Zijlstra
By using "UD0" for WARNs we remove the function call and its possible __FILE__ and __LINE__ immediate arguments from the instruction stream. Total image size will not change much, what we win in the instruction stream we'll loose because of the __bug_table entries. Still, saves on I$ footprint