[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Emulation of cmpxchg in Xen 4.2 (also possible bug)


  • To: "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
  • From: Ruslan Nikolaev <nruslan_devel@xxxxxxxxx>
  • Date: Tue, 2 Oct 2012 21:14:07 -0700 (PDT)
  • Delivery-date: Wed, 03 Oct 2012 04:14:36 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=tjGHD4MN0slqxn56UJOqhQeY/uysRzUhI6yRtcgJ1jIelq9J6BLGQz6MIN7uHyP6A+lyIterLLVarUh/PQVOlCaRLXfTyQtNdTHLbj3SHP8SYSuB/uQMp6tbdkezQtGi3Fav2hxlC0KrdmIdxUMpKZEb2UL+serBtGJfP/rFx28=;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Just one clarification to my message below:

I am using a shared page between DomU HVM and Dom0. (This is used as a shared 
buffer and cmpxchg changes atomic variable there.)

Ruslan



----- Original Message -----
From: Ruslan Nikolaev <nruslan_devel@xxxxxxxxx>
To: "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
Cc: 
Sent: Wednesday, October 3, 2012 12:09 AM
Subject: Emulation of cmpxchg in Xen 4.2 (also possible bug)

Hi

While experimenting with a heavy testload which makes a lot of CMPXCHG in PVHVM 
domain (DomU) and Dom0, I noticed inconsistency (I am using official Xen 4.2 
release):

Dom0's cmpxchg succeeds (i.e. set ZF flag appropriately) changing Val1 to Val2

PVHVM DomU cmpxchg also succeeds changing Val1 to Val3 even though it was 
supposedly replaced (Val1 to Val2, Val1 != Val2) by Dom0 already

I double checked my code and it seems to be fine. Moreover, the problem appears 
only on a high contention case (when both Dom0 and DomU are trying to change 
it).

While investigating the issue, I noticed that Xen emulates cmpxchg for PV and 
HVM cases:

1. Why is it needed to emulate CMPXCHG at all? (What is it used for and can it 
be disabled? I am using Linux guests.)

2. Is it emulated only in HVM DomU domain or in Dom0 as well?3. Is it possible 
that emulation has some bug? Is it possible to somehow avoid emulation at all 
and replace it with something? (I want to avoid performance overhead for this 
instruction) What if I use CMPXCHG16B, does it still use emulation?

Ruslan.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.