mbox series

[0/3] i386: Make sure TSC frequency is preserved across migration when Hyper-V reenlightenment is in use

Message ID 20210318160249.1084178-1-vkuznets@redhat.com (mailing list archive)
Headers show
Series i386: Make sure TSC frequency is preserved across migration when Hyper-V reenlightenment is in use | expand

Message

Vitaly Kuznetsov March 18, 2021, 4:02 p.m. UTC
KVM doesn't fully support Hyper-V reenlightenment notifications on
migration. In particular, it doesn't support emulating TSC frequency
of the source host by trapping all TSC accesses so unless TSC scaling
is supported on the destination host and KVM_SET_TSC_KHZ succeeded, it
is unsafe to proceed with migration.

Vitaly Kuznetsov (3):
  i386: Make Hyper-V related sections KVM only
  i386: Fix 'hypercall_hypercall' typo
  i386: Make sure kvm_arch_set_tsc_khz() succeeds on migration when
    'hv-reenlightenment' was exposed

 target/i386/kvm/hyperv.h |  1 +
 target/i386/kvm/kvm.c    | 11 ++++++++++
 target/i386/machine.c    | 45 ++++++++++++++++++++++++++++++++++++++--
 3 files changed, 55 insertions(+), 2 deletions(-)

Comments

Paolo Bonzini March 18, 2021, 4:06 p.m. UTC | #1
On 18/03/21 17:02, Vitaly Kuznetsov wrote:
> Currently, Hyper-V enlightenments are only implemented by KVM so there's no
> need to have corresponding vmstate_x86_cpu sections when !CONFIG_KVM.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>

I expect WHPX may implement at least some, so I'll leave this out.

Paolo

> ---
>   target/i386/machine.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index 3967dfc25763..a4777a73b0a9 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -697,6 +697,7 @@ static const VMStateDescription vmstate_mpx = {
>       }
>   };
>   
> +#ifdef CONFIG_KVM
>   static bool hyperv_hypercall_enable_needed(void *opaque)
>   {
>       X86CPU *cpu = opaque;
> @@ -895,6 +896,7 @@ static const VMStateDescription vmstate_msr_hyperv_reenlightenment = {
>           VMSTATE_END_OF_LIST()
>       }
>   };
> +#endif
>   
>   static bool avx512_needed(void *opaque)
>   {
> @@ -1484,6 +1486,7 @@ VMStateDescription vmstate_x86_cpu = {
>           &vmstate_msr_ia32_feature_control,
>           &vmstate_msr_architectural_pmu,
>           &vmstate_mpx,
> +#ifdef CONFIG_KVM
>           &vmstate_msr_hypercall_hypercall,
>           &vmstate_msr_hyperv_vapic,
>           &vmstate_msr_hyperv_time,
> @@ -1492,6 +1495,7 @@ VMStateDescription vmstate_x86_cpu = {
>           &vmstate_msr_hyperv_synic,
>           &vmstate_msr_hyperv_stimer,
>           &vmstate_msr_hyperv_reenlightenment,
> +#endif
>           &vmstate_avx512,
>           &vmstate_xss,
>           &vmstate_umwait,
>