ppc64le kunit test failure: guest_state_buffer_test
FYI, the KUnit test arch/powerpc/kvm/test-guest-state-buffer.c is failing when run in QEMU PPC64LE:
[ 146.554299][ T1] KTAP version 1^M [ 146.554348][ T1] # Subtest: guest_state_buffer_test^M [ 146.554543][ T1] # module: test_guest_state_buffer^M [ 146.554927][ T1] 1..7^M [ 146.556873][ T1] ok 1 test_creating_buffer^M [ 146.558221][ T1] ok 2 test_adding_element^M [ 146.559532][ T1] ok 3 test_gs_bitmap^M [ 146.560309][ T1] ok 4 test_gs_parsing^M [ 146.561246][ T1] ok 5 test_gs_msg^M [ 146.562116][ T1] ok 6 test_gs_hostwide_msg^M [ 146.562911][ T428] # test_gs_hostwide_counters: ASSERTION FAILED at arch/powerpc/kvm/test-guest-state-buffer.c:488^M [ 146.562911][ T428] Expected rc == 0, but^M [ 146.562911][ T428] rc == -2 (0xfffffffffffffffe)^M [ 146.563600][ T1] not ok 7 test_gs_hostwide_counters^M [ 146.563653][ T1] # guest_state_buffer_test: pass:6 fail:1 skip:0 total:7^M
Tested on next-20260602. I haven't bisected it.
Note that this test is in the defconfig.
- Eric
Hi Eric,
Thanks for trying and reporting this. This kunit test depends on availablility of Qemu commit 5f7d861e("spapr: nested: Add support for reporting Hostwide state counter ") [1] that was merged in v10.0.0.
Since you havent mentioned the qemu version used I assume its a version < v10.0.0 . With the qemu patch available you should see this test passing with results similar to as originally described in original cover letter of the patch series at [2] that introduced this kunit test.
[1] https://gitlab.com/qemu-project/qemu/-/commit/5f7d861e65d90e0446b8f22a0bc859a5d8058ea6
[2] https://lore.kernel.org/all/[email protected]/
Quoted 25 lines · Eric Biggers
FYI, the KUnit test
arch/powerpc/kvm/test-guest-state-buffer.cis failing when run in QEMU PPC64LE:[ 146.554299][ T1] KTAP version 1^M [ 146.554348][ T1] # Subtest: guest_state_buffer_test^M [ 146.554543][ T1] # module: test_guest_state_buffer^M [ 146.554927][ T1] 1..7^M [ 146.556873][ T1] ok 1 test_creating_buffer^M [ 146.558221][ T1] ok 2 test_adding_element^M [ 146.559532][ T1] ok 3 test_gs_bitmap^M [ 146.560309][ T1] ok 4 test_gs_parsing^M [ 146.561246][ T1] ok 5 test_gs_msg^M [ 146.562116][ T1] ok 6 test_gs_hostwide_msg^M [ 146.562911][ T428] # test_gs_hostwide_counters: ASSERTION FAILED at arch/powerpc/kvm/test-guest-state-buffer.c:488^M [ 146.562911][ T428] Expected rc == 0, but^M [ 146.562911][ T428] rc == -2 (0xfffffffffffffffe)^M [ 146.563600][ T1] not ok 7 test_gs_hostwide_counters^M [ 146.563653][ T1] # guest_state_buffer_test: pass:6 fail:1 skip:0 total:7^MTested on next-20260602. I haven't bisected it.
Note that this test is in the defconfig.
- Eric
Signature · 2 lines
Cheers ~ Vaibhav
Quoted 6 lines · Vaibhav Jain
Hi Eric,
Thanks for trying and reporting this. This kunit test depends on availablility of Qemu commit 5f7d861e("spapr: nested: Add support for reporting Hostwide state counter ") [1] that was merged in v10.0.0.
Quoted 8 lines
Since you havent mentioned the qemu version used I assume its a version < v10.0.0 . With the qemu patch available you should see this test passing with results similar to as originally described in original cover letter of the patch series at [2] that introduced this kunit test.
[1] https://gitlab.com/qemu-project/qemu/-/commit/5f7d861e65d90e0446b8f22a0bc859a5d8058ea6
Nope, it fails even on the master branch of QEMU.
- Eric
Hi Eric,
I just successfully tested this kunit test on kernel tag next-20260602 and qemu master HEAD == 405c32d2b18a("Merge tag 'pull-tpm-2026-06-01-1' of https://github.com/stefanberger/qemu-tpm into staging") [1]
If you are using Qemu >= v10.0.0 then the kunit test failure you reported is due to Qemu not enabling 'cap-nested-papr' capability which is needed to enable KVM-HV Apiv2 support in Qemu.
Without 'cap-nested-papr' Qemu doesnt register the H_GUEST_GET_STATE Hcall which this kunit test relies on. Hence it returns -2 (H_FUNCTION) for this unsupported HCall. The failure of kunit 'test_gs_hostwide_msg' is expected as the underlying hypervisor doesnt have support nested-papr APIv2 capability.
To fix this please enable qemu-system-ppc64 machine's capability cap-nested-papr to enable nested-papr APIv2 support.
Below is the test log showing successful 'guest_state_buffer_test' kunit test passing :
$ ./qemu-system-ppc64 --version QEMU emulator version 11.0.50 (v11.0.0-1621-g405c32d2b1) Copyright (c) 2003-2026 Fabrice Bellard and the QEMU Project developers
# kunit test is specific to nested-papr APIv2 so qemu cap-nested-papr needs to be enabled $ ./qemu-system-ppc64 -display none -nographic -kernel ~/linux/vmlinux -machine pseries,cap-nested-papr=true
<snip>
Booting from memory...
OF stdout device is: /vdevice/vty@71000000
Preparing to boot Linux version 7.1.0-rc6-next-20260602 (vaibhav@*********) (gcc (GCC) 16.1.1 20260515 (Red Hat 16.1.1-2), GNU ld version 2.46-3.fc44) #2 SMP PREEMPT Wed Jun 3 04:11:38 CDT 2026 Detected machine type: 0000000000000101
<snip>
[ 4.335850][ T1] KTAP version 1 [ 4.335896][ T1] # Subtest: guest_state_buffer_test [ 4.335946][ T1] # module: test_guest_state_buffer [ 4.335970][ T1] 1..7 [ 4.337296][ T1] ok 1 test_creating_buffer [ 4.338998][ T1] ok 2 test_adding_element [ 4.341996][ T1] ok 3 test_gs_bitmap [ 4.343406][ T1] ok 4 test_gs_parsing [ 4.345607][ T1] ok 5 test_gs_msg [ 4.347247][ T1] ok 6 test_gs_hostwide_msg [ 4.348012][ T131] # test_gs_hostwide_counters: Guest Heap Size=0 bytes [ 4.348183][ T131] # test_gs_hostwide_counters: Guest Heap Size Max=0 bytes [ 4.348350][ T131] # test_gs_hostwide_counters: Guest Page-table Size=0 bytes [ 4.348653][ T131] # test_gs_hostwide_counters: Guest Page-table Size Max=0 bytes [ 4.348813][ T131] # test_gs_hostwide_counters: Guest Page-table Reclaim Size=0 bytes [ 4.349354][ T1] ok 7 test_gs_hostwide_counters [ 4.349569][ T1] # guest_state_buffer_test: pass:7 fail:0 skip:0 total:7 [ 4.349635][ T1] # Totals: pass:7 fail:0 skip:0 total:7 [ 4.349708][ T1] ok 4 guest_state_buffer_test
Can you try adding 'cap-nested-papr=true' to the Qemu machine you are using and see if the problem resolves for you. If it persists can you please share the Qemu command line you are using.
[1] https://gitlab.com/qemu-project/qemu/-/commit/405c32d2b18a683ba36301351af75125d9afda08
Quoted 19 lines · Eric Biggers
Quoted 6 lines · Vaibhav Jain
Hi Eric,
Thanks for trying and reporting this. This kunit test depends on availablility of Qemu commit 5f7d861e("spapr: nested: Add support for reporting Hostwide state counter ") [1] that was merged in v10.0.0.
Quoted 8 lines
Since you havent mentioned the qemu version used I assume its a version < v10.0.0 . With the qemu patch available you should see this test passing with results similar to as originally described in original cover letter of the patch series at [2] that introduced this kunit test.
[1] https://gitlab.com/qemu-project/qemu/-/commit/5f7d861e65d90e0446b8f22a0bc859a5d8058ea6
Nope, it fails even on the master branch of QEMU.
- Eric
Signature · 2 lines
Cheers ~ Vaibhav