public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <wanpeng.li@linux.intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Nadav Amit <namit@cs.technion.ac.il>, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr
Date: Fri, 22 Aug 2014 12:13:44 +0800	[thread overview]
Message-ID: <20140822041344.GA4807@kernel> (raw)
In-Reply-To: <53F5DE7E.1000506@redhat.com>

Hi Paolo,
On Thu, Aug 21, 2014 at 01:56:46PM +0200, Paolo Bonzini wrote:
>Il 21/08/2014 10:05, Wanpeng Li ha scritto:
>> Hi Nadav,
>> On Wed, Aug 20, 2014 at 03:11:51PM +0300, Nadav Amit wrote:
>>> Currently, when an msr is updated using kvm_set_shared_msr the masked bits are
>>> zeroed.  This behavior is currently valid since the only MSR with partial mask
>> 
>> Why zeroed? vmx_vcpu_setup() set all mask to -1ull.
>
>He meant they are passed as zero in the WRMSR but actually they're not

I fail to understand "they are passed as zero". Could you explain more
in details? ;-)

Regards,
Wanpeng Li 

>zeroed.  They're set to the value that is passed to kvm_set_shared_msr,
>and this value is massaged elsewhere to do mix guest and host bugs.  See
>update_transition_efer.
>
>So I'm removing this patch, it's wrong.
>
>Paolo
>
>>> is EFER, in which only SCE might be unmasked. However, using the
>> 
>> Do you mean SCE might be masked? 
>> 
>>> kvm_set_shared_msr for other purposes becomes impossible.
>>>
>>> This patch keeps the masked bits unmodified while setting a shared msr.
>>>
>> 
>> Do you mean "keeps the unmasked bits unmodified" instead of "keeps the
>> masked bits unmodified"?
>> 
>> Regards,
>> Wanpeng Li 
>> 
>>> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
>>> ---
>>> arch/x86/kvm/x86.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>>> index 5f5edb6..ee42410 100644
>>> --- a/arch/x86/kvm/x86.c
>>> +++ b/arch/x86/kvm/x86.c
>>> @@ -236,6 +236,7 @@ void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask)
>>>
>>> 	if (((value ^ smsr->values[slot].curr) & mask) == 0)
>>> 		return;
>>> +	value = (smsr->values[slot].curr & ~mask) | (value & mask);
>>> 	smsr->values[slot].curr = value;
>>> 	wrmsrl(shared_msrs_global.msrs[slot], value);
>>> 	if (!smsr->registered) {
>>> -- 
>>> 1.9.1
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe kvm" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-08-22  4:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 12:11 [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr Nadav Amit
2014-08-21  8:05 ` Wanpeng Li
2014-08-21 11:56   ` Paolo Bonzini
2014-08-21 12:19     ` Nadav Amit
2014-08-21 12:31       ` Paolo Bonzini
2014-08-21 12:41         ` Nadav Amit
2014-08-22  4:13     ` Wanpeng Li [this message]
2014-08-22  6:55       ` Nadav Amit

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=20140822041344.GA4807@kernel \
    --to=wanpeng.li@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=namit@cs.technion.ac.il \
    --cc=pbonzini@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