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 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [Patch] cmpxchg emulation returns wrong ZF
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Thu, 06 Aug 2009 09:12:48 +0100
Cc:
Delivery-date: Thu, 06 Aug 2009 01:14:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4A7A7CEB.9080702@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: AcoWYhWF4o7Dnn2WRlyfPGcu2Ve2zQAC5mvT
Thread-topic: [Xen-devel] [Patch] cmpxchg emulation returns wrong ZF
User-agent: Microsoft-Entourage/12.20.0.090605
On 06/08/2009 07:49, "Juergen Gross" <juergen.gross@xxxxxxxxxxxxxx> wrote:

> 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.

You'll have to give more details as I don't see the bug that this patch
fixes. Changeset comment says "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." Now, firstly the patch does not directly alter
ZF when X86EMUL_CMPXCHG_FAILED. Secondly, the X86EMUL_CMPXCHG_FAILED is
supposed to be safe to propagate to the caller of x86_emulate(), who can
then choose to retry. Most callers implicitly retry by treating similar to
X86EMUL_OKAY -- returning to guest context where the instruction gets
reattempted due to EIP not having changed. That last point is crucial to the
correctness of course: Indeed we are not messing with EFLAGS.ZF on that
return code, but then we are not updating *any* state (including the program
counter) so it is supposed to be as if the instruction was not executed
(which is obviously correct, since it wasn't).

 -- Keir



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>