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

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

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 mi...@kernel.org wrote: * Andy Lutomirski l...@amacapital.net 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

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 l...@amacapital.net wrote: On Thu, Feb 26, 2015 at 3:42 AM, Ingo Molnar mi...@kernel.org wrote: * Andy Lutomirski l...@amacapital.net wrote: I added that in and applied this patch. So this is not just slightly buggy, it's fundamentally

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

2015-02-26 Thread Ingo Molnar
* Andy Lutomirski l...@amacapital.net 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

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

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

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

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); > >

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-25 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com 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

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 mi...@kernel.org wrote: * Denys Vlasenko dvlas...@redhat.com 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

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 mi...@kernel.org 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

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 mi...@kernel.org wrote: * Andy Lutomirski l...@amacapital.net wrote: - BUG_ON(((current_stack_pointer() ^ this_cpu_read_stable(kernel_stack)) + BUG_ON(((current_stack_pointer() ^ +(this_cpu_read_stable(kernel_stack) -

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

2015-02-25 Thread Ingo Molnar
* Andy Lutomirski l...@amacapital.net 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);

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

2015-02-25 Thread Ingo Molnar
* Denys Vlasenko dvlas...@redhat.com 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.

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

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

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

[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

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 dvlas...@redhat.com 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

[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

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 dvlas...@redhat.com 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

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 dvlas...@redhat.com 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