The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi()
       [not found] <20260501021639.2563219-1-xujiakai2025@iscas.ac.cn>
@ 2026-05-07  1:35 ` Mark Brown
  2026-05-12  1:59 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-05-07  1:35 UTC (permalink / raw)
  To: Jiakai Xu
  Cc: kvm, linux-kernel, linux-kselftest, Andrew Jones, Anup Patel,
	Paolo Bonzini, Shuah Khan, Jiakai Xu

[-- Attachment #1: Type: text/plain, Size: 481 bytes --]

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.

Tested-by: Mark Brown <broonie@kernel.org>

It'd be good to get this merged, this is a mainline regression.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi()
       [not found] <20260501021639.2563219-1-xujiakai2025@iscas.ac.cn>
  2026-05-07  1:35 ` [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi() Mark Brown
@ 2026-05-12  1:59 ` Mark Brown
  2026-05-12  2:49   ` Zenghui Yu
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2026-05-12  1:59 UTC (permalink / raw)
  To: Paolo Bonzini, Anup Patel, Atish Patra, Marc Zyngier,
	Oliver Upton
  Cc: Jiakai Xu, kvm, linux-kernel, linux-kselftest, Andrew Jones,
	Anup Patel, Paolo Bonzini, Shuah Khan, Jiakai Xu, kvm-riscv,
	Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 1808 bytes --]

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 <broonie@kernel.org>
> Closes: https://lore.kernel.org/lkml/afM8WEe4gG5tL4fH@sirena.co.uk
> Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn>
> Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com>
> 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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi()
  2026-05-12  1:59 ` Mark Brown
@ 2026-05-12  2:49   ` Zenghui Yu
  2026-05-12 10:39     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Zenghui Yu @ 2026-05-12  2:49 UTC (permalink / raw)
  To: Mark Brown
  Cc: Paolo Bonzini, Anup Patel, Atish Patra, Marc Zyngier,
	Oliver Upton, Jiakai Xu, kvm, linux-kernel, linux-kselftest,
	Andrew Jones, Shuah Khan, Jiakai Xu, kvm-riscv, Linus Torvalds

On 2026/5/12 9:59, Mark Brown wrote:
> 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.

Does fc240715fc50 [1] fix the selftest regression? It has been included
in the latest KVM/arm64 pull request [2].

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git/commit/?h=fixes&id=fc240715fc5003538ff530e3cfb985e7769b7171
[2] https://lore.kernel.org/kvmarm/20260507154221.2905554-1-maz@kernel.org

> 
> > Reported-by: Mark Brown <broonie@kernel.org>
> > Closes: https://lore.kernel.org/lkml/afM8WEe4gG5tL4fH@sirena.co.uk
> > Signed-off-by: Jiakai Xu <xujiakai2025@iscas.ac.cn>
> > Signed-off-by: Jiakai Xu <jiakaiPeanut@gmail.com>
> > 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
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi()
  2026-05-12  2:49   ` Zenghui Yu
@ 2026-05-12 10:39     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-05-12 10:39 UTC (permalink / raw)
  To: Zenghui Yu
  Cc: Paolo Bonzini, Anup Patel, Atish Patra, Marc Zyngier,
	Oliver Upton, Jiakai Xu, kvm, linux-kernel, linux-kselftest,
	Andrew Jones, Shuah Khan, Jiakai Xu, kvm-riscv, Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On Tue, May 12, 2026 at 10:49:23AM +0800, Zenghui Yu wrote:
> On 2026/5/12 9:59, Mark Brown wrote:

> > 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.

> Does fc240715fc50 [1] fix the selftest regression? It has been included
> in the latest KVM/arm64 pull request [2].

Ah, yes - that looks like it should also do the trick.  Thanks for
making me aware of it!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-12 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260501021639.2563219-1-xujiakai2025@iscas.ac.cn>
2026-05-07  1:35 ` [PATCH] KVM: arm64: Add memslot for ST_GPA_BASE in check_steal_time_uapi() Mark Brown
2026-05-12  1:59 ` Mark Brown
2026-05-12  2:49   ` Zenghui Yu
2026-05-12 10:39     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox