Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Andy Lutomirski
On Wed, Apr 3, 2019 at 12:42 PM Thomas Gleixner wrote: > > On Wed, 3 Apr 2019, Thomas Gleixner wrote: > > On Tue, 2 Apr 2019, Andy Lutomirski wrote: > > > > On Apr 2, 2019, at 1:29 PM, Thomas Gleixner wrote: > > > >>> How about a much better fix: make the DB stack be the same size as all > > > >>

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Thomas Gleixner
On Wed, 3 Apr 2019, Thomas Gleixner wrote: > On Tue, 2 Apr 2019, Andy Lutomirski wrote: > > > On Apr 2, 2019, at 1:29 PM, Thomas Gleixner wrote: > > >>> How about a much better fix: make the DB stack be the same size as all > > >>> the others and just have 4 of them (DB0, DB1, DB2, and DB3. After

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Thomas Gleixner
On Tue, 2 Apr 2019, Andy Lutomirski wrote: > > On Apr 2, 2019, at 1:29 PM, Thomas Gleixner wrote: > >>> How about a much better fix: make the DB stack be the same size as all > >>> the others and just have 4 of them (DB0, DB1, DB2, and DB3. After all, > >>> overflowing from one debug stack into a

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Josh Poimboeuf
On Wed, Apr 03, 2019 at 10:10:41AM +0200, Peter Zijlstra wrote: > On Wed, Apr 03, 2019 at 10:08:28AM +0200, Peter Zijlstra wrote: > > On Tue, Apr 02, 2019 at 10:51:49AM -0500, Josh Poimboeuf wrote: > > > On Tue, Apr 02, 2019 at 05:48:56PM +0200, Thomas Gleixner wrote: > > > > > With the above "(stk

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Peter Zijlstra
On Wed, Apr 03, 2019 at 10:08:28AM +0200, Peter Zijlstra wrote: > On Tue, Apr 02, 2019 at 10:51:49AM -0500, Josh Poimboeuf wrote: > > On Tue, Apr 02, 2019 at 05:48:56PM +0200, Thomas Gleixner wrote: > > > > With the above "(stk <= begin || stk >= end)" check, removing the loop > > > > becomes not a

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Peter Zijlstra
On Tue, Apr 02, 2019 at 10:51:49AM -0500, Josh Poimboeuf wrote: > On Tue, Apr 02, 2019 at 05:48:56PM +0200, Thomas Gleixner wrote: > > > With the above "(stk <= begin || stk >= end)" check, removing the loop > > > becomes not all that important since exception stack dumps are quite > > > rare and n

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-03 Thread Peter Zijlstra
On Tue, Apr 02, 2019 at 10:43:29AM -0500, Josh Poimboeuf wrote: > On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: > > static bool in_exception_stack(unsigned long *stack, struct stack_info > > *info) > > { > > - unsigned long estacks, begin, end, stk = (unsigned long)stack; >

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Andy Lutomirski
> On Apr 2, 2019, at 1:29 PM, Thomas Gleixner wrote: > >> On Tue, 2 Apr 2019, Thomas Gleixner wrote: >> On Tue, 2 Apr 2019, Andy Lutomirski wrote: On Apr 2, 2019, at 9:48 AM, Thomas Gleixner wrote: >> On Tue, 2 Apr 2019, Josh Poimboeuf wrote: >> On Tue, Apr 02, 2019 at 12:1

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Thomas Gleixner
On Tue, 2 Apr 2019, Thomas Gleixner wrote: > On Tue, 2 Apr 2019, Andy Lutomirski wrote: > > > On Apr 2, 2019, at 9:48 AM, Thomas Gleixner wrote: > > > > > >> On Tue, 2 Apr 2019, Josh Poimboeuf wrote: > > >>> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: > > >>> +/* > > >>> + *

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Thomas Gleixner
On Tue, 2 Apr 2019, Rasmus Villemoes wrote: > On 02/04/2019 17.48, Thomas Gleixner wrote: > > On Tue, 2 Apr 2019, Josh Poimboeuf wrote: > >> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: > >>> +/* > >>> + * Array of exception stack page descriptors. If the stack is larger than >

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Rasmus Villemoes
On 02/04/2019 17.48, Thomas Gleixner wrote: > On Tue, 2 Apr 2019, Josh Poimboeuf wrote: >> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: >>> +/* >>> + * Array of exception stack page descriptors. If the stack is larger than >>> + * PAGE_SIZE, all pages covering a particular stack

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Thomas Gleixner
On Tue, 2 Apr 2019, Andy Lutomirski wrote: > > On Apr 2, 2019, at 9:48 AM, Thomas Gleixner wrote: > > > >> On Tue, 2 Apr 2019, Josh Poimboeuf wrote: > >>> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: > >>> +/* > >>> + * Array of exception stack page descriptors. If the stack i

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Andy Lutomirski
> On Apr 2, 2019, at 9:48 AM, Thomas Gleixner wrote: > >> On Tue, 2 Apr 2019, Josh Poimboeuf wrote: >>> On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: >>> +/* >>> + * Array of exception stack page descriptors. If the stack is larger than >>> + * PAGE_SIZE, all pages covering

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Josh Poimboeuf
On Tue, Apr 02, 2019 at 10:51:49AM -0500, Josh Poimboeuf wrote: > On Tue, Apr 02, 2019 at 05:48:56PM +0200, Thomas Gleixner wrote: > > > With the above "(stk <= begin || stk >= end)" check, removing the loop > > > becomes not all that important since exception stack dumps are quite > > > rare and n

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Josh Poimboeuf
On Tue, Apr 02, 2019 at 05:48:56PM +0200, Thomas Gleixner wrote: > > With the above "(stk <= begin || stk >= end)" check, removing the loop > > becomes not all that important since exception stack dumps are quite > > rare and not performance sensitive. With all the macros this code > > becomes a l

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Thomas Gleixner
On Tue, 2 Apr 2019, Josh Poimboeuf wrote: > On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: > > +/* > > + * Array of exception stack page descriptors. If the stack is larger than > > + * PAGE_SIZE, all pages covering a particular stack will have the same > > + * info. > > + */ > >

Re: [patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Josh Poimboeuf
On Tue, Apr 02, 2019 at 12:19:46PM +0200, Thomas Gleixner wrote: > The current implementation of in_exception_stack() iterates over the > exception stacks array. Most of the time this is an useless exercise, but > even for the actual use cases (perf and ftrace) it takes at least 2 > iterations to g

[patch 15/14] x86/dumpstack/64: Speedup in_exception_stack()

2019-04-02 Thread Thomas Gleixner
The current implementation of in_exception_stack() iterates over the exception stacks array. Most of the time this is an useless exercise, but even for the actual use cases (perf and ftrace) it takes at least 2 iterations to get to the NMI stack. As the exception stacks and the guard pages are pag