]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Mar 2023 12:15:15 +0000 (14:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Mar 2023 12:15:15 +0000 (14:15 +0200)
added patches:
kvm-x86-hyper-v-avoid-calling-kvm_make_vcpus_request_mask-with-vcpu_mask-null.patch

queue-5.15/kvm-x86-hyper-v-avoid-calling-kvm_make_vcpus_request_mask-with-vcpu_mask-null.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/kvm-x86-hyper-v-avoid-calling-kvm_make_vcpus_request_mask-with-vcpu_mask-null.patch b/queue-5.15/kvm-x86-hyper-v-avoid-calling-kvm_make_vcpus_request_mask-with-vcpu_mask-null.patch
new file mode 100644 (file)
index 0000000..870e5a6
--- /dev/null
@@ -0,0 +1,57 @@
+From 6470accc7ba948b0b3aca22b273fe84ec638a116 Mon Sep 17 00:00:00 2001
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+Date: Fri, 3 Sep 2021 09:51:36 +0200
+Subject: KVM: x86: hyper-v: Avoid calling kvm_make_vcpus_request_mask() with vcpu_mask==NULL
+
+From: Vitaly Kuznetsov <vkuznets@redhat.com>
+
+commit 6470accc7ba948b0b3aca22b273fe84ec638a116 upstream.
+
+In preparation to making kvm_make_vcpus_request_mask() use for_each_set_bit()
+switch kvm_hv_flush_tlb() to calling kvm_make_all_cpus_request() for 'all cpus'
+case.
+
+Note: kvm_make_all_cpus_request() (unlike kvm_make_vcpus_request_mask())
+currently dynamically allocates cpumask on each call and this is suboptimal.
+Both kvm_make_all_cpus_request() and kvm_make_vcpus_request_mask() are
+going to be switched to using pre-allocated per-cpu masks.
+
+Reviewed-by: Sean Christopherson <seanjc@google.com>
+Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Message-Id: <20210903075141.403071-4-vkuznets@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Cc: Mathias Krause <minipli@grsecurity.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kvm/hyperv.c |   15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+--- a/arch/x86/kvm/hyperv.c
++++ b/arch/x86/kvm/hyperv.c
+@@ -1846,16 +1846,19 @@ static u64 kvm_hv_flush_tlb(struct kvm_v
+       cpumask_clear(&hv_vcpu->tlb_flush);
+-      vcpu_mask = all_cpus ? NULL :
+-              sparse_set_to_vcpu_mask(kvm, sparse_banks, valid_bank_mask,
+-                                      vp_bitmap, vcpu_bitmap);
+-
+       /*
+        * vcpu->arch.cr3 may not be up-to-date for running vCPUs so we can't
+        * analyze it here, flush TLB regardless of the specified address space.
+        */
+-      kvm_make_vcpus_request_mask(kvm, KVM_REQ_TLB_FLUSH_GUEST,
+-                                  NULL, vcpu_mask, &hv_vcpu->tlb_flush);
++      if (all_cpus) {
++              kvm_make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH_GUEST);
++      } else {
++              vcpu_mask = sparse_set_to_vcpu_mask(kvm, sparse_banks, valid_bank_mask,
++                                                  vp_bitmap, vcpu_bitmap);
++
++              kvm_make_vcpus_request_mask(kvm, KVM_REQ_TLB_FLUSH_GUEST,
++                                          NULL, vcpu_mask, &hv_vcpu->tlb_flush);
++      }
+ ret_success:
+       /* We always do full TLB flush, set 'Reps completed' = 'Rep Count' */
index 460f110cb53fa048ffb46f7a154d9903732fc4ec..e5f30cba95df3c218a771d02ec5c20120f47fad2 100644 (file)
@@ -120,3 +120,4 @@ usb-chipdea-core-fix-return-einval-if-request-role-is-the-same-with-current-role
 usb-chipidea-core-fix-possible-concurrent-when-switch-role.patch
 usb-ucsi-fix-null-pointer-deref-in-ucsi_connector_change.patch
 kfence-avoid-passing-g-for-test.patch
+kvm-x86-hyper-v-avoid-calling-kvm_make_vcpus_request_mask-with-vcpu_mask-null.patch