[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] x86/xen: Set EFER.NX and EFER.SCE in PVH guests



On 05/09/14 15:34, Jan Beulich wrote:
>>>> On 05.09.14 at 16:11, <david.vrabel@xxxxxxxxxx> 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?

>> +    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?

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.