Re: [PATCH 2/2] KVM: arm64: Block ID register changes after we rely on the values

Mark Brown <[email protected]> Mon, 3 Aug 2026 18:39:46 +0100
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
--36SEx+wND90T2F85
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Aug 02, 2026 at 06:13:38PM +0100, Fuad Tabba wrote:
> On Fri, 31 Jul 2026 at 21:46, Mark Brown <[email protected]> wrote:

> The flag fixes this. One consistency point: set_id_reg() and
> set_imp_id_reg() now gate on the new flag, but
> kvm_vm_finalize_sys_regs() still returns early on
> kvm_vm_has_ran_once(), and so does the KVM_BUG_ON() in
> kvm_set_vm_id_reg(). Could both move to kvm_id_regs_final(), so one
> predicate expresses the invariant? If so I think they would need to
> move together, since on a retried first run kvm_vm_finalize_sys_regs()
> re-runs and re-writes the ID regs via kvm_set_vm_id_reg(), so
> switching only the BUG_ON would trip it.

Yeah, I think that's sensible.  I think I was thinking we might want to
add non-ID register stuff at some point, but we don't currently have any
of that and the ID register stuff that is there ought to be joined up.

> Separately, would a selftest for that failed-run path be worth adding,
> checking that KVM_SET_ONE_REG on an ID reg and KVM_CREATE_DEVICE both
> return -EBUSY?

It feels like there's a general gap here with ordering and interactions
during VM setup, both with the API calls and ideally also with
combinations of features.  Covering that is probably much more
beneficial than a focused test for the specific issue, that'd catch
recurrences of the specific mechanism but it'd be easy for it to miss
something else that causes the ID registers to change.

--36SEx+wND90T2F85
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmpw0mEACgkQJNaLcl1U
h9B7ZQf+M5zCfT7i75HdE3i14+l66LGOQqS+9Uv/BpcCJinHD+GCrG5npWWtMbAw
D+O5Xlqh4CvW5q+TglHUqpQPiL/aU8cnmcSsxVPxIXYLAqT4hNCfY4jtmC8malde
BwMBoMJPrs+UVqL6b16LDn94ug373LNeVYk3F4NfzA5Ehlkd2fjt8rk6Z8/45/6Y
x/tUrnZmER1BZxm8SUWIh5GiSYPnJaBVNaSo2wSNu1/2/NeaoyXHRQz/o0bCN4HL
+e2m90wwjetFwk9UFDo3OEaUDUTR+DEjvi7AyCkxtXXnebXwV7d5Klay1bcsFGzf
s2HFAyifLePXHTTrMHpZ/7pgABMB4g==
=iC0q
-----END PGP SIGNATURE-----

--36SEx+wND90T2F85--