Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-26 Thread Andy Lutomirski
On Thu, Feb 26, 2015 at 7:21 AM, Andy Lutomirski wrote: > On Thu, Feb 26, 2015 at 3:42 AM, Ingo Molnar wrote: >> >> * Andy Lutomirski wrote: >> >>> >> I added that in and applied this patch. >>> > >>> > So this is not just slightly buggy, it's fundamentally >>> > wrong as well as it removes the

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-26 Thread Andy Lutomirski
On Thu, Feb 26, 2015 at 3:42 AM, Ingo Molnar wrote: > > * Andy Lutomirski wrote: > >> >> I added that in and applied this patch. >> > >> > So this is not just slightly buggy, it's fundamentally >> > wrong as well as it removes the possibility of an RSP >> > value optimization from the 64-bit path

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-26 Thread Ingo Molnar
* Andy Lutomirski wrote: > >> I added that in and applied this patch. > > > > So this is not just slightly buggy, it's fundamentally > > wrong as well as it removes the possibility of an RSP > > value optimization from the 64-bit path, see my > > previous mail. > > This is just trying to che

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-25 Thread Andy Lutomirski
On Wed, Feb 25, 2015 at 1:45 AM, Ingo Molnar wrote: > > * Andy Lutomirski wrote: > >> - BUG_ON(((current_stack_pointer() ^ >> this_cpu_read_stable(kernel_stack)) >> + BUG_ON(((current_stack_pointer() ^ >> +(this_cpu_read_stable(kernel_stack) - 1)) >> &

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-25 Thread Ingo Molnar
* Denys Vlasenko wrote: > > The decision on how exactly we should fix > > KERNEL_STACK_OFFSET (set it to SIZEOF_PTREGS or to > > zero) depends on whether we switch to using PUSHes, or > > not. What do you think? Yes. > A data point. I implemented push-based creation of > pt_regs and benchm

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-25 Thread Denys Vlasenko
On 02/25/2015 01:48 PM, Denys Vlasenko wrote: > On Wed, Feb 25, 2015 at 9:53 AM, Ingo Molnar wrote: >> But the fix should be to not touch RSP in SAVE_ARGS, to >> keep percpu::kernel_stack as an optimized entry point - >> with KERNEL_STACK_OFFSET pointing to. >> >> So NAK - this should be fixed for

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-25 Thread Denys Vlasenko
On Wed, Feb 25, 2015 at 9:53 AM, Ingo Molnar wrote: > > * Denys Vlasenko wrote: > >> PER_CPU_VAR(kernel_stack) was set up in a way where it >> points five stack slots below the top of stack. >> >> Presumably, it was done to avoid one "sub $5*8,%rsp" in >> syscall/sysenter code paths, where iret f

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-25 Thread Ingo Molnar
* Andy Lutomirski wrote: > - BUG_ON(((current_stack_pointer() ^ this_cpu_read_stable(kernel_stack)) > + BUG_ON(((current_stack_pointer() ^ > +(this_cpu_read_stable(kernel_stack) - 1)) > & ~(THREAD_SIZE - 1)) != 0); > > preempt_count_sub(HARDIR

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-25 Thread Ingo Molnar
* Denys Vlasenko wrote: > PER_CPU_VAR(kernel_stack) was set up in a way where it > points five stack slots below the top of stack. > > Presumably, it was done to avoid one "sub $5*8,%rsp" in > syscall/sysenter code paths, where iret frame needs to be > created by hand. > > Ironically, none

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-24 Thread Andy Lutomirski
On Tue, Feb 24, 2015 at 10:51 AM, Denys Vlasenko wrote: > PER_CPU_VAR(kernel_stack) was set up in a way where it points > five stack slots below the top of stack. > > Presumably, it was done to avoid one "sub $5*8,%rsp" > in syscall/sysenter code paths, where iret frame needs to be > created by ha

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-24 Thread Denys Vlasenko
On 02/24/2015 08:30 PM, Steven Rostedt wrote: > On Tue, 24 Feb 2015 19:51:33 +0100 > Denys Vlasenko wrote: > >> PER_CPU_VAR(kernel_stack) was set up in a way where it points >> five stack slots below the top of stack. >> >> Presumably, it was done to avoid one "sub $5*8,%rsp" >> in syscall/sysent

Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-24 Thread Steven Rostedt
On Tue, 24 Feb 2015 19:51:33 +0100 Denys Vlasenko wrote: > PER_CPU_VAR(kernel_stack) was set up in a way where it points > five stack slots below the top of stack. > > Presumably, it was done to avoid one "sub $5*8,%rsp" > in syscall/sysenter code paths, where iret frame needs to be > created by

[PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET

2015-02-24 Thread Denys Vlasenko
PER_CPU_VAR(kernel_stack) was set up in a way where it points five stack slots below the top of stack. Presumably, it was done to avoid one "sub $5*8,%rsp" in syscall/sysenter code paths, where iret frame needs to be created by hand. Ironically, none of them benefit from this optimization, since