Re: [RFC PATCH 17/35] Segment register changes for Xen

Keir Fraser
2006-05-18T20:46:40Z

On 18 May 2006, at 21:20, Zachary Amsden wrote:

>> 1. We clear FS/GS before changing TLS entries and switching LDT, as
>> otherwise the hypervisor will fail to restore thread-local values on
>> return to the guest kernel and we take a slow exception path.
>
>> @@ -647,6 +647,8 @@ struct task_struct fastcall * __switch_t
>> */
>> savesegment(fs, prev->fs);
>> savesegment(gs, prev->gs);
>> + clearsegment(fs);
>> + clearsegment(gs);
>>
>
> Really not needed. Think about it. You can even speed up Xen. I'm
> glad the native operation here is a nop, but it should be
> hypervisor_clearsegment or xen_clearsegment if you really want to keep
> it.

Maybe you could explain in more detail? It's not needed for
correctness, but it is faster for us to clear at that point.

-- Keir