xen-devel
Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation
To: |
Jeremy Fitzhardinge <jeremy@xxxxxxxx> |
Subject: |
Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation |
From: |
Avi Kivity <avi@xxxxxxxxxx> |
Date: |
Sat, 10 Oct 2009 20:10:03 +0200 |
Cc: |
Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, kurt.hackel@xxxxxxxxxx, the arch/x86 maintainers <x86@xxxxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Glauber de Oliveira Costa <gcosta@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Zach Brown <zach.brown@xxxxxxxxxx>, Chris Mason <chris.mason@xxxxxxxxxx> |
Delivery-date: |
Sat, 10 Oct 2009 11:11:27 -0700 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<4ACFD43E.6000506@xxxxxxxx> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
References: |
<1254790211-15416-1-git-send-email-jeremy.fitzhardinge@xxxxxxxxxx> <1254790211-15416-4-git-send-email-jeremy.fitzhardinge@xxxxxxxxxx> <4ACB0833.2050203@xxxxxxxxxx> <4ACB9074.1000804@xxxxxxxx> <4ACC6C9C.7080707@xxxxxxxxxx> <4ACFD43E.6000506@xxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 |
On 10/10/2009 02:24 AM, Jeremy Fitzhardinge wrote:
On 10/07/09 03:25, Avi Kivity wrote:
def try_pvclock_vtime():
tsc, p0 = rdtscp()
v0 = pvclock[p0].version
tsc, p = rdtscp()
t = pvclock_time(pvclock[p], tsc)
if p != p0 or pvclock[p].version != v0:
raise Exception("Processor or timebased change under our feet")
return t
This doesn't quite work.
If we end up migrating some time after the first rdtscp, then the
accesses to pvclock[] will be cross-cpu. Since we don't made any strong
SMP memory ordering guarantees on updating the structure, the snapshot
isn't guaranteed to be consistent even if we re-check the version at the
end.
We only hit this if we have a double migration, otherwise we see p != p0.
Most likely all existing implementations do have a write barrier on the
guest entry path, so if we add a read barrier between the two compares,
that ensures we're reading from the same cpu again.
So to use rdtscp we need to either redefine the update of
pvclock_vcpu_time_info to be SMP-safe, or keep the additional migration
check.
I think we can update the ABI after verifying all implementations do
have a write barrier.
--
Do not meddle in the internals of kernels, for they are subtle and quick to
panic.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, (continued)
- RE: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Dan Magenheimer
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Avi Kivity
- RE: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Dan Magenheimer
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Jeremy Fitzhardinge
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation,
Avi Kivity <=
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Jeremy Fitzhardinge
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Avi Kivity
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Jeremy Fitzhardinge
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Avi Kivity
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Jeremy Fitzhardinge
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Avi Kivity
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Jeremy Fitzhardinge
- RE: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Dan Magenheimer
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Jeremy Fitzhardinge
- Re: [Xen-devel] Re: [PATCH 3/5] x86/pvclock: add vsyscall implementation, Avi Kivity
|
|
|