All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>,
	Maxim Levitsky <mlevitsk@redhat.com>,
	Vineeth Pillai <viremana@linux.microsoft.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM
Date: Thu, 03 Feb 2022 10:51:49 +0100	[thread overview]
Message-ID: <87czk4b7m2.fsf@redhat.com> (raw)
In-Reply-To: <429afd81-7bef-8ead-6ca4-12671378d581@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 2/2/22 10:50, Vitaly Kuznetsov wrote:
...
>>    KVM: nSVM: Implement Enlightened MSR-Bitmap feature
...
>
> Queued, thanks.

While writing a selftest for the feature, I've discovered an embarassing
bug: in nested_svm_vmrun_msrpm() I check bit number instead of bit
mask. It worked in testing by pure luck, it seems genuine Hyper-V sets
some other clean fields simultaneously.

Would it be possible to squash the attached patch in? Thanks!

I'll be sending out selftests shortly.

-- 
Vitaly


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-KVM-nSVM-Fix-the-check-for-VMCB_HV_NESTED_ENLIGHTENM.patch --]
[-- Type: text/x-patch, Size: 1108 bytes --]

From cfb538876ccc59dade7cadde553863bea8312f90 Mon Sep 17 00:00:00 2001
From: Vitaly Kuznetsov <vkuznets@redhat.com>
Date: Thu, 3 Feb 2022 10:22:30 +0100
Subject: [PATCH] KVM: nSVM: Fix the check for VMCB_HV_NESTED_ENLIGHTENMENTS
 bin in nested_svm_vmrun_msrpm()

VMCB_HV_NESTED_ENLIGHTENMENTS (VMCB_SW) is a bit number, not a bit mask.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/kvm/svm/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 7b26a4b518f7..7acf4f2aa445 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -188,7 +188,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
 	if (!svm->nested.force_msr_bitmap_recalc &&
 	    kvm_hv_hypercall_enabled(&svm->vcpu) &&
 	    hve->hv_enlightenments_control.msr_bitmap &&
-	    (svm->nested.ctl.clean & VMCB_HV_NESTED_ENLIGHTENMENTS))
+	    (svm->nested.ctl.clean & BIT(VMCB_HV_NESTED_ENLIGHTENMENTS)))
 		goto set_msrpm_base_pa;
 
 	if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT)))
-- 
2.34.1


  reply	other threads:[~2022-02-03  9:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02  9:50 [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM Vitaly Kuznetsov
2022-02-02  9:50 ` [PATCH v2 1/4] KVM: nSVM: Track whether changes in L0 require MSR bitmap for L2 to be rebuilt Vitaly Kuznetsov
2022-02-02  9:50 ` [PATCH v2 2/4] KVM: x86: Make kvm_hv_hypercall_enabled() static inline Vitaly Kuznetsov
2022-02-02  9:50 ` [PATCH v2 3/4] KVM: nSVM: Split off common definitions for Hyper-V on KVM and KVM on Hyper-V Vitaly Kuznetsov
2022-02-02  9:51 ` [PATCH v2 4/4] KVM: nSVM: Implement Enlightened MSR-Bitmap feature Vitaly Kuznetsov
2022-02-02 17:14 ` [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM Paolo Bonzini
2022-02-03  9:51   ` Vitaly Kuznetsov [this message]
2022-02-03 10:39     ` Paolo Bonzini

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=87czk4b7m2.fsf@redhat.com \
    --to=vkuznets@redhat.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=viremana@linux.microsoft.com \
    --cc=wanpengli@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.