[PATCH v2 06/11] KVM: arm64: Use vcpu_idx for invalidation tracking

Zenghui Yu yuzenghui at huawei.com
Thu Sep 21 02:16:42 PDT 2023


On 2023/9/21 2:17, Marc Zyngier wrote:
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
>  arch/arm64/kvm/arm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> index 872679a0cbd7..23c22dbd1969 100644
> --- a/arch/arm64/kvm/arm.c
> +++ b/arch/arm64/kvm/arm.c
> @@ -438,9 +438,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  	 * We might get preempted before the vCPU actually runs, but
>  	 * over-invalidation doesn't affect correctness.
>  	 */
> -	if (*last_ran != vcpu->vcpu_id) {
> +	if (*last_ran != vcpu->vcpu_idx) {
>  		kvm_call_hyp(__kvm_flush_cpu_context, mmu);
> -		*last_ran = vcpu->vcpu_id;
> +		*last_ran = vcpu->vcpu_idx;
>  	}
>  
>  	vcpu->cpu = cpu;

Isn't the original code (using vcpu_id) enough to detect a different
previously run VCPU? What am I missing?

Thanks,
Zenghui



More information about the linux-arm-kernel mailing list