From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Amit Shah <amit.shah@redhat.com>,
Eric B Munson <emunson@mgebm.net>
Subject: Re: KVM: x86: fix pvclock guest stopped flag reporting
Date: Thu, 2 Aug 2012 12:43:58 -0300 [thread overview]
Message-ID: <20120802154358.GA13626@amt.cnet> (raw)
In-Reply-To: <501A9FE1.8090209@redhat.com>
On Thu, Aug 02, 2012 at 06:42:25PM +0300, Avi Kivity wrote:
> On 08/02/2012 06:33 PM, Marcelo Tosatti wrote:
> >
> > kvm_guest_time_update unconditionally clears hv_clock.flags field,
> > so the notification never reaches the guest.
> >
> > Fix it by allowing PVCLOCK_GUEST_STOPPED to passthrough.
> >
> > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 3a53bcc..e8ce10f 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -1217,7 +1217,9 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
> > vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
> > vcpu->last_kernel_ns = kernel_ns;
> > vcpu->last_guest_tsc = tsc_timestamp;
> > - vcpu->hv_clock.flags = 0;
> > + /* only support PVCLOCK_GUEST_STOPPED flag ATM */
> > + if (vcpu->hv_clock.flags != PVCLOCK_GUEST_STOPPED)
> > + vcpu->hv_clock.flags = 0;
> >
>
> Seems a little risky. Should we store the flag in a separate bool and
> mix it in instead of RMWing it?
This is not guest memory. Its a host copy, the actual data is copied
(safely via the version mechanism) below in that function.
Are you ok with it now?
next prev parent reply other threads:[~2012-08-02 15:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 15:33 KVM: x86: fix pvclock guest stopped flag reporting Marcelo Tosatti
2012-08-02 15:42 ` Avi Kivity
2012-08-02 15:43 ` Marcelo Tosatti [this message]
2012-08-02 15:52 ` Avi Kivity
2012-08-02 16:00 ` Marcelo Tosatti
2012-08-03 18:57 ` KVM: x86: fix pvclock guest stopped flag reporting (v2) Marcelo Tosatti
2012-08-07 12:16 ` Amit Shah
2012-08-07 13:18 ` Eric B Munson
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=20120802154358.GA13626@amt.cnet \
--to=mtosatti@redhat.com \
--cc=amit.shah@redhat.com \
--cc=avi@redhat.com \
--cc=emunson@mgebm.net \
--cc=kvm@vger.kernel.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).