[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALCETrWUO8fEiyKFrQZ+kKPrcwy4eOjRBNda_=nV+gq9nP2DDg@mail.gmail.com>
Date: Thu, 26 Mar 2015 11:33:26 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: xen-devel <xen-devel@...ts.xen.org>,
Borislav Petkov <bp@...en8.de>, X86 ML <x86@...nel.org>,
Denys Vlasenko <dvlasenk@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] x86: Replace this_cpu_sp0 with current_top_of_stack
and fix it on x86_32
On Mar 26, 2015 6:32 AM, "Boris Ostrovsky" <boris.ostrovsky@...cle.com> wrote:
>
> On 03/06/2015 08:50 PM, Andy Lutomirski wrote:
>>
>> I broke 32-bit kernels. The implementation of sp0 was correct as
>> far as I can tell, but sp0 was much weirder on x86_32 than I
>> realized. It has the following issues:
>>
>> - Init's sp0 is inconsistent with everything else's: non-init tasks
>> are offset by 8 bytes. (I have no idea why, and the comment is unhelpful.)
>>
>> - vm86 does crazy things to sp0.
>>
>> Fix it up by replacing this_cpu_sp0() with current_top_of_stack()
>> and using a new percpu variable to track the top of the stack on
>> x86_32.
>>
>> Fixes: 75182b1632a8 x86/asm/entry: Switch all C consumers of kernel_stack to this_cpu_sp0()
>> Signed-off-by: Andy Lutomirski <luto@...capital.net>
>> ---
>
>
> ...
>
>
>> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
>> index febc6aabc72e..759388c538cf 100644
>> --- a/arch/x86/kernel/smpboot.c
>> +++ b/arch/x86/kernel/smpboot.c
>> @@ -806,6 +806,8 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
>> #ifdef CONFIG_X86_32
>> /* Stack for startup_32 can be just as for start_secondary onwards */
>> irq_ctx_init(cpu);
>> + per_cpu(cpu_current_top_of_stack, cpu) =
>> + (unsigned long)task_stack_page(idle) + THREAD_SIZE;
>> #else
>> clear_tsk_thread_flag(idle, TIF_FORK);
>> initial_gs = per_cpu_offset(cpu);
>
>
>
> Andy,
>
> We need a similar change for Xen, otherwise 32-bit PV guests are not happy. Is the patch above final (and then should I submit a separate patch) or are you still working on it (and if so, please add the change below)?
>
My patch is final -- it's been in -tip for a while now.
It would be really nice if we could merge the bits of Xen and native
initialization that are identical rather than needing to duplicate all
this code.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists