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

Re: [Xen-devel] [PATCH 6/6] x86/boot: Drop INVALID_VCPU



On 07.01.2020 19:07, Andrew Cooper wrote:
> On 07/01/2020 16:52, Jan Beulich wrote:
>> On 06.01.2020 16:54, Andrew Cooper wrote:
>>> --- a/xen/arch/x86/setup.c
>>> +++ b/xen/arch/x86/setup.c
>>> @@ -705,7 +705,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
>>>      /* Critical region without IDT or TSS.  Any fault is deadly! */
>>>  
>>>      set_processor_id(0);
>>> -    set_current(INVALID_VCPU); /* debug sanity. */
>>> +    set_current(NULL); /* debug sanity. */
>>>      idle_vcpu[0] = current;
>> Is any of this actually changing any value in memory?
> 
> Yes. Observe:
> 
>     /* Set up stack. */
>     lea     STACK_SIZE + sym_esi(cpu0_stack), %esp
> 
> twice in head.S, meaning that the top-of-stack block is junk at this point.

Why junk, when we have

char __section(".bss.stack_aligned") __aligned(STACK_SIZE)
    cpu0_stack[STACK_SIZE];

> Explicitly setting it to NULL here seems like a safer option than
> trusting that noone has actually used the stack yet.

The actual "stack" part of cpu0_stack[] may have been used already,
but the top-of-stack block ought to be untouched, or else we have
other problems. Anyway, I don't heavily mind writing several zeros
over what is already zero here, it just seems pretty pointless (and
increasingly so by you now writing yet another zero).

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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