From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: konrad.wilk@oracle.com, david.vrabel@citrix.com,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/xen: Fix 32-bit PV guests's usage of kernel_stack
Date: Wed, 09 Apr 2014 12:15:48 -0400 [thread overview]
Message-ID: <53457234.4090203@oracle.com> (raw)
In-Reply-To: <20140409112517.570b24e9@gandalf.local.home>
On 04/09/2014 11:25 AM, Steven Rostedt wrote:
> On Wed, 09 Apr 2014 11:12:33 -0400
> Boris Ostrovsky <boris.ostrovsky@oracle.com> wrote:
>
>> Commit 198d208df4371734ac4728f69cb585c284d20a15 made 32-bit kernels use
>> kernel_stack to point to thread_info. That change missed a couple of
>> updates needed by Xen's PV guests:
>>
>> 1. kernel_stack needs to be initialized for secondary CPUs
>> 2. GET_THREAD_INFO() now uses %fs register which may not be the kernel's
>> version when executing xen_iret()
>>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> ---
>> arch/x86/xen/smp.c | 3 ++-
>> arch/x86/xen/xen-asm_32.S | 4 ++++
>> 2 files changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
>> index a18eadd..7005974 100644
>> --- a/arch/x86/xen/smp.c
>> +++ b/arch/x86/xen/smp.c
>> @@ -441,10 +441,11 @@ static int xen_cpu_up(unsigned int cpu, struct task_struct *idle)
>> irq_ctx_init(cpu);
>> #else
>> clear_tsk_thread_flag(idle, TIF_FORK);
>> +#endif
>> per_cpu(kernel_stack, cpu) =
>> (unsigned long)task_stack_page(idle) -
>> KERNEL_STACK_OFFSET + THREAD_SIZE;
>> -#endif
>> +
>> xen_setup_runstate_info(cpu);
>> xen_setup_timer(cpu);
>> xen_init_lock_cpu(cpu);
>> diff --git a/arch/x86/xen/xen-asm_32.S b/arch/x86/xen/xen-asm_32.S
>> index 33ca6e4..d433637 100644
>> --- a/arch/x86/xen/xen-asm_32.S
>> +++ b/arch/x86/xen/xen-asm_32.S
>> @@ -88,7 +88,11 @@ ENTRY(xen_iret)
>> * avoid having to reload %fs
> Looks like this patch makes the above comment incorrect.
I didn't notice this (it was full 3 lines above the change), it will
obviously have to be updated.
>> */
>> #ifdef CONFIG_SMP
>> + pushw %fs
>> + movl $(__KERNEL_PERCPU), %eax
>> + movl %eax, %fs
>> GET_THREAD_INFO(%eax)
>> + popw %fs
>> movl %ss:TI_cpu(%eax), %eax
> Hmm, you're using GET_THREAD_INFO() to get the thread info to find the
> current CPU for later use to avoid using %fs. ??
>
> Is it possible to just push the cpu on the kernel irq stack and be able
> to retrieve it manually? Looks like the only reason to use the
> thread_info here is to get to the CPU index for below.
Or vcpu_info, which is what we are really after.
However, it looks like using %fs/GET_THREAD_INFO() should be OK as well,
provided I deal with a potential faulting.
-boris
>
>> movl %ss:__per_cpu_offset(,%eax,4), %eax
>> mov %ss:xen_vcpu(%eax), %eax
> -- Steve
>
prev parent reply other threads:[~2014-04-09 16:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 14:06 [PATCH] x86/xen: Fix 32-bit PV guests's usage of kernel_stack Boris Ostrovsky
2014-04-09 14:08 ` David Vrabel
2014-04-09 14:21 ` [Xen-devel] " Jan Beulich
2014-04-09 14:29 ` David Vrabel
2014-04-09 14:41 ` Andrew Cooper
2014-04-09 15:01 ` Jan Beulich
2014-04-09 15:38 ` Boris Ostrovsky
2014-04-09 15:40 ` Jan Beulich
2014-04-09 15:25 ` Steven Rostedt
2014-04-09 16:15 ` Boris Ostrovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53457234.4090203@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).