diff options
author | Keir Fraser <keir@xen.org> | 2011-01-14 08:34:53 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2011-01-14 08:34:53 +0000 |
commit | 5a96732bd4101281bc1c609a08688cc87de61b26 (patch) | |
tree | 69738083a4658df044494c7fef153ca0d1cf9a90 /xen/include/asm-x86/i387.h | |
parent | 91fa20635ad51008527345579467687a2ccb168e (diff) | |
download | xen-5a96732bd4101281bc1c609a08688cc87de61b26.tar.gz xen-5a96732bd4101281bc1c609a08688cc87de61b26.tar.bz2 xen-5a96732bd4101281bc1c609a08688cc87de61b26.zip |
x86: Avoid calling xsave_alloc_save_area before xsave_init
Currently, xsave_alloc_save_area will be called in
init_idle_domain->scheduler_init->alloc_vcpu->vcpu_initialise calls
with xsave_cntxt_size=0, it is earlier than xsave_init called in
identity_cpu(). This may causing buffer overflow on xmem_pool.
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.
Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/asm-x86/i387.h')
-rw-r--r-- | xen/include/asm-x86/i387.h | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/xen/include/asm-x86/i387.h b/xen/include/asm-x86/i387.h index 4cb67d482c..8b4e9ce1bd 100644 --- a/xen/include/asm-x86/i387.h +++ b/xen/include/asm-x86/i387.h @@ -110,6 +110,7 @@ static inline void xrstor(struct vcpu *v) : "m" (*ptr), "a" (-1), "d" (-1), "D"(ptr)); } +extern void setup_fpu(struct vcpu *v); extern void init_fpu(void); extern void save_init_fpu(struct vcpu *v); extern void restore_fpu(struct vcpu *v); @@ -124,35 +125,4 @@ extern void restore_fpu(struct vcpu *v); __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \ } while ( 0 ) -static inline void setup_fpu(struct vcpu *v) -{ - /* Avoid recursion. */ - clts(); - - if ( !v->fpu_dirtied ) - { - v->fpu_dirtied = 1; - if ( cpu_has_xsave ) - { - if ( !v->fpu_initialised ) - v->fpu_initialised = 1; - - /* XCR0 normally represents what guest OS set. In case of Xen - * itself, we set all supported feature mask before doing - * save/restore. - */ - set_xcr0(v->arch.xcr0_accum); - xrstor(v); - set_xcr0(v->arch.xcr0); - } - else - { - if ( v->fpu_initialised ) - restore_fpu(v); - else - init_fpu(); - } - } -} - #endif /* __ASM_I386_I387_H */ |