* [PATCH] KVM: selftests: fix steal_time for arm64
@ 2026-05-04 11:28 Sebastian Ott
2026-05-06 16:14 ` Marc Zyngier
2026-06-22 4:02 ` Zenghui Yu
0 siblings, 2 replies; 7+ messages in thread
From: Sebastian Ott @ 2026-05-04 11:28 UTC (permalink / raw)
To: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm,
linux-kselftest, kvmarm
Cc: Paolo Bonzini, Marc Zyngier, Oliver Upton, Sebastian Ott
Fix the following failure to the steal_time test on arm64 by making
the timer address known to the guest.
==== Test Assertion Failure ====
steal_time.c:229: !ret
pid=18514 tid=18514 errno=22 - Invalid argument
1 0x000000000040252f: check_steal_time_uapi at steal_time.c:229 (discriminator 20)
2 (inlined by) main at steal_time.c:537 (discriminator 20)
3 0x0000ffffa23d621b: ?? ??:0
4 0x0000ffffa23d62fb: ?? ??:0
5 0x0000000000402b6f: _start at ??:?
KVM_SET_DEVICE_ATTR failed, rc: -1 errno: 22 (Invalid argument)
Fixes: 40351ed924dd ("KVM: selftests: Refactor UAPI tests into dedicated function")
Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
tools/testing/selftests/kvm/steal_time.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c
index 7df2bc8eec02..76fcdd1fd3cb 100644
--- a/tools/testing/selftests/kvm/steal_time.c
+++ b/tools/testing/selftests/kvm/steal_time.c
@@ -220,6 +220,8 @@ static void check_steal_time_uapi(void)
};
vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev);
+ vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, 1, 0);
+ virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, 1);
st_ipa = (ulong)ST_GPA_BASE | 1;
ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev);
base-commit: 6d35786de28116ecf78797a62b84e6bf3c45aa5a
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] KVM: selftests: fix steal_time for arm64 2026-05-04 11:28 [PATCH] KVM: selftests: fix steal_time for arm64 Sebastian Ott @ 2026-05-06 16:14 ` Marc Zyngier 2026-06-22 4:02 ` Zenghui Yu 1 sibling, 0 replies; 7+ messages in thread From: Marc Zyngier @ 2026-05-06 16:14 UTC (permalink / raw) To: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm, linux-kselftest, kvmarm, Sebastian Ott Cc: Paolo Bonzini, Oliver Upton On Mon, 04 May 2026 13:28:08 +0200, Sebastian Ott wrote: > Fix the following failure to the steal_time test on arm64 by making > the timer address known to the guest. > > ==== Test Assertion Failure ==== > steal_time.c:229: !ret > pid=18514 tid=18514 errno=22 - Invalid argument > 1 0x000000000040252f: check_steal_time_uapi at steal_time.c:229 (discriminator 20) > 2 (inlined by) main at steal_time.c:537 (discriminator 20) > 3 0x0000ffffa23d621b: ?? ??:0 > 4 0x0000ffffa23d62fb: ?? ??:0 > 5 0x0000000000402b6f: _start at ??:? > KVM_SET_DEVICE_ATTR failed, rc: -1 errno: 22 (Invalid argument) > > [...] Applied to fixes, thanks! [1/1] KVM: selftests: fix steal_time for arm64 commit: fc240715fc5003538ff530e3cfb985e7769b7171 Cheers, M. -- Without deviation from the norm, progress is not possible. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: selftests: fix steal_time for arm64 2026-05-04 11:28 [PATCH] KVM: selftests: fix steal_time for arm64 Sebastian Ott 2026-05-06 16:14 ` Marc Zyngier @ 2026-06-22 4:02 ` Zenghui Yu 2026-06-22 14:14 ` [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K Sebastian Ott 1 sibling, 1 reply; 7+ messages in thread From: Zenghui Yu @ 2026-06-22 4:02 UTC (permalink / raw) To: Sebastian Ott Cc: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm, linux-kselftest, kvmarm, Paolo Bonzini, Marc Zyngier, Oliver Upton Hi Sebastian, On 5/4/26 7:28 PM, Sebastian Ott wrote: > Fix the following failure to the steal_time test on arm64 by making > the timer address known to the guest. > > ==== Test Assertion Failure ==== > steal_time.c:229: !ret > pid=18514 tid=18514 errno=22 - Invalid argument > 1 0x000000000040252f: check_steal_time_uapi at steal_time.c:229 (discriminator 20) > 2 (inlined by) main at steal_time.c:537 (discriminator 20) > 3 0x0000ffffa23d621b: ?? ??:0 > 4 0x0000ffffa23d62fb: ?? ??:0 > 5 0x0000000000402b6f: _start at ??:? > KVM_SET_DEVICE_ATTR failed, rc: -1 errno: 22 (Invalid argument) > > Fixes: 40351ed924dd ("KVM: selftests: Refactor UAPI tests into dedicated function") > Signed-off-by: Sebastian Ott <sebott@redhat.com> > --- > tools/testing/selftests/kvm/steal_time.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c > index 7df2bc8eec02..76fcdd1fd3cb 100644 > --- a/tools/testing/selftests/kvm/steal_time.c > +++ b/tools/testing/selftests/kvm/steal_time.c > @@ -220,6 +220,8 @@ static void check_steal_time_uapi(void) > }; > > vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev); > + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, 1, 0); This leads to the following failure when the host page size is greater than the guest's: [root@localhost kvm]# getconf PAGESIZE 16384 [root@localhost kvm]# ./steal_time Random seed: 0x6b8b4567 __vm_create: mode='PA-bits:40, VA-bits:48, 4K pages' type='0', pages='672' TAP version 13 1..4 __vm_create: mode='PA-bits:40, VA-bits:48, 4K pages' type='0', pages='660' ==== Test Assertion Failure ==== lib/kvm_util.c:991: vm_adjust_num_guest_pages(vm->mode, npages) == npages pid=873 tid=873 errno=0 - Success 1 0x0000000000405a27: vm_mem_add at kvm_util.c:991 2 0x000000000040241f: check_steal_time_uapi at steal_time.c:223 (discriminator 7) 3 (inlined by) main at steal_time.c:539 (discriminator 7) 4 0x00007fff8b57af3b: ?? ??:0 5 0x00007fff8b57b007: ?? ??:0 6 0x0000000000402b6f: _start at ??:? Number of guest pages is not compatible with the host. Try npages=4 > + virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, 1); > > st_ipa = (ulong)ST_GPA_BASE | 1; > ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); Thanks, Zenghui ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K 2026-06-22 4:02 ` Zenghui Yu @ 2026-06-22 14:14 ` Sebastian Ott 2026-06-28 15:32 ` Zenghui Yu 2026-06-28 15:44 ` Zenghui Yu 0 siblings, 2 replies; 7+ messages in thread From: Sebastian Ott @ 2026-06-22 14:14 UTC (permalink / raw) To: Zenghui Yu Cc: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm, linux-kselftest, kvmarm, Paolo Bonzini, Marc Zyngier, Oliver Upton Fix the following failure when running with 16K host page size: ==== Test Assertion Failure ==== lib/kvm_util.c:991: vm_adjust_num_guest_pages(vm->mode, npages) == npages pid=873 tid=873 errno=0 - Success 1 0x0000000000405a27: vm_mem_add at kvm_util.c:991 2 0x000000000040241f: check_steal_time_uapi at steal_time.c:223 (discriminator 7) 3 (inlined by) main at steal_time.c:539 (discriminator 7) 4 0x00007fff8b57af3b: ?? ??:0 5 0x00007fff8b57b007: ?? ??:0 6 0x0000000000402b6f: _start at ??:? Number of guest pages is not compatible with the host. Try npages=4 Fixes: fc240715fc50 ("KVM: selftests: arm64: Fix steal_time test after UAPI refactoring") Reported-by: Zenghui Yu <zenghui.yu@linux.dev> Link: https://lore.kernel.org/kvmarm/7575a845-a542-4b16-b512-aec3126f97f3@linux.dev/T/#u Signed-off-by: Sebastian Ott <sebott@redhat.com> --- tools/testing/selftests/kvm/steal_time.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c index 76fcdd1fd3cb..cdb81f3ee4b2 100644 --- a/tools/testing/selftests/kvm/steal_time.c +++ b/tools/testing/selftests/kvm/steal_time.c @@ -208,6 +208,7 @@ static void check_steal_time_uapi(void) { struct kvm_vm *vm; struct kvm_vcpu *vcpu; + unsigned int gpages; u64 st_ipa; int ret; @@ -220,8 +221,9 @@ static void check_steal_time_uapi(void) }; vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev); - vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, 1, 0); - virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, 1); + gpages = vm_calc_num_guest_pages(VM_MODE_DEFAULT, 1); + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, gpages, 0); + virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, gpages); st_ipa = (ulong)ST_GPA_BASE | 1; ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); -- 2.54.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K 2026-06-22 14:14 ` [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K Sebastian Ott @ 2026-06-28 15:32 ` Zenghui Yu 2026-06-28 15:44 ` Zenghui Yu 1 sibling, 0 replies; 7+ messages in thread From: Zenghui Yu @ 2026-06-28 15:32 UTC (permalink / raw) To: Sebastian Ott Cc: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm, linux-kselftest, kvmarm, Paolo Bonzini, Marc Zyngier, Oliver Upton On 6/22/26 10:14 PM, Sebastian Ott wrote: > > Fix the following failure when running with 16K host page size: > ==== Test Assertion Failure ==== > lib/kvm_util.c:991: vm_adjust_num_guest_pages(vm->mode, npages) == npages > pid=873 tid=873 errno=0 - Success > 1 0x0000000000405a27: vm_mem_add at kvm_util.c:991 > 2 0x000000000040241f: check_steal_time_uapi at steal_time.c:223 (discriminator 7) > 3 (inlined by) main at steal_time.c:539 (discriminator 7) > 4 0x00007fff8b57af3b: ?? ??:0 > 5 0x00007fff8b57b007: ?? ??:0 > 6 0x0000000000402b6f: _start at ??:? > Number of guest pages is not compatible with the host. Try npages=4 > > Fixes: fc240715fc50 ("KVM: selftests: arm64: Fix steal_time test after UAPI refactoring") > Reported-by: Zenghui Yu <zenghui.yu@linux.dev> > Link: https://lore.kernel.org/kvmarm/7575a845-a542-4b16-b512-aec3126f97f3@linux.dev/T/#u > Signed-off-by: Sebastian Ott <sebott@redhat.com> Looks good to me, Reviewed-by: Zenghui Yu <zenghui.yu@linux.dev> Thanks, Zenghui ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K 2026-06-22 14:14 ` [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K Sebastian Ott 2026-06-28 15:32 ` Zenghui Yu @ 2026-06-28 15:44 ` Zenghui Yu 2026-06-29 12:04 ` Sebastian Ott 1 sibling, 1 reply; 7+ messages in thread From: Zenghui Yu @ 2026-06-28 15:44 UTC (permalink / raw) To: Sebastian Ott Cc: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm, linux-kselftest, kvmarm, Paolo Bonzini, Marc Zyngier, Oliver Upton On 6/22/26 10:14 PM, Sebastian Ott wrote: > > Fix the following failure when running with 16K host page size: > ==== Test Assertion Failure ==== > lib/kvm_util.c:991: vm_adjust_num_guest_pages(vm->mode, npages) == npages > pid=873 tid=873 errno=0 - Success > 1 0x0000000000405a27: vm_mem_add at kvm_util.c:991 > 2 0x000000000040241f: check_steal_time_uapi at steal_time.c:223 (discriminator 7) > 3 (inlined by) main at steal_time.c:539 (discriminator 7) > 4 0x00007fff8b57af3b: ?? ??:0 > 5 0x00007fff8b57b007: ?? ??:0 > 6 0x0000000000402b6f: _start at ??:? > Number of guest pages is not compatible with the host. Try npages=4 > > Fixes: fc240715fc50 ("KVM: selftests: arm64: Fix steal_time test after UAPI refactoring") > Reported-by: Zenghui Yu <zenghui.yu@linux.dev> > Link: https://lore.kernel.org/kvmarm/7575a845-a542-4b16-b512-aec3126f97f3@linux.dev/T/#u > Signed-off-by: Sebastian Ott <sebott@redhat.com> > --- > tools/testing/selftests/kvm/steal_time.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c > index 76fcdd1fd3cb..cdb81f3ee4b2 100644 > --- a/tools/testing/selftests/kvm/steal_time.c > +++ b/tools/testing/selftests/kvm/steal_time.c > @@ -208,6 +208,7 @@ static void check_steal_time_uapi(void) > { > struct kvm_vm *vm; > struct kvm_vcpu *vcpu; > + unsigned int gpages; > u64 st_ipa; > int ret; > > @@ -220,8 +221,9 @@ static void check_steal_time_uapi(void) > }; > > vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev); > - vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, 1, 0); > - virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, 1); > + gpages = vm_calc_num_guest_pages(VM_MODE_DEFAULT, 1); Would vm_calc_num_guest_pages(VM_MODE_DEFAULT, STEAL_TIME_SIZE) be better to describe the number of pages we want to add? > + vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, gpages, 0); > + virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, gpages); > > st_ipa = (ulong)ST_GPA_BASE | 1; > ret = __vcpu_ioctl(vcpu, KVM_SET_DEVICE_ATTR, &dev); ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K 2026-06-28 15:44 ` Zenghui Yu @ 2026-06-29 12:04 ` Sebastian Ott 0 siblings, 0 replies; 7+ messages in thread From: Sebastian Ott @ 2026-06-29 12:04 UTC (permalink / raw) To: Zenghui Yu Cc: Jiakai Xu, Shuah Khan, Andrew Jones, Anup Patel, kvm, linux-kselftest, kvmarm, Paolo Bonzini, Marc Zyngier, Oliver Upton On Sun, 28 Jun 2026, Zenghui Yu wrote: > On 6/22/26 10:14 PM, Sebastian Ott wrote: >> >> Fix the following failure when running with 16K host page size: >> ==== Test Assertion Failure ==== >> lib/kvm_util.c:991: vm_adjust_num_guest_pages(vm->mode, npages) == npages >> pid=873 tid=873 errno=0 - Success >> 1 0x0000000000405a27: vm_mem_add at kvm_util.c:991 >> 2 0x000000000040241f: check_steal_time_uapi at steal_time.c:223 (discriminator 7) >> 3 (inlined by) main at steal_time.c:539 (discriminator 7) >> 4 0x00007fff8b57af3b: ?? ??:0 >> 5 0x00007fff8b57b007: ?? ??:0 >> 6 0x0000000000402b6f: _start at ??:? >> Number of guest pages is not compatible with the host. Try npages=4 >> >> Fixes: fc240715fc50 ("KVM: selftests: arm64: Fix steal_time test after UAPI refactoring") >> Reported-by: Zenghui Yu <zenghui.yu@linux.dev> >> Link: https://lore.kernel.org/kvmarm/7575a845-a542-4b16-b512-aec3126f97f3@linux.dev/T/#u >> Signed-off-by: Sebastian Ott <sebott@redhat.com> >> --- >> tools/testing/selftests/kvm/steal_time.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c >> index 76fcdd1fd3cb..cdb81f3ee4b2 100644 >> --- a/tools/testing/selftests/kvm/steal_time.c >> +++ b/tools/testing/selftests/kvm/steal_time.c >> @@ -208,6 +208,7 @@ static void check_steal_time_uapi(void) >> { >> struct kvm_vm *vm; >> struct kvm_vcpu *vcpu; >> + unsigned int gpages; >> u64 st_ipa; >> int ret; >> >> @@ -220,8 +221,9 @@ static void check_steal_time_uapi(void) >> }; >> >> vcpu_ioctl(vcpu, KVM_HAS_DEVICE_ATTR, &dev); >> - vm_userspace_mem_region_add(vm, VM_MEM_SRC_ANONYMOUS, ST_GPA_BASE, 1, 1, 0); >> - virt_map(vm, ST_GPA_BASE, ST_GPA_BASE, 1); >> + gpages = vm_calc_num_guest_pages(VM_MODE_DEFAULT, 1); > > Would vm_calc_num_guest_pages(VM_MODE_DEFAULT, STEAL_TIME_SIZE) be better > to describe the number of pages we want to add? Hm, I don't think we care. This is just for the uapi checker - the vm/vcpu doesn't even run.. Thanks, Sebastian ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-06-29 12:05 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-04 11:28 [PATCH] KVM: selftests: fix steal_time for arm64 Sebastian Ott 2026-05-06 16:14 ` Marc Zyngier 2026-06-22 4:02 ` Zenghui Yu 2026-06-22 14:14 ` [PATCH] KVM: selftests: fix steal_time for arm64 with host page size > 4K Sebastian Ott 2026-06-28 15:32 ` Zenghui Yu 2026-06-28 15:44 ` Zenghui Yu 2026-06-29 12:04 ` Sebastian Ott
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox