public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
	Avi Kivity <avi@qumranet.com>,
	Glauber de Oliveira Costa <gcosta@redhat.com>
Subject: Re: pv clock: kvm is incompatible with xen :-(
Date: Mon, 21 Apr 2008 21:46:10 +1000	[thread overview]
Message-ID: <480C7E82.1010402@goop.org> (raw)
In-Reply-To: <480C42E0.3040307@redhat.com>

Gerd Hoffmann wrote:
> Hmm, I somehow fail to see a case where it could be non-atomic ...
>
> get_time_values() copies a consistent snapshot, thus
> xen_clocksource_read() doesn't race against xen updating the fields.
> The snapshot is in a per-cpu variable, thus it doesn't race against
> other guest vcpus running get_time_values() at the same time.
>   

Xen could change the parameters in the instant after get_time_values().  
That change could be as a result of suspend-resume, so the parameters 
and the tsc could be wildly different.  It's definitely an edge-case, 
but it's easy enough to deal with.

>> There could be a loopless
>> __get_time_values() for use in this case, but given that it almost never
>> loops, I don't think its worthwhile.
>>     
>
> "in this case" ???  I'm confused.  There is only a single user of
> get_nsec_offset(), which is xen_clocksource_read() ...
>   

Sure, but get_time_values() has several other callers.  If 
xen_clocksource_read() had its own loop to make sure the read_tsc is 
atomic with respect to get_time_values, then get_time_values itself 
needn't loop.  But, given that it only loops in the very rare case that 
it races with Xen updating those parameters, it doesn't seem to make 
much difference either way.

    J

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  reply	other threads:[~2008-04-21 11:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11  7:33 pv clock: kvm is incompatible with xen :-( Gerd Hoffmann
2008-04-11 12:06 ` Avi Kivity
2008-04-11 13:44   ` Gerd Hoffmann
2008-04-11 15:01     ` Gerd Hoffmann
2008-04-11 19:02     ` Jeremy Fitzhardinge
2008-04-18 14:26       ` Gerd Hoffmann
2008-04-18 22:23         ` Jeremy Fitzhardinge
2008-04-21  7:31           ` Gerd Hoffmann
2008-04-21 11:46             ` Jeremy Fitzhardinge [this message]
2008-04-21 12:50               ` Gerd Hoffmann
2008-04-21 13:34                 ` Jeremy Fitzhardinge
2008-04-21 14:20                   ` Gerd Hoffmann
2008-04-22 17:54                 ` Glauber Costa
2008-04-23  6:03                   ` Gerd Hoffmann
2008-04-24 12:57                     ` Glauber Costa

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=480C7E82.1010402@goop.org \
    --to=jeremy@goop.org \
    --cc=avi@qumranet.com \
    --cc=gcosta@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /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