Re: [PATCH] kvm, x86: simplify manipulation of ASYNC_PF_PER_VCPU on x86

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

 



2018-12-26 09:54+0800, Wei Yang:
> In generic code kvm_setup_async_pf() checks the async_pf size by:
> 
>     if (vcpu->async_pf.queued >= ASYNC_PF_PER_VCPU)
> 
> While in x86, we define the array as:
> 
>     gfn_t gfns[roundup_pow_of_two(ASYNC_PF_PER_VCPU)];
> 
> And each time we compare the index like this:
> 
>     i < roundup_pow_of_two(ASYNC_PF_PER_VCPU)
> 
> The behavior is correct now, while not consistent with generic code.
> 
> As for now ASYNC_PF_PER_VCPU is defined as 64, which is already a power of
> 2. This patch introduces ASYNC_PF_PER_VCPU_ORDER and rewrite the definition
> as:
> 
>     #define ASYNC_PF_PER_VCPU_ORDER 6
>     #define ASYNC_PF_PER_VCPU      (1 << ASYNC_PF_PER_VCPU_ORDER)
> 
> By doing so, we can remove the roundup_pow_of_two()/order_base_2() helpers
> when access async_pf on x86. And this make code consistent between
> generic and x86.
> 
> Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
> 
> ---
> v2: Radim suggest to change platform code instead of generic code.
> ---

Queued, thanks.



[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