]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
KVM: x86: Query vcpu->vcpu_idx directly and drop its accessor
authorSean Christopherson <seanjc@google.com>
Fri, 10 Sep 2021 18:32:19 +0000 (11:32 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 22 Sep 2021 14:33:11 +0000 (10:33 -0400)
commit4eeef2424153e79910d65248b5e1abf137d050e9
treed13910edce06615abb10497c15f98eb43e004cce
parente9337c843c4b4eaa4afb752a7272ef3d04c46381
KVM: x86: Query vcpu->vcpu_idx directly and drop its accessor

Read vcpu->vcpu_idx directly instead of bouncing through the one-line
wrapper, kvm_vcpu_get_idx(), and drop the wrapper.  The wrapper is a
remnant of the original implementation and serves no purpose; remove it
before it gains more users.

Back when kvm_vcpu_get_idx() was added by commit 497d72d80a78 ("KVM: Add
kvm_vcpu_get_idx to get vcpu index in kvm->vcpus"), the implementation
was more than just a simple wrapper as vcpu->vcpu_idx did not exist and
retrieving the index meant walking over the vCPU array to find the given
vCPU.

When vcpu_idx was introduced by commit 8750e72a79dd ("KVM: remember
position in kvm->vcpus array"), the helper was left behind, likely to
avoid extra thrash (but even then there were only two users, the original
arm usage having been removed at some point in the past).

No functional change intended.

Suggested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20210910183220.2397812-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/kvm-s390.h
arch/x86/kvm/hyperv.c
arch/x86/kvm/hyperv.h
include/linux/kvm_host.h