From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@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, 02 Aug 2012 18:52:35 +0300 [thread overview]
Message-ID: <501AA243.1050807@redhat.com> (raw)
In-Reply-To: <20120802154358.GA13626@amt.cnet>
On 08/02/2012 06:43 PM, Marcelo Tosatti wrote:
> 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?
>
Yeah. Though why are we writing flags at all then?
We could write it one during init and leave it there (not that it matters).
Anyway, patch is fine.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-08-02 15:52 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
2012-08-02 15:52 ` Avi Kivity [this message]
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=501AA243.1050807@redhat.com \
--to=avi@redhat.com \
--cc=amit.shah@redhat.com \
--cc=emunson@mgebm.net \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.