WARNING - OLD ARCHIVES

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/
Xen

xen-devel

[Top] [All Lists]

[Xen-devel] [Patch] cmpxchg emulation returns wrong ZF

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [Patch] cmpxchg emulation returns wrong ZF
From: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Date: 2009年8月06日 08:49:15 +0200
Delivery-date: 2009年8月05日 23:49:43 -0700
Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=ts.fujitsu.com; i=juergen.gross@xxxxxxxxxxxxxx; q=dns/txt; s=s1536b; t=1249541352; x=1281077352; h=from:sender:reply-to:subject:date:message-id:to:cc: mime-version:content-transfer-encoding:content-id: content-description:resent-date:resent-from:resent-sender: resent-to:resent-cc:resent-message-id:in-reply-to: references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:list-owner:list-archive; z=From:=20Juergen=20Gross=20<juergen.gross@xxxxxxxxxxxxxx> |Subject:=20[Patch]=20cmpxchg=20emulation=20returns=20wro ng=20ZF|Date:=20Thu,=2006=20Aug=202009=.&checktime(2008,49,15,':')=20+0200 |Message-ID:=20<4A7A7CEB.9080702@xxxxxxxxxxxxxx>|To:=20"x en-devel@xxxxxxxxxxxxxxxxxxx"=20<xen-devel@xxxxxxxxxxxxxx e.com>|MIME-Version:=201.0; bh=Qu+SKCD+K+CK1N20QduuGXKwRJEeaVJL/1HSnzykBJQ=; b=l5UyqqUSmyho7bpPPY2PMkdQ8gzT9l1lhvP7OIvkIOFZxNI+Kyn4S2yA KKZmW66Wy/WHtuskR2KkUnYms7Y6eMuztNKLHxJkGjBaBbTK8jnLG7rW6 sYKrSRSEd2SKaR4TFGXMYSoPTy+USAt2Tje0u68RwRHokgCG0mA8jIWwm 4uYWig1mXFbPUaJa/6Svr6L3wnEaqCQUroFBtL2CKRzpeyoPzlBpR1l0q YBRe4754DLX9qxZNOhe8rkNFWdla9;
Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:Message-ID:Date:From:Organization: User-Agent:MIME-Version:To:Subject:X-Enigmail-Version: Content-Type; b=oxOxPCOLxVc4SNnmUR8o3ElQvxysNyPg3jmxaypKvpXh5G+wc4LA3L6T X7tM9gcw5nSFNygrQPBFTCvI5aabIySgAXujkYj04mP4rOJtCpUdP8LhL WTg9XfmONtr8MBcF6PUHbWpkjUg3U6uX4BJMEVBnSRF04zHErfQWTuaNa R7FT8vRD+d6HCJ3LBsp2Grk86U/vja4KVyIOiY4g5OANQq5ervwstaI8t QkO4q58tN38Z4eUHAe73YpoqeomXp;
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Organization: Fujitsu Technology Solutions
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707)
Hi,
attached patch corrects a bug in cmpxchg emulation in the hypervisor.
BS2000 running as HVM-domain on 4 vcpus (no HAP) hit an error due to this bug
after several days.
Juergen
-- 
Juergen Gross Principal Developer Operating Systems
TSP ES&S SWE OS6 Telephone: +49 (0) 89 636 47950
Fujitsu Technolgy Solutions e-mail: juergen.gross@xxxxxxxxxxxxxx
Otto-Hahn-Ring 6 Internet: ts.fujitsu.com
D-81739 Muenchen Company details: ts.fujitsu.com/imprint.html
The cmpxchg emulation for accesses to page tables of guests doesn't handle
races correct.
ops->cmpxchg might return X86EMUL_CMPXCHG_FAILED if the addressed memory
location changed after checking the old contents. In this case ZF was not
changed and could remain 1 instead of being set to 0.
Signed-off-by: juergen.gross@xxxxxxxxxxxxxx
# HG changeset patch
# User juergen.gross@xxxxxxxxxxxxxx
# Date 1249540842 -7200
# Node ID 26adbdb6cb1d59d95e0a65b6a0d38fa8e95b9f51
# Parent 68e8b8379244e293c55875e7dc3692fc81d3d212
handle race on cmpxchg emulation
diff -r 68e8b8379244 -r 26adbdb6cb1d xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c Sun Aug 02 13:43:15 2009 +0100
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c Thu Aug 06 08:40:42 2009 +0200
@@ -4124,6 +4124,7 @@
 op_bytes *= 2;
 
 /* Get actual old value. */
+cmpxchg_failed:
 for ( i = 0; i < (op_bytes/sizeof(long)); i++ )
 if ( (rc = read_ulong(ea.mem.seg, ea.mem.off + i*sizeof(long),
 &old[i], sizeof(long), ctxt, ops)) != 0 )
@@ -4151,10 +4152,13 @@
 else
 {
 /* Expected == actual: attempt atomic cmpxchg and set ZF. */
- if ( (rc = ops->cmpxchg(ea.mem.seg, ea.mem.off, old,
- new, op_bytes, ctxt)) != 0 )
- goto done;
- _regs.eflags |= EFLG_ZF;
+ rc = ops->cmpxchg(ea.mem.seg, ea.mem.off, old, new, op_bytes, 
ctxt);
+ if ( rc == 0 )
+ _regs.eflags |= EFLG_ZF;
+ else if ( rc == X86EMUL_CMPXCHG_FAILED )
+ goto cmpxchg_failed;
+ else
+ goto done;
 }
 break;
 }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: [Xen-devel] Re: With latest Qemu and Xen-3.4, VT-d does not work , Keir Fraser
Next by Date: RE: [Xen-devel] kernel BUG at arch/x86/xen/multicalls.c:103! , Olivier NOEL
Previous by Thread: [Xen-devel] With latest Qemu and Xen-3.4, VT-d does not work , Xu, Dongxiao
Next by Thread: Re: [Xen-devel] [Patch] cmpxchg emulation returns wrong ZF , Jan Beulich
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /