[PATCH v3 06/19] KVM: arm64: Track vCPU power state using MP state values

Marc Zyngier maz at kernel.org
Fri Feb 25 07:37:03 PST 2022


On Thu, 24 Feb 2022 22:08:15 +0000,
Oliver Upton <oupton at google.com> wrote:
> 
> Hi Marc,
> 
> On Thu, Feb 24, 2022 at 01:25:04PM +0000, Marc Zyngier wrote:
> 
> [...]
> 
> > > @@ -190,7 +190,7 @@ static void kvm_prepare_system_event(struct kvm_vcpu *vcpu, u32 type)
> > >  	 * re-initialized.
> > >  	 */
> > >  	kvm_for_each_vcpu(i, tmp, vcpu->kvm)
> > > -		tmp->arch.power_off = true;
> > > +		tmp->arch.mp_state = KVM_MP_STATE_STOPPED;
> > >  	kvm_make_all_cpus_request(vcpu->kvm, KVM_REQ_SLEEP);
> > >  
> > >  	memset(&vcpu->run->system_event, 0, sizeof(vcpu->run->system_event));
> > 
> > You also may want to initialise the mp_state to RUNNABLE by default in
> > kvm_arch_vcpu_create(). We are currently relying on power_off to be
> > false thanks to the vcpu struct being zeroed, but we may as well make
> > it clearer (RUNNABLE is also 0, so there is no actual bug here).
> 
> We unconditionally initialize power_off in
> kvm_arch_vcpu_ioctl_vcpu_init(), and do the same in this patch for mp_state,
> depending on if KVM_ARM_VCPU_POWER_OFF is set.

Ah, I missed that. Thanks for the heads up.

> Any objections to leaving that as-is? I can move the RUNNABLE case into
> kvm_arch_vcpu_create() as you've suggested, too.

No, that's just a brain fart on my part. Leave it as is.

Thanks,

	M.

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



More information about the kvm-riscv mailing list