diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-02-24 09:07:54 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-02-24 09:07:54 +0100 |
commit | e1dc98e3c3619cf7a050cc898ecb9288eceb5915 (patch) | |
tree | 0acf478885bffcdf4584716e62ff7fc87f799d6a /xen/arch/x86/domctl.c | |
parent | b272353fe98db5bdc73fff3c60a0574835df4c87 (diff) | |
download | xen-e1dc98e3c3619cf7a050cc898ecb9288eceb5915.tar.gz xen-e1dc98e3c3619cf7a050cc898ecb9288eceb5915.tar.bz2 xen-e1dc98e3c3619cf7a050cc898ecb9288eceb5915.zip |
x86/vMCE: save/restore MCA capabilities
This allows migration to a host with less MCA banks than the source
host had, while without this patch accesses to the excess banks' MSRs
caused #GP-s in the guest after migration (and it depended on the guest
kernel whether this would be fatal).
A fundamental question is whether we should also save/restore MCG_CTL
and MCi_CTL, as the HVM save record would better be defined to the
complete state that needs saving from the beginning (I'm unsure whether
the save/restore logic allows for future extension of an existing
record).
Of course, this change is expected to make migration from new to older
Xen impossible (again I'm unsure what the save/restore logic does with
records it doesn't even know about).
The (trivial) tools side change may seem unrelated, but the code should
have been that way from the beginning to allow the hypervisor to look
at currently unused ext_vcpucontext fields without risking to read
garbage when those fields get a meaning assigned in the future. This
isn't being enforced here - should it be? (Obviously, for backwards
compatibility, the hypervisor must assume these fields to be clear only
when the extended context's size exceeds the old original one.)
A future addition to this change might be to allow configuration of the
number of banks and other MCA capabilities for a guest before it starts
(i.e. to not inherits the values seen on the first host it runs on).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/domctl.c')
-rw-r--r-- | xen/arch/x86/domctl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 87962ca95f..5bc2d41854 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1029,11 +1029,12 @@ long arch_do_domctl( evc->syscall32_callback_eip = 0; evc->syscall32_disables_events = 0; } + evc->mcg_cap = v->arch.mcg_cap; } else { ret = -EINVAL; - if ( evc->size != sizeof(*evc) ) + if ( evc->size < offsetof(typeof(*evc), mcg_cap) ) goto ext_vcpucontext_out; #ifdef __x86_64__ if ( !is_hvm_domain(d) ) @@ -1061,6 +1062,10 @@ long arch_do_domctl( (evc->syscall32_callback_cs & ~3) || evc->syscall32_callback_eip ) goto ext_vcpucontext_out; + + if ( evc->size >= offsetof(typeof(*evc), mcg_cap) + + sizeof(evc->mcg_cap) ) + ret = vmce_restore_vcpu(v, evc->mcg_cap); } ret = 0; |