Re: [PATCH 11/22] KVM: x86: hyper-v: replace bitmap_weight() with hweight64()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 10, 2022 at 08:47:39AM -0700, Yury Norov wrote:
> kvm_hv_flush_tlb() applies bitmap API to a u64 variable valid_bank_mask.
> Since valid_bank_mask has a fixed size, we can use hweight64() and avoid
> excessive bloating.

In kvm_hv_send_ipi(), valid_bank_mask is unsigned long, not u64.

This results in:

arch/x86/kvm/hyperv.c: In function 'kvm_hv_send_ipi':
include/asm-generic/bitops/const_hweight.h:21:76: error: right shift count >= width of type

on all 32-bit builds.

Guenter

> 
> CC: Borislav Petkov <bp@xxxxxxxxx>
> CC: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> CC: H. Peter Anvin <hpa@xxxxxxxxx>
> CC: Ingo Molnar <mingo@xxxxxxxxxx>
> CC: Jim Mattson <jmattson@xxxxxxxxxx>
> CC: Joerg Roedel <joro@xxxxxxxxxx>
> CC: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> CC: Sean Christopherson <seanjc@xxxxxxxxxx>
> CC: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> CC: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> CC: Wanpeng Li <wanpengli@xxxxxxxxxxx>
> CC: kvm@xxxxxxxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx
> CC: x86@xxxxxxxxxx
> Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
> ---
>  arch/x86/kvm/hyperv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
> index 41585f0edf1e..b652b856df2b 100644
> --- a/arch/x86/kvm/hyperv.c
> +++ b/arch/x86/kvm/hyperv.c
> @@ -1855,7 +1855,7 @@ static u64 kvm_hv_flush_tlb(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
>  		all_cpus = flush_ex.hv_vp_set.format !=
>  			HV_GENERIC_SET_SPARSE_4K;
>  
> -		if (hc->var_cnt != bitmap_weight((unsigned long *)&valid_bank_mask, 64))
> +		if (hc->var_cnt != hweight64(valid_bank_mask))
>  			return HV_STATUS_INVALID_HYPERCALL_INPUT;
>  
>  		if (all_cpus)
> @@ -1956,7 +1956,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc)
>  		valid_bank_mask = send_ipi_ex.vp_set.valid_bank_mask;
>  		all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL;
>  
> -		if (hc->var_cnt != bitmap_weight(&valid_bank_mask, 64))
> +		if (hc->var_cnt != hweight64(valid_bank_mask))
>  			return HV_STATUS_INVALID_HYPERCALL_INPUT;
>  
>  		if (all_cpus)
> -- 
> 2.32.0
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux