Skip to content

Commit 5f4bd81

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Use vcpu_idx for invalidation tracking
While vcpu_id isn't necessarily a bad choice as an identifier for the currently running vcpu, it is provided by userspace, and there is close to no guarantee that it would be unique. Switch it to vcpu_idx instead, for which we have much stronger guarantees. Reviewed-by: Zenghui Yu <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent ac0fe56 commit 5f4bd81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/kvm/arm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
438438
* We might get preempted before the vCPU actually runs, but
439439
* over-invalidation doesn't affect correctness.
440440
*/
441-
if (*last_ran != vcpu->vcpu_id) {
441+
if (*last_ran != vcpu->vcpu_idx) {
442442
kvm_call_hyp(__kvm_flush_cpu_context, mmu);
443-
*last_ran = vcpu->vcpu_id;
443+
*last_ran = vcpu->vcpu_idx;
444444
}
445445

446446
vcpu->cpu = cpu;

0 commit comments

Comments
 (0)