qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	Oliver Upton <oupton@google.com>,
	Maxim Levitsky <mlevitsk@redhat.com>
Subject: Re: [PATCH] i386: Fix KVM_CAP_ADJUST_CLOCK capability check
Date: Fri, 07 Oct 2022 11:26:14 +0200	[thread overview]
Message-ID: <87sfk07znt.fsf@redhat.com> (raw)
In-Reply-To: <87wn9pkv6e.fsf@redhat.com>

Vitaly Kuznetsov <vkuznets@redhat.com> writes:

> Vitaly Kuznetsov <vkuznets@redhat.com> writes:
>
>> KVM commit c68dc1b577ea ("KVM: x86: Report host tsc and realtime values in
>> KVM_GET_CLOCK") broke migration of certain workloads, e.g. Win11 + WSL2
>> guest reboots immediately after migration. KVM, however, is not to
>> blame this time. When KVM_CAP_ADJUST_CLOCK capability is checked, the
>> result is all supported flags (which the above mentioned KVM commit
>> enhanced) but kvm_has_adjust_clock_stable() wants it to be
>> KVM_CLOCK_TSC_STABLE precisely. The result is that 'clock_is_reliable'
>> is not set in vmstate and the saved clock reading is discarded in
>> kvmclock_vm_state_change().
>>
>> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
>> ---
>>  target/i386/kvm/kvm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
>> index a1fd1f53791d..c33192a87dcb 100644
>> --- a/target/i386/kvm/kvm.c
>> +++ b/target/i386/kvm/kvm.c
>> @@ -157,7 +157,7 @@ bool kvm_has_adjust_clock_stable(void)
>>  {
>>      int ret = kvm_check_extension(kvm_state, KVM_CAP_ADJUST_CLOCK);
>>  
>> -    return (ret == KVM_CLOCK_TSC_STABLE);
>> +    return ret & KVM_CLOCK_TSC_STABLE;
>>  }
>>  
>>  bool kvm_has_adjust_clock(void)
>
> Ping) This issue seems to introduce major migration issues with KVM >= v5.16

Ping)

-- 
Vitaly



  reply	other threads:[~2022-10-07  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 14:40 [PATCH] i386: Fix KVM_CAP_ADJUST_CLOCK capability check Vitaly Kuznetsov
2022-09-20 18:33 ` Marcelo Tosatti
2022-09-27  9:45 ` Vitaly Kuznetsov
2022-10-07  9:26   ` Vitaly Kuznetsov [this message]
2022-10-07 10:49     ` Paolo Bonzini
2022-10-07 11:53       ` 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=87sfk07znt.fsf@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=oupton@google.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).