public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Liran Alon <liran.alon@oracle.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org, idan.brown@oracle.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH] KVM: x86: pvclock: Handle first-time write to pvclock-page contains random junk
Date: Fri, 10 Nov 2017 22:36:23 +0100	[thread overview]
Message-ID: <20171110213622.GC2189@flask> (raw)
In-Reply-To: <1509891090-8985-1-git-send-email-liran.alon@oracle.com>

2017-11-05 16:11+0200, Liran Alon:
> When guest passes KVM it's pvclock-page GPA via WRMSR to
> MSR_KVM_SYSTEM_TIME / MSR_KVM_SYSTEM_TIME_NEW, KVM don't initialize
> pvclock-page to some start-values. It just requests a clock-update which
> will happen before entering to guest.
> 
> The clock-update logic will call kvm_setup_pvclock_page() to update the
> pvclock-page with info. However, kvm_setup_pvclock_page() *wrongly*
> assumes that the version-field is initialized to an even number. This is
> wrong because at first-time write, field could be any-value.
> 
> Fix simply makes sure that if first-time version-field is odd, increment
> it once more to make it even and only then start standard logic.
> This follows same logic as done in other pvclock shared-pages (See
> kvm_write_wall_clock() and record_steal_time()).
> 
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---

Applied, thanks.

  parent reply	other threads:[~2017-11-10 21:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05 14:11 [PATCH] KVM: x86: pvclock: Handle first-time write to pvclock-page contains random junk Liran Alon
2017-11-06  9:13 ` Paolo Bonzini
2017-11-10 21:36 ` Radim Krčmář [this message]
2017-11-13  0:40 ` Wanpeng Li
2017-11-13  0:44   ` Liran Alon
2017-11-13  0:52     ` Wanpeng Li
2017-11-13  0:55       ` Liran Alon
2017-11-13  1:03         ` Wanpeng Li
2017-11-13  1:37           ` Wanpeng Li
2017-11-13  5:53             ` Wanpeng Li

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=20171110213622.GC2189@flask \
    --to=rkrcmar@redhat.com \
    --cc=idan.brown@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=pbonzini@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