Re: [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi()

Mark Brown <[email protected]>
Newsgroups org.infradead.lists.kvm-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
On Fri, May 01, 2026 at 02:16:39AM +0000, Jiakai Xu wrote:
> The refactored check_steal_time_uapi() creates a temporary VM via
> vm_create_with_one_vcpu(), whose default memslot0 only covers GPA
> 0..~2MB.  Setting st_ipa to ST_GPA_BASE (1 << 30) causes
> kvm_arm_pvtime_set_attr() to fail with EINVAL because gfn_to_hva()
> cannot find a valid memslot at the target GFN.
> 
> Add a memslot at ST_GPA_BASE in the temporary VM, mirroring what
> the main test already does.

The regression in Linus' tree that is fixed by this patch is still
present today.  Adding Marc and Oliver since this bug manifests on
arm64, adding Anup and Atish since the patch introducing the regression
was merged via RISC-V.

> Reported-by: Mark Brown <[email protected]>
> Closes: https://lore.kernel.org/lkml/[email protected]
> Signed-off-by: Jiakai Xu <[email protected]>
> Signed-off-by: Jiakai Xu <[email protected]>
> Fixes: 40351ed924dd30 ("KVM: selftests: Refactor UAPI tests into dedicated function")
> ---
>  tools/testing/selftests/kvm/steal_time.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
> index 7df2bc8eec02..2b01b466ddc1 100644
> --- a/tools/testing/selftests/kvm/steal_time.c
> +++ b/tools/testing/selftests/kvm/steal_time.c
> @@ -213,6 +213,10 @@ static void check_steal_time_uapi(void)
>  
>  	vm = vm_create_with_one_vcpu(&vcpu, NULL);
>  
> +	/* ST_GPA_BASE needs a valid memslot for gfn_to_hva() to succeed */
> +	vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE,
> +				    1, 1, 0);
> +
>  	struct kvm_device_attr dev = {
>  		.group = KVM_ARM_VCPU_PVTIME_CTRL,
>  		.attr = KVM_ARM_VCPU_PVTIME_IPA,
> -- 
> 2.34.1
>

-- 
kvm-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kvm-riscv
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmoCiZsACgkQJNaLcl1U
h9Aztwf/TJOL07dodf+kbqHGMGanbVGP2UgWLGXE9K1upoIUu6EOLDb52Qn10qVt
Uiq0EHGtwmhChGZqkdaP7GRRUuP2/3UbVC2O7Ts/m4RWs9AtBdmr3pn0pxwUNtg6
w4wYmTNV1Czs782mzaa+ad0VcEXjdY3uirSYPMbDgwTEL+IHbrVs2SS20fTH8i/V
BAi4DqyDVCRnu49QmGRqa0HvwrmNzP+5fBnJXauS5bbQqxBb18ePzLNKQ9fypFP5
NEZvRAiRn/hwhWa/zh3YCqYrm3lFaR3uh0y+ndMHoD2BiPNPZzkVqF0/rzEZ//V2
T5msZhZHP8j1DVjINnNAFjQ8p07K/w==
=toXn
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.