From adfff05db3aed969677eeff27832ea557b483469 Mon Sep 17 00:00:00 2001 From: "Justin M. Forbes" Date: Thu, 11 Nov 2010 08:49:27 -0600 Subject: [PATCH] fix regression with cmpxchg8b on i386 hosts (rhbz#650215) --- kernel.spec | 8 ++- ...ression-with-cmpxchg8b-on-i386-hosts.patch | 70 +++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 kvm-fix-regression-with-cmpxchg8b-on-i386-hosts.patch diff --git a/kernel.spec b/kernel.spec index e3a6cd99f..af698e59e 100644 --- a/kernel.spec +++ b/kernel.spec @@ -48,7 +48,7 @@ Summary: The Linux kernel # reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec). # scripts/rebase.sh should be made to do that for you, actually. # -%global baserelease 53 +%global baserelease 54 %global fedora_build %{baserelease} # base_sublevel is the kernel version we're starting with and patching @@ -656,6 +656,8 @@ Patch800: linux-2.6-crash-driver.patch # virt + ksm patches Patch1555: fix_xen_guest_on_old_EC2.patch +# Already upstream (commit 16518d5ada690643453eb0aef3cc7841d3623c2d) +Patch1556: kvm-fix-regression-with-cmpxchg8b-on-i386-hosts.patch # DRM Patch1801: drm-polling-fixes.patch @@ -1314,6 +1316,7 @@ ApplyPatch linux-2.6-e1000-ich9-montevina.patch # Assorted Virt Fixes ApplyPatch fix_xen_guest_on_old_EC2.patch +ApplyPatch kvm-fix-regression-with-cmpxchg8b-on-i386-hosts.patch ApplyPatch drm-polling-fixes.patch ApplyPatch drm-simplify-i2c-config.patch @@ -2019,6 +2022,9 @@ fi # and build. %changelog +* Wed Nov 10 2010 Justin M. Forbes 2.6.35.8-54 +- fix regression with cmpxchg8b on i386 hosts (rhbz#650215) + * Wed Nov 10 2010 Jarod Wilson 2.6.35.8-53 - Linux 2.6.35.8 - Drop patches upstreamed in 2.6.35.8 diff --git a/kvm-fix-regression-with-cmpxchg8b-on-i386-hosts.patch b/kvm-fix-regression-with-cmpxchg8b-on-i386-hosts.patch new file mode 100644 index 000000000..0d06ff26e --- /dev/null +++ b/kvm-fix-regression-with-cmpxchg8b-on-i386-hosts.patch @@ -0,0 +1,70 @@ +commit 16518d5ada690643453eb0aef3cc7841d3623c2d +Author: Avi Kivity +Date: Thu Aug 26 14:31:30 2010 +0300 + + KVM: x86 emulator: fix regression with cmpxchg8b on i386 hosts + + operand::val and operand::orig_val are 32-bit on i386, whereas cmpxchg8b + operands are 64-bit. + + Fix by adding val64 and orig_val64 union members to struct operand, and + using them where needed. + + Signed-off-by: Avi Kivity + Signed-off-by: Marcelo Tosatti + +@@ -, +, @@ + arch/x86/include/asm/kvm_emulate.h | 10 +++++++++- + arch/x86/kvm/emulate.c | 9 ++++----- + 2 files changed, 13 insertions(+), 6 deletions(-) +--- a/arch/x86/include/asm/kvm_emulate.h ++++ a/arch/x86/include/asm/kvm_emulate.h +@@ -143,7 +143,15 @@ struct x86_emulate_ops { + struct operand { + enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type; + unsigned int bytes; +- unsigned long val, orig_val, *ptr; ++ union { ++ unsigned long orig_val; ++ u64 orig_val64; ++ }; ++ unsigned long *ptr; ++ union { ++ unsigned long val; ++ u64 val64; ++ }; + }; + + struct fetch_cache { +--- a/arch/x86/kvm/emulate.c ++++ a/arch/x86/kvm/emulate.c +@@ -1712,17 +1712,16 @@ static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt, + struct x86_emulate_ops *ops) + { + struct decode_cache *c = &ctxt->decode; +- u64 old = c->dst.orig_val; ++ u64 old = c->dst.orig_val64; + + if (((u32) (old >> 0) != (u32) c->regs[VCPU_REGS_RAX]) || + ((u32) (old >> 32) != (u32) c->regs[VCPU_REGS_RDX])) { +- + c->regs[VCPU_REGS_RAX] = (u32) (old >> 0); + c->regs[VCPU_REGS_RDX] = (u32) (old >> 32); + ctxt->eflags &= ~EFLG_ZF; + } else { +- c->dst.val = ((u64)c->regs[VCPU_REGS_RCX] << 32) | +- (u32) c->regs[VCPU_REGS_RBX]; ++ c->dst.val64 = ((u64)c->regs[VCPU_REGS_RCX] << 32) | ++ (u32) c->regs[VCPU_REGS_RBX]; + + ctxt->eflags |= EFLG_ZF; + } +@@ -2535,7 +2534,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) + ctxt->vcpu); + if (rc != X86EMUL_CONTINUE) + goto done; +- c->src.orig_val = c->src.val; ++ c->src.orig_val64 = c->src.val64; + } + + if (c->src2.type == OP_MEM) {