]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: x86/hyper-v: Use preallocated per-vCPU buffer for de-sparsified vCPU masks
authorSean Christopherson <seanjc@google.com>
Fri, 13 Jun 2025 19:39:22 +0000 (12:39 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 24 Jun 2025 19:20:16 +0000 (12:20 -0700)
commit0b6f4a5f0878c410677a8201c48127fda0bfd843
tree79263aa1c0c25e404647547d17a4c7aebb206aab
parent48f15f624189762e7ff2d95bcbb68e21c2d56077
KVM: x86/hyper-v: Use preallocated per-vCPU buffer for de-sparsified vCPU masks

Use a preallocated per-vCPU bitmap for tracking the unpacked set of vCPUs
being targeted for Hyper-V's paravirt TLB flushing.  If KVM_MAX_NR_VCPUS
is set to 4096 (which is allowed even for MAXSMP=n builds), putting the
vCPU mask on-stack pushes kvm_hv_flush_tlb() past the default FRAME_WARN
limit.

  arch/x86/kvm/hyperv.c:2001:12: error: stack frame size (1288) exceeds limit (1024)
                                 in 'kvm_hv_flush_tlb' [-Werror,-Wframe-larger-than]
  2001 | static u64 kvm_hv_flush_tlb(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
       |            ^
  1 error generated.

Note, sparse_banks was given the same treatment by commit 7d5e88d301f8
("KVM: x86: hyper-v: Use preallocated buffer in 'struct kvm_vcpu_hv'
instead of on-stack 'sparse_banks'"), for the exact same reason.

Reported-by: Abinash Lalotra <abinashsinghlalotra@gmail.com>
Closes: https://lore.kernel.org/all/20250613111023.786265-1-abinashsinghlalotra@gmail.com
Link: https://lore.kernel.org/all/aEylI-O8kFnFHrOH@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/hyperv.c