Re: [PATCH]: KVM: Fix cmpxchg for writeback changes

Avi Kivity
2007-07-25T09:34:02Z

Aurelien Jarno wrote:
> KVM: Fix writeback for cmpxchg instruction
>
> The writeback fixes (02c03a326a5df825cc01de426f72e160db2b9538) broke
> cmpxchg emulation. The patch below fixes that.
>
> Signed-off-by: Aurelien Jarno <aurelien-rXXEIb44qovR7s880joybQ@public.gmane.org>
>
> diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
> index 21ce977..9d30d10 100644
> --- a/drivers/kvm/x86_emulate.c
> +++ b/drivers/kvm/x86_emulate.c
> @@ -1275,7 +1275,7 @@ twobyte_insn:
> src.val = _regs[VCPU_REGS_RAX];
> emulate_2op_SrcV("cmp", src, dst, _eflags);
> /* Always write back. The question is: where to? */
> - d |= Mov;
> + no_wb = 0;
> if (_eflags & EFLG_ZF) {
> /* Success: write back to memory. */
> dst.val = src.orig_val;
>
>

But no_wb defaults to zero?

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.