Re: [PATCH v3 12/18] KVM: arm64: Prevent host PC adjustments for protected vCPUs

From: Marc Zyngier

Date: Tue Sep 15 2026 - 07:22:16 EST


On Mon, 14 Sep 2026 15:43:16 +0100,
Fuad Tabba <fuad.tabba@xxxxxxxxx> wrote:
>
> > > + hyp_vcpu = pkvm_get_loaded_hyp_vcpu();
> > > + if (!hyp_vcpu || hyp_vcpu->host_vcpu != vcpu)
> >
> > Under which circumstances do we get hyp_vcpu->host_vcpu != vcpu?
>
> When EL2 calls __kvm_adjust_pc() on the hyp vCPU itself:
> __kvm_vcpu_run() at guest entry and inject_sync64() in nvhe/sys_regs.c
> both pass &hyp_vcpu->vcpu. There the vCPU passed is the one to adjust,
> so it's returned as is.

If this is the sole case, why not check for '&hyp_cpu->vcpu == vcpu'
instead of this odd inequality?

Thanks,

M.

--
Without deviation from the norm, progress is not possible.