All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH 1/2] x86/xen: Set EFER.NX and EFER.SCE in PVH guests
Date: Fri, 05 Sep 2014 17:04:19 +0100	[thread overview]
Message-ID: <5409FB230200007800031912@mail.emea.novell.com> (raw)
In-Reply-To: <5409CCB0.3070402@citrix.com>

>>> On 05.09.14 at 16:46, <david.vrabel@citrix.com> wrote:
> On 05/09/14 15:34, Jan Beulich wrote:
>>>>> On 05.09.14 at 16:11, <david.vrabel@citrix.com> wrote:
>>> --- a/arch/x86/xen/xen-head.S
>>> +++ b/arch/x86/xen/xen-head.S
>>> @@ -47,6 +47,36 @@ ENTRY(startup_xen)
>>>  
>>>  	__FINIT
>>>  
>>> +#ifdef CONFIG_XEN_PVH
>>> +
>>> +/**
>>> + * xen_pvh_cpu_early_init() - early PVH VCPU initialization
>>> + * @cpu: this cpu number (%rdi)
>>> + *
>>> + * Note: This is called as a function on the boot CPU and as the secondary
>>> + * CPU entry point.
>>> + */
>>> +ENTRY(xen_pvh_cpu_early_init)
>>> +	/* Gather features to see if NX implemented. */
>>> +	mov     $0x80000001, %eax
>>> +	cpuid
>>> +	mov     %edx,%esi
>>> +
>>> +	mov     $MSR_EFER, %ecx
>>> +	rdmsr
>>> +	bts     $_EFER_SCE, %eax
>>> +
>>> +	bt      $20,%esi
>>> +	jnc     1f      /* No NX, skip setting it */
>>> +	bts     $_EFER_NX, %eax
>>> +1:	wrmsr
>>> +
>>> +	cmp     $0,%rdi /* non-zero => secondary cpu */
>> 
>> Isn't Linux is specifically moving away from this assumption?
> 
> I don't think this is relevant.  Is Xen ever going boot with a non-zero
> VCPU?

That's not the question here. The question is - will CPU 0 ever be
possible to be brought down and back up? And I hope the answer
to this isn't "No, never".

>>> +	jne     cpu_bringup_and_idle
>>> +	ret
>>> +
>>> +#endif /* CONFIG_XEN_PVH */
>> 
>> Also, does all this really need to be done in assembly?
> 
> There's no usable stack until EFER.NX is set.  I couldn't think of a way
> to write this in C that would guarantee no stack use, so I didn't
> suggest it.
> 
> Can you think of a way?

No stack use is a very convincing argument for using assembly? I
must have overlooked it if that was said somewhere in a comment.

Jan

  reply	other threads:[~2014-09-05 16:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 14:11 [PATCHv4 0/2] x86/xen: PVH fixes David Vrabel
2014-09-05 14:11 ` [PATCH 1/2] x86/xen: Set EFER.NX and EFER.SCE in PVH guests David Vrabel
2014-09-05 14:34   ` Jan Beulich
2014-09-05 14:46     ` David Vrabel
2014-09-05 16:04       ` Jan Beulich [this message]
2014-09-05 16:21         ` David Vrabel
2014-09-08  6:49           ` Jan Beulich
2014-09-05 15:15   ` Boris Ostrovsky
2014-09-05 14:11 ` [PATCH 2/2] x86/xen: document CONFIG_XEN_PVH option David Vrabel

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=5409FB230200007800031912@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.