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

[Xen-devel] RE: Avoid alloc for xsave before xsave_init



Keir Fraser wrote on 2011-01-14:
> On 13/01/2011 20:21, "Huang2, Wei" <Wei.Huang2@xxxxxxx> wrote:
>> Was the issue caused by the uninitialized variable xsave_cntxt_size,
>> triggering problem for _xmalloc()? If so, one solution is to set
>> xsave_cntxt_size=576 (the default value after reset) as a default
>> value. When
>> xsave_alloc_save_area() is called for idel VCPU, _xmalloc() will
>> initialize
>> 576 bytes. Idle domain doesn't change xcr0 from my understanding. So
>> its xcr0 is XSTATE_FP_SSE all the time.
> 
> Idle domain isn't using FPU,SSE,AVX or any such extended state and
> doesn't need it saved. Xsave_{alloc,free}_save_area() should
> test-and-exit on is_idle_vcpu(), and our context switch code should
> not be doing XSAVE when switching out an idle vcpu (I hope this is the
> case already, as it would be a pointless waste of time).

I agree that do test-and-exit on is_idle_vcpu() in 
Xsave_{alloc,free}_save_area. Further, We'd better add 
assert(xsave_cntxt_size>=576) after the test-and-exit clause to ensure no 
buffer overflow will happen in the future.

I reviewed the context switch code and assure context switch code not be doing 
XSAVE when switching out an idle vcpu.

Jimmy
>> -----Original Message-----
>> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Wei,
>> Gang
>> Sent: Thursday, January 13, 2011 12:49 PM
>> To: xen-devel@xxxxxxxxxxxxxxxxxxx
>> Cc: Keir Fraser; Wei, Gang
>> Subject: [Xen-devel] Avoid alloc for xsave before xsave_init
>> 
>> While debugging some weird booting failure bugs, just found
>> currently, xsave_alloc_save_area will be called in
>> init_idle_domain->scheduler_init->alloc_vcpu->vcpu_initialise calls,
>> it is earlier than xsave_init called in identity_cpu(). This may
>> causing buffer overflow on xmem_pool. I am thinking about how to fix it.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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