Re: [PATCH v5 11/11] target/i386/kvm: Replace ARRAY_SIZE(msr_handlers) with KVM_MSR_FILTER_MAX_RANGES

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

 



On Tue, Dec 24, 2024 at 04:54:41PM +0100, Paolo Bonzini wrote:
> Date: Tue, 24 Dec 2024 16:54:41 +0100
> From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Subject: Re: [PATCH v5 11/11] target/i386/kvm: Replace
>  ARRAY_SIZE(msr_handlers) with KVM_MSR_FILTER_MAX_RANGES
> 
> On 11/6/24 04:07, Zhao Liu wrote:
> > kvm_install_msr_filters() uses KVM_MSR_FILTER_MAX_RANGES as the bound
> > when traversing msr_handlers[], while other places still compute the
> > size by ARRAY_SIZE(msr_handlers).
> > 
> > In fact, msr_handlers[] is an array with the fixed size
> > KVM_MSR_FILTER_MAX_RANGES, so there is no difference between the two
> > ways.
> > 
> > For the code consistency and to avoid additional computational overhead,
> > use KVM_MSR_FILTER_MAX_RANGES instead of ARRAY_SIZE(msr_handlers).
> 
> I agree with the consistency but I'd go the other direction.
>

OK, I'll switch to the other way.

Thanks,
Zhao





[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