diff mbox

[v2,02/19] x86/emul: Drop X86EMUL_CMPXCHG_FAILED

Message ID 1480331616-6165-3-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Cooper Nov. 28, 2016, 11:13 a.m. UTC
X86EMUL_CMPXCHG_FAILED was introduced in c/s d430aae25 in 2005.  Even at the
time it alised what is now X86EMUL_RETRY (as well as what is now
X86EMUL_EXCEPTION).  I am not sure why the distinction was considered useful
at the time.

It is only used twice; there is no need to call it out differently from other
uses of X86EMUL_RETRY.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>

v2:
 * New
---
 xen/arch/x86/mm.c                      | 2 +-
 xen/arch/x86/mm/shadow/multi.c         | 2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h | 2 --
 3 files changed, 2 insertions(+), 4 deletions(-)

Comments

Tim Deegan Nov. 28, 2016, 11:55 a.m. UTC | #1
At 11:13 +0000 on 28 Nov (1480331599), Andrew Cooper wrote:
> X86EMUL_CMPXCHG_FAILED was introduced in c/s d430aae25 in 2005.  Even at the
> time it alised what is now X86EMUL_RETRY (as well as what is now
> X86EMUL_EXCEPTION).  I am not sure why the distinction was considered useful
> at the time.
> 
> It is only used twice; there is no need to call it out differently from other
> uses of X86EMUL_RETRY.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Tim Deegan <tim@xen.org>
Jan Beulich Nov. 29, 2016, 3:29 p.m. UTC | #2
>>> On 28.11.16 at 12:13, <andrew.cooper3@citrix.com> wrote:
> X86EMUL_CMPXCHG_FAILED was introduced in c/s d430aae25 in 2005.  Even at the
> time it alised what is now X86EMUL_RETRY (as well as what is now
> X86EMUL_EXCEPTION).  I am not sure why the distinction was considered useful
> at the time.

I have always guessed that this is so one could make them have
distinct values if need be, since "cmpxchg failure" does not
necessarily mean "retry" to all possible callers. So I'm not fully
convinced this is a good move, but I'm also not worried enough
to really object.

> It is only used twice; there is no need to call it out differently from other
> uses of X86EMUL_RETRY.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 03dcd71..5b0e9f3 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5254,7 +5254,7 @@  static int ptwr_emulated_update(
         {
             unmap_domain_page(pl1e);
             put_page_from_l1e(nl1e, d);
-            return X86EMUL_CMPXCHG_FAILED;
+            return X86EMUL_RETRY;
         }
     }
     else
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index d70b1c6..9ee48a8 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4694,7 +4694,7 @@  sh_x86_emulate_cmpxchg(struct vcpu *v, unsigned long vaddr,
     }
 
     if ( prev != old )
-        rv = X86EMUL_CMPXCHG_FAILED;
+        rv = X86EMUL_RETRY;
 
     SHADOW_DEBUG(EMULATE, "va %#lx was %#lx expected %#lx"
                   " wanted %#lx now %#lx bytes %u\n",
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 993c576..ec824ce 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -109,8 +109,6 @@  struct __attribute__((__packed__)) segment_register {
 #define X86EMUL_EXCEPTION      2
  /* Retry the emulation for some reason. No state modified. */
 #define X86EMUL_RETRY          3
- /* (cmpxchg accessor): CMPXCHG failed. Maps to X86EMUL_RETRY in caller. */
-#define X86EMUL_CMPXCHG_FAILED 3
 
 /* FPU sub-types which may be requested via ->get_fpu(). */
 enum x86_emulate_fpu_type {