qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Damhet <antoine.damhet@blade-group.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [BUG] Migration hv_time rollback
Date: Wed, 16 Sep 2020 15:25:03 +0200	[thread overview]
Message-ID: <20200916132503.mrfdjaghblkhxocd@tartarus> (raw)
In-Reply-To: <875z8dj367.fsf@vitty.brq.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

On Wed, Sep 16, 2020 at 02:50:56PM +0200, Vitaly Kuznetsov wrote:
[...]

> >>
> >
> >
> > Oh, I think I see what's going on. When you add 'kvm=off'
> > cpu->env.features[FEAT_KVM] is reset (see x86_cpu_expand_features()) so
> > kvmclock QEMU device is not created and nobody calls KVM_SET_CLOCK on
> > migration.
> >
> > In case we really want to support 'kvm=off' I think we can add Hyper-V
> > features check here along with KVM, this should do the job.
> 
> Does the untested
> 
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 64283358f91d..e03b2ca6d8f6 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -333,8 +333,9 @@ void kvmclock_create(void)
>      X86CPU *cpu = X86_CPU(first_cpu);
>  
>      if (kvm_enabled() &&
> -        cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
> -                                       (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
> +        ((cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
> +                                         (1ULL << KVM_FEATURE_CLOCKSOURCE2))) ||
> +         (cpu->env.features[FEAT_HYPERV_EAX] & HV_TIME_REF_COUNT_AVAILABLE))) {
>          sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
>      }
>  }
> 
> help?

It appears to work :)

> 
> (I don't think we need to remove all 'if (kvm_enabled())' checks from
> machine types as 'kvm=off' should not be related).

Indeed (I didn't look at the macro, it was just quick & dirty).

> 
> -- 
> Vitaly
> 
> 

-- 
Antoine 'xdbob' Damhet

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-09-16 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  9:06 [BUG] Migration hv_time rollback Antoine Damhet
2020-09-16 11:29 ` Dr. David Alan Gilbert
2020-09-16 11:59   ` Vitaly Kuznetsov
2020-09-16 12:14     ` Antoine Damhet
2020-09-16 11:59   ` Antoine Damhet
2020-09-16 12:16     ` Vitaly Kuznetsov
2020-09-16 12:50       ` Vitaly Kuznetsov
2020-09-16 13:25         ` Antoine Damhet [this message]
2020-09-16 13:05   ` Paolo Bonzini
2020-09-16 13:17     ` Vitaly Kuznetsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916132503.mrfdjaghblkhxocd@tartarus \
    --to=antoine.damhet@blade-group.com \
    --cc=dgilbert@redhat.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).