KVM: X86: Force ASYNC_PF_PER_VCPU to be power of two
authorPeter Xu <peterx@redhat.com>
Thu, 16 Apr 2020 15:58:59 +0000 (11:58 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 May 2020 16:26:13 +0000 (12:26 -0400)
commitdd03bcaad0b1a62c8ea6297e6f2a5993c1c5cd30
tree58a3a8e50c197261712183bccff0da1c6623303f
parentc16312f4fa75e786f5748a7b721a05e6b0d761fe
KVM: X86: Force ASYNC_PF_PER_VCPU to be power of two

Forcing the ASYNC_PF_PER_VCPU to be power of two is much easier to be
used rather than calling roundup_pow_of_two() from time to time.  Do
this by adding a BUILD_BUG_ON() inside the hash function.

Another point is that generally async pf does not allow concurrency
over ASYNC_PF_PER_VCPU after all (see kvm_setup_async_pf()), so it
does not make much sense either to have it not a power of two or some
of the entries will definitely be wasted.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20200416155859.267366-1-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c