public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: x86 emulator: add decoding of CMPXCHG8B dst operand.
Date: Sun, 21 Mar 2010 16:46:24 +0200	[thread overview]
Message-ID: <4BA63140.9050809@redhat.com> (raw)
In-Reply-To: <20100321144425.GG13522@redhat.com>

On 03/21/2010 04:44 PM, Gleb Natapov wrote:
> On Sun, Mar 21, 2010 at 04:41:24PM +0200, Avi Kivity wrote:
>    
>> On 03/21/2010 01:08 PM, Gleb Natapov wrote:
>>      
>>> Decode CMPXCHG8B destination operand in decoding stage. Fixes regression
>>> introduced by "If LOCK prefix is used dest arg should be memory" commit.
>>> This commit relies on dst operand be decoded at the beginning of an
>>> instruction emulation.
>>>        
>>      
>>> @@ -1719,15 +1719,12 @@ static inline int emulate_grp9(struct x86_emulate_ctxt *ctxt,
>>>   		c->regs[VCPU_REGS_RAX] = (u32) (old>>   0);
>>>   		c->regs[VCPU_REGS_RDX] = (u32) (old>>   32);
>>>   		ctxt->eflags&= ~EFLG_ZF;
>>> -
>>>   	} else {
>>> -		new = ((u64)c->regs[VCPU_REGS_RCX]<<   32) |
>>> +		c->dst.val = ((u64)c->regs[VCPU_REGS_RCX]<<   32) |
>>>   		       (u32) c->regs[VCPU_REGS_RBX];
>>>
>>> -		rc = ops->cmpxchg_emulated(c->modrm_ea,&old,&new, 8, ctxt->vcpu);
>>> -		if (rc != X86EMUL_CONTINUE)
>>> -			return rc;
>>>   		ctxt->eflags |= EFLG_ZF;
>>> +		c->lock_prefix = 1;
>>>        
>> Why is this bit needed?  cmpxchg64b without lock is valid and racy,
>> but the guest may know it is safe.
>>
>>      
> Agree. Before this patch cmpxchg8b emulation always called
> cmpxchg_emulated(), so to be extra careful I wanted to preserve old
> behaviour. Resend the patch without this line?
>    

Better a 3/2 that removes it.  So we have a large patch that just 
transforms code, and a small patch that corrects an earlier bug.  May 
help a bisector one day.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-03-21 14:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-21 11:08 [PATCH 1/2] KVM: x86 emulator: commit rflags as part of registers commit Gleb Natapov
2010-03-21 11:08 ` [PATCH 2/2] KVM: x86 emulator: add decoding of CMPXCHG8B dst operand Gleb Natapov
2010-03-21 14:41   ` Avi Kivity
2010-03-21 14:44     ` Gleb Natapov
2010-03-21 14:46       ` Avi Kivity [this message]
2010-03-23 12:33   ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2010-03-21 11:06 [PATCH 1/2] KVM: x86 emulator: commit rflags as part of registers commit Gleb Natapov
2010-03-21 11:06 ` [PATCH 2/2] KVM: x86 emulator: add decoding of CMPXCHG8B dst operand Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA63140.9050809@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox