On Fri, Aug 02, 2019 at 06:56:51PM +0800, Zenghui Yu wrote: > Hi folks, > > Running kvm-unit-tests with Linux 5.3.0-rc2 on Kunpeng 920, we will get > the following fail info: > > [...] > FAIL psci (4 tests, 1 unexpected failures) > [...] > and > [...] > INFO: unexpected cpu_on return value: caller=CPU9, ret=-2 > FAIL: cpu-on > SUMMARY: 4 tests, 1 unexpected failures > > > I think this is an issue had been fixed once by commit 6c7a5dce22b3 > ("KVM: arm/arm64: fix races in kvm_psci_vcpu_on"), which makes use of > kvm->lock mutex to fix the race between two PSCI_CPU_ON calls - one > does reset on the MPIDR register whilst another reads it. > > But commit 358b28f09f0 ("arm/arm64: KVM: Allow a VCPU to fully reset > itself") later moves the reset work into check_vcpu_requests(), by > making a KVM_REQ_VCPU_RESET request in PSCI code. Thus the reset work > has not been protected by kvm->lock mutex anymore, and the race shows up > again... > > Do we need a fix for this issue? At least achieve a mutex execution > between the reset of MPIDR and kvm_mpidr_to_vcpu()? > > I noticed this too, but I put it pretty low on my TODO because it's a safe failure (no host crash, just an unexpected PSCI_RET_INVALID_PARAMS gets returned because the valid MPIDR doesn't look valid for a moment.) Also, the test is quite pathological, especially when the host has many CPUs, so I wouldn't expect this to show up on a sane guest. I agree it would be nice to get it fixed eventually though. Thanks, drew