This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Atomic operations

To: Timothy Hayes <hayesti@xxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Atomic operations
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Thu, 26 Mar 2009 07:25:08 +0000
Delivery-date: Thu, 26 Mar 2009 00:25:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <f6ed2720903251717s29513990ra9352cc4698042f1@xxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcmtqHZ4galO9UXWT3iY8AoM8vANQAAO4cU+
Thread-topic: [Xen-devel] Atomic operations
User-agent: Microsoft-Entourage/
The Linux atomic.h operations will be atomic even across domains.

 -- Keir

On 26/03/2009 00:17, "Timothy Hayes" <hayesti@xxxxxx> wrote:

I'm sure a lot of you know XenSocket (XVMSocket), if not, it's a Loadable Kernel Module with a socket interface that sends/receives to/from a shared page of memory mapped between two domains. It's quite a nice idea and brings data throughput close to UNIX sockets. I made some changes and made it compatible with Xen 3.2 and a newer Linux kernel (I'm testing it with however I'm noticing some odd behaviour occasionally. In it, there are atomic_t variables in a descriptor inside a shared memory page. When a domain sends or receives from the socket, it will use one of the atomic_ operations to update the amount of new data available. The problem I'm noticing is that when two domains are concurrently updating this variable, the value becomes inconsistent leading me to believe that the atomic_ operations might not guarantee atomicity between domains. I haven't been able to repeat any behaviour like this when I limit the two guests to the same physical CPU and eliminate parallelism.

Would anyone be able fill me in if I'm missing something? Are the atomic_ operations 100% foolproof for this sort of thing? If not, what would be the best approach to use instead?
Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>