linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org
Subject: Re: [PATCH v3 3/6] KVM: PPC: selftests: add support for powerpc
Date: Wed, 14 Jun 2023 00:20:59 +0000	[thread overview]
Message-ID: <CACPK8XeuaKwaWTC47Yd7945WnTOx7nAgMj-HHdo7Ys9mvqarGA@mail.gmail.com> (raw)
In-Reply-To: <20230608032425.59796-4-npiggin@gmail.com>

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

On Thu, 8 Jun 2023 at 03:28, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Implement KVM selftests support for powerpc (Book3S-64).
>
> ucalls are implemented with an unsuppored PAPR hcall number which will
> always cause KVM to exit to userspace.
>
> Virtual memory is implemented for the radix MMU, and only a base page
> size is supported (both 4K and 64K).
>
> Guest interrupts are taken in real-mode, so require a page allocated at
> gRA 0x0. Interrupt entry is complicated because gVA:gRA is not 1:1 mapped
> (like the kernel is), so the MMU can not just just be switched on and
> off.

I saw a few failures on a power9 running Ubuntu's 6.2.0-20-generic kernel:

# selftests: kvm: kvm_create_max_vcpus
# KVM_CAP_MAX_VCPU_ID: 16384
# KVM_CAP_MAX_VCPUS: 2048
# Testing creating 2048 vCPUs, with IDs 0...2047.
# Testing creating 2048 vCPUs, with IDs 14336...16383.
# ==== Test Assertion Failure ====
#   lib/kvm_util.c:1221: vcpu->fd >= 0
#   pid=40390 tid=40390 errno=22 - Invalid argument
#      1    0x0000000010006903: __vm_vcpu_add at kvm_util.c:1221
#      2    0x0000000010002e53: test_vcpu_creation at
kvm_create_max_vcpus.c:35 (discriminator 3)
#      3    0x0000000010002953: main at kvm_create_max_vcpus.c:90
#      4    0x0000795fb3224c23: ?? ??:0
#      5    0x0000795fb3224e6b: ?? ??:0
#   KVM_CREATE_VCPU failed, rc: -1 errno: 22 (Invalid argument)
not ok 10 selftests: kvm: kvm_create_max_vcpus # exit=254

# selftests: kvm: max_guest_memory_test
# No guest physical pages available, paddr_min: 0x180000 page_size:
0x10000 memslot: 0 num_pages: 1 align: 1
# ---- vm dump ----
#   mode: 0xc
#   fd: 6
#   page_size: 0x10000
#   Mem Regions:
#     guest_phys: 0x0 size: 0x4200000 host_virt: 0x7ce4c0800000
#     unused_phy_pages: 0x1
#   Mapped Virtual Pages:
#     0x1, 0xac:0x183, 0x1000:0x1003
#   pgd_created: 1
#     Virtual Translation Tables:
#     Virtual Translation Tables:
#       PDE1[0] gVA:0x0000000000000000
#         PDE2[0] gVA:0x0000000000000000
#           PDE3[0] gVA:0x0000000000000000
#              PTE[1] gVA:0x0000000000010000 -> gRA:0x0000000000060000
#           PDE3[5] gVA:0x0000000000a00000
#              PTE[12] gVA:0x0000000000ac0000 -> gRA:0x0000000000070000

and then finally:

# ==== Test Assertion Failure ====
#   lib/kvm_util.c:1962: false
#   pid=40446 tid=40446 errno=0 - Success
#      1    0x0000000010008f83: vm_phy_pages_alloc_align at kvm_util.c:1962
#      2    0x00000000100110d3: __virt_arch_pg_map at processor.c:232
#      3    0x0000000010002bcf: virt_pg_map at kvm_util_base.h:877
(discriminator 3)
#      4     (inlined by) main at max_guest_memory_test.c:249 (discriminator 3)
#      5    0x00007ce4c4a24c23: ?? ??:0
#      6    0x00007ce4c4a24e6b: ?? ??:0
#   false
not ok 12 selftests: kvm: max_guest_memory_test # exit=254


# selftests: kvm: rseq_test
# ==== Test Assertion Failure ====
#   rseq_test.c:258: i > (NR_TASK_MIGRATIONS / 2)
#   pid=40529 tid=40529 errno=4 - Interrupted system call
#      1    0x0000000010002e57: main at rseq_test.c:258
#      2    0x00007369e2824c23: ?? ??:0
#      3    0x00007369e2824e6b: ?? ??:0
#   Only performed 32590 KVM_RUNs, task stalled too much?
#
not ok 15 selftests: kvm: rseq_test # exit=254

I have attached the log from the full test run.

>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

> +#ifdef __powerpc__
> +       {
> +               TEST_ASSERT(kvm_check_cap(KVM_CAP_PPC_MMU_RADIX),
> +                           "Radix MMU not available, KVM selftests "
> +                           "does not support Hash MMU!");

Back on the power8 system, this produces a backtrace along with the warning:

TAP version 13
1..17
# selftests: kvm: interrupt_perf
# ==== Test Assertion Failure ====
#   lib/guest_modes.c:95: kvm_check_cap(KVM_CAP_PPC_MMU_RADIX)
#   pid=3800487 tid=3800487 errno=0 - Success
#      1    0x0000000010003d57: guest_modes_append_default at guest_modes.c:95
#      2    0x0000000010011d67: kvm_selftest_arch_init at processor.c:540
#      3    0x00000000100029af: kvm_selftest_init at kvm_util.c:2178
#      4    0x000000001001325b: __libc_csu_init at ??:?
#      5    0x0000742d64f54c5b: ?? ??:0
#      6    0x0000742d64f54ea3: ?? ??:0
#   Radix MMU not available, KVM selftests does not support Hash MMU!
not ok 1 selftests: kvm: interrupt_perf # exit=254

You could instead use TEST_REQUIRE:

TAP version 131..17
# selftests: kvm: interrupt_perf
# 1..0 # SKIP - Requirement not met: kvm_check_cap(KVM_CAP_PPC_MMU_RADIX)
ok 1 selftests: kvm: interrupt_perf # SKIP


> +               /* Radix guest EA and RA are 52-bit on POWER9 and POWER10 */
> +               if (sysconf(_SC_PAGESIZE) == 4096)
> +                       vm_mode_default = VM_MODE_P52V52_4K;
> +               else
> +                       vm_mode_default = VM_MODE_P52V52_64K;
> +               guest_mode_append(VM_MODE_P52V52_4K, true, true);
> +               guest_mode_append(VM_MODE_P52V52_64K, true, true);
> +       }
> +#endif
>  }

[-- Attachment #2: kvm-selftests-powerpc-6.2.txt.gz --]
[-- Type: application/gzip, Size: 168609 bytes --]

  reply	other threads:[~2023-06-14  1:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08  3:24 [PATCH v3 0/6] KVM: selftests: add powerpc support Nicholas Piggin
2023-06-08  3:24 ` [PATCH v3 1/6] KVM: selftests: Move pgd_created check into virt_pgd_alloc Nicholas Piggin
2023-06-08  3:24 ` [PATCH v3 2/6] KVM: selftests: Add aligned guest physical page allocator Nicholas Piggin
2023-06-08  3:24 ` [PATCH v3 3/6] KVM: PPC: selftests: add support for powerpc Nicholas Piggin
2023-06-14  0:20   ` Joel Stanley [this message]
2023-08-02 22:44   ` Sean Christopherson
2023-06-08  3:24 ` [PATCH v3 4/6] KVM: PPC: selftests: add selftests sanity tests Nicholas Piggin
2023-06-08  3:24 ` [PATCH v3 5/6] KVM: PPC: selftests: Add a TLBIEL virtualisation tester Nicholas Piggin
2023-06-08  3:24 ` [PATCH v3 6/6] KVM: PPC: selftests: Add interrupt performance tester Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACPK8XeuaKwaWTC47Yd7945WnTOx7nAgMj-HHdo7Ys9mvqarGA@mail.gmail.com \
    --to=joel@jms.id.au \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).