From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr Date: Thu, 21 Aug 2014 13:56:46 +0200 Message-ID: <53F5DE7E.1000506@redhat.com> References: <1408536711-32643-1-git-send-email-namit@cs.technion.ac.il> <20140821080536.GA30303@kernel> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Cc: kvm@vger.kernel.org To: Wanpeng Li , Nadav Amit Return-path: Received: from mail-wg0-f45.google.com ([74.125.82.45]:45909 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754291AbaHUL4v (ORCPT ); Thu, 21 Aug 2014 07:56:51 -0400 Received: by mail-wg0-f45.google.com with SMTP id x12so8946116wgg.28 for ; Thu, 21 Aug 2014 04:56:50 -0700 (PDT) In-Reply-To: <20140821080536.GA30303@kernel> Sender: kvm-owner@vger.kernel.org List-ID: 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 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 >> --- >> 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