Re: [kvm-unit-tests PATCH v8 03/35] migration: Add a migrate_skip command

2024-04-15 Thread Nicholas Piggin
On Tue Apr 9, 2024 at 1:59 AM AEST, Nico Boehr wrote: > Quoting Nicholas Piggin (2024-04-05 10:35:04) > [...] > > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash > > index 39419d4e2..4a1aab48d 100644 > > --- a/scripts/arch-run.bash > > +++ b/scripts/arch-

Re: [RFC PATCH] powerpc: Optimise barriers for fully ordered atomics

2024-04-15 Thread Nicholas Piggin
On Sat Apr 13, 2024 at 7:48 PM AEST, Michael Ellerman wrote: > Nicholas Piggin writes: > > "Fully ordered" atomics (RMW that return a value) are said to have a > > full barrier before and after the atomic operation. This is implemented > > as: > > > &g

[RFC PATCH] powerpc: Optimise barriers for fully ordered atomics

2024-04-12 Thread Nicholas Piggin
ack atomic ops on cached memory. [ Remains to be seen if this is always faster when there is other activity going on, and if it's faster on non-POEWR CPUs or perhaps older ones like 970 that might not optimise isync so much. ] Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/synch.h |

Re: [PATCH] KVM: PPC: Book3S HV nestedv2: Cancel pending HDEC exception

2024-04-09 Thread Nicholas Piggin
On Mon Apr 8, 2024 at 3:20 PM AEST, Michael Ellerman wrote: > Thorsten Leemhuis writes: > > On 05.04.24 05:20, Michael Ellerman wrote: > >> "Linux regression tracking (Thorsten Leemhuis)" > >> writes: > >>> Hi, Thorsten here, the Linux kernel's regression tracker. Top-posting > >>> for once, to

[kvm-unit-tests PATCH v8 35/35] powerpc: gitlab CI update

2024-04-05 Thread Nicholas Piggin
This adds testing for the powernv machine, and adds a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml| 30 -- powerpc/unittests.cfg | 14 -- 2 files changed, 16 insertions

[kvm-unit-tests PATCH v8 34/35] powerpc: Remove remnants of ppc64 directory and build structure

2024-04-05 Thread Nicholas Piggin
This moves merges ppc64 directories and files into powerpc, and merges the 3 makefiles into one. The configure --arch=powerpc option is aliased to ppc64 for good measure. Signed-off-by: Nicholas Piggin --- MAINTAINERS| 1 - configure

[kvm-unit-tests PATCH v8 33/35] configure: Make arch_libdir a first-class entity

2024-04-05 Thread Nicholas Piggin
dev Cc: kvm-ri...@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- Makefile | 2 +- configure | 18 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4f35fffc6..4e0f54543

[kvm-unit-tests PATCH v8 32/35] powerpc: add pmu tests

2024-04-05 Thread Nicholas Piggin
Add some initial PMU testing. - PMC5/6 tests - PMAE / PMI test - BHRB basic tests Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 2 + lib/powerpc/asm/reg.h | 9 + lib/powerpc/asm/setup.h | 1 + lib/powerpc/setup.c | 23 ++ powerpc/Makefile.common

[kvm-unit-tests PATCH v8 31/35] powerpc: add usermode support

2024-04-05 Thread Nicholas Piggin
instruction interrupt test is added. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 9 + lib/powerpc/asm/reg.h | 1 + lib/powerpc/asm/smp.h | 1 + lib/powerpc/io.c| 7 +++ lib/powerpc/processor.c | 38

[kvm-unit-tests PATCH v8 30/35] powerpc: Add sieve.c common test

2024-04-05 Thread Nicholas Piggin
Now that sieve copes with lack of MMU support, it can be run by powerpc. Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/sieve.c | 1 + powerpc/unittests.cfg | 3 +++ 3 files changed, 5 insertions(+) create mode 12 powerpc/sieve.c diff --git a/powerpc

[kvm-unit-tests PATCH v8 29/35] common/sieve: Support machines without MMU

2024-04-05 Thread Nicholas Piggin
Not all powerpc CPUs provide MMU support. Define vm_available() that is true by default but archs can override it. Use this to run VM tests. Cc: Paolo Bonzini Cc: Thomas Huth Cc: k...@vger.kernel.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- common/sieve.c | 14

[kvm-unit-tests PATCH v8 28/35] common/sieve: Use vmalloc.h for setup_mmu definition

2024-04-05 Thread Nicholas Piggin
-by: Nicholas Piggin --- common/sieve.c | 1 + lib/libcflat.h | 2 -- lib/s390x/io.c | 1 + lib/s390x/uv.h | 1 + lib/x86/vm.h | 1 + s390x/mvpg.c | 1 + s390x/selftest.c | 1 + x86/pmu.c | 1 + x86/pmu_lbr.c | 1 + x86

[kvm-unit-tests PATCH v8 27/35] powerpc: Add MMU support

2024-04-05 Thread Nicholas Piggin
Add support for radix MMU, 4kB and 64kB pages. This also adds MMU interrupt test cases, and runs the interrupts test entirely with MMU enabled if it is available (aside from machine check tests). Acked-by: Andrew Jones (configure changes) Signed-off-by: Nicholas Piggin --- configure

[kvm-unit-tests PATCH v8 26/35] powerpc: Add timebase tests

2024-04-05 Thread Nicholas Piggin
This has a known failure on QEMU TCG machines where the decrementer interrupt is not lowered when the DEC wraps from -ve to +ve. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 1 + powerpc/Makefile.common | 1 + powerpc/timebase.c | 329

[kvm-unit-tests PATCH v8 25/35] powerpc: Add atomics tests

2024-04-05 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/atomics.c | 374 powerpc/unittests.cfg | 9 + 3 files changed, 384 insertions(+) create mode 100644 powerpc/atomics.c diff --git a/powerpc/Makefile.common b/powerpc

[kvm-unit-tests PATCH v8 24/35] powerpc: Avoid using larx/stcx. in spinlocks when only one CPU is running

2024-04-05 Thread Nicholas Piggin
The test harness uses spinlocks if they are implemented with larx/stcx. it can prevent some test scenarios such as testing migration of a reservation. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/smp.h| 1 + lib/powerpc/smp.c| 5 + lib/powerpc/spinlock.c | 29

[kvm-unit-tests PATCH v8 23/35] powerpc: Permit ACCEL=tcg,thread=single

2024-04-05 Thread Nicholas Piggin
Modify run script to permit single vs mttcg threading, add a thread=single smp case to unittests.cfg. Signed-off-by: Nicholas Piggin --- powerpc/run | 4 ++-- powerpc/unittests.cfg | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/powerpc/run b/powerpc/run

[kvm-unit-tests PATCH v8 22/35] powerpc: add SMP and IPI support

2024-04-05 Thread Nicholas Piggin
powerpc SMP support is very primitive and does not set up a first-class runtime environment for secondary CPUs. This reworks SMP support, and provides a complete C and harness environment for the secondaries, including interrupt handling, as well as IPI support. Signed-off-by: Nicholas Piggin

[kvm-unit-tests PATCH v8 21/35] powerpc: Remove broken SMP exception stack setup

2024-04-05 Thread Nicholas Piggin
stack for the boot processor. Make the stack 64kB while we're here, to match the size of the regular stack. Signed-off-by: Nicholas Piggin --- lib/powerpc/setup.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index

[kvm-unit-tests PATCH v8 20/35] powerpc: Add rtas stop-self support

2024-04-05 Thread Nicholas Piggin
rtas operations. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/rtas.h | 2 ++ lib/powerpc/rtas.c | 78 +- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/lib/powerpc/asm/rtas.h b/lib/powerpc/asm/rtas.h

[kvm-unit-tests PATCH v8 19/35] powerpc: general interrupt tests

2024-04-05 Thread Nicholas Piggin
Add basic testing of various kinds of interrupts, machine check, page fault, illegal, decrementer, trace, syscall, etc. This has a known failure on QEMU TCG pseries machines where MSR[ME] can be incorrectly set to 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 4 + lib

[kvm-unit-tests PATCH v8 18/35] powerpc/sprs: Test hypervisor registers on powernv machine

2024-04-05 Thread Nicholas Piggin
This enables HV privilege registers to be tested with the powernv machine. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/sprs.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/powerpc/sprs.c b/powerpc/sprs.c index

[kvm-unit-tests PATCH v8 17/35] powerpc: Fix emulator illegal instruction test for powernv

2024-04-05 Thread Nicholas Piggin
Illegal instructions cause 0xe40 (HEAI) interrupts rather than program interrupts. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 1 + lib/powerpc/setup.c | 13 + powerpc/emulator.c | 16 3 files changed, 30

[kvm-unit-tests PATCH v8 16/35] powerpc: Support powernv machine with QEMU TCG

2024-04-05 Thread Nicholas Piggin
Add support for QEMU's powernv machine. This uses standard firmware (skiboot) rather than a minimal firmware shim. Reviewed-by: Cédric Le Goater Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 23 +++ lib/powerpc/asm/reg.h | 4 ++ lib/powerpc/hcall.c

[kvm-unit-tests PATCH v8 15/35] scripts: Accommodate powerpc powernv machine differences

2024-04-05 Thread Nicholas Piggin
error message. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/unittests.cfg | 1 + scripts/runtime.bash | 6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 432c81d58..4929e71a1 100644 --- a/powerpc

[kvm-unit-tests PATCH v8 14/35] scripts: allow machine option to be specified in unittests.cfg

2024-04-05 Thread Nicholas Piggin
This allows different machines with different requirements to be supported by run_tests.sh, similarly to how different accelerators are handled. Acked-by: Thomas Huth Acked-by: Andrew Jones Signed-off-by: Nicholas Piggin --- docs/unittests.txt | 6 ++ scripts/common.bash | 8

[kvm-unit-tests PATCH v8 13/35] doc: start documentation directory with unittests.cfg doc

2024-04-05 Thread Nicholas Piggin
Consolidate unittests.cfg documentation in one place. Suggested-by: Andrew Jones Signed-off-by: Nicholas Piggin --- arm/unittests.cfg | 26 ++--- docs/unittests.txt| 89 +++ powerpc/unittests.cfg | 25 ++-- riscv/unittests.cfg

[kvm-unit-tests PATCH v8 12/35] powerpc/sprs: Avoid taking PMU interrupts caused by register fuzzing

2024-04-05 Thread Nicholas Piggin
Storing certain values in MMCR0 can cause PMU interrupts when msleep enables MSR[EE], and this crashes the test. Freeze the PMU counters and clear any PMU exception before calling msleep. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 4 powerpc

[kvm-unit-tests PATCH v8 11/35] powerpc/sprs: Specify SPRs with data rather than code

2024-04-05 Thread Nicholas Piggin
, but also the code might one day be reused for a hypervisor-privileged test. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 2 + powerpc/sprs.c| 647 +- 2 files changed, 457 insertions(+), 192 deletions(-) diff --git

[kvm-unit-tests PATCH v8 10/35] powerpc: interrupt stack backtracing

2024-04-05 Thread Nicholas Piggin
, so the unwinder can recognize the initial interrupt frame. The additional cstart entry-frame is no longer required because the unwinder now looks for frame == 0 as well as address == 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/processor.c | 4 +++- lib/ppc64/asm/stack.h | 3 +++ lib

[kvm-unit-tests PATCH v8 09/35] powerpc: Fix stack backtrace termination

2024-04-05 Thread Nicholas Piggin
if it were a stack frame. But this is fragile, and does not work with powernv where address 0 contains firmware instructions. Use the existing dummy frame on stack as the NULL caller, and create a new frame on stack for the entry code. Signed-off-by: Nicholas Piggin --- powerpc/cstart64.S | 15

[kvm-unit-tests PATCH v8 08/35] powerpc: Fix KVM caps on POWER9 hosts

2024-04-05 Thread Nicholas Piggin
KVM does not like to run on POWER9 hosts without cap-ccf-assist=off. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/run | 2 ++ 1 file changed, 2 insertions(+) diff --git a/powerpc/run b/powerpc/run index e469f1eb3..5cdb94194 100755 --- a/powerpc/run +++ b/powerpc/run

[kvm-unit-tests PATCH v8 07/35] common: add memory dirtying vs migration test

2024-04-05 Thread Nicholas Piggin
. The selftest-migration test time is reduced significantly because this test Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- common/memory-verify.c | 68 + common/selftest-migration.c | 8 ++--- powerpc/Makefile.common | 1 + powerpc/memory-verify.c

[kvm-unit-tests PATCH v8 06/35] gitlab-ci: Run migration selftest on s390x and powerpc

2024-04-05 Thread Nicholas Piggin
The migration harness is complicated and easy to break so CI will be helpful. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml | 32 +++- s390x/unittests.cfg | 8 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab

[kvm-unit-tests PATCH v8 05/35] arch-run: Add a "continuous" migration option for tests

2024-04-05 Thread Nicholas Piggin
cooperative migration iterations reduced to avoid increasing test time too much. Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 16 +-- lib/migrate.c | 18 lib/migrate.h | 3 ++ scripts/arch-run.bash | 55

[kvm-unit-tests PATCH v8 04/35] (arm|s390): Use migrate_skip in test cases

2024-04-05 Thread Nicholas Piggin
Have tests use the new migrate_skip command in skip paths, rather than calling migrate_once to prevent harness reporting an error. s390x/migration.c adds a new command that looks like it was missing previously. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- arm/gic.c

[kvm-unit-tests PATCH v8 03/35] migration: Add a migrate_skip command

2024-04-05 Thread Nicholas Piggin
a migration. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 14 - lib/migrate.c | 19 - lib/migrate.h | 2 ++ powerpc/unittests.cfg | 6 ++ s390x/unittests.cfg | 5 + scripts/arch

[kvm-unit-tests PATCH v8 02/35] arch-run: Keep infifo open

2024-04-05 Thread Nicholas Piggin
files and fifos so it does not have to be removed explicitly. With this we can let the cat out of the subshell, simplifying the input pipeline. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions

[kvm-unit-tests PATCH v8 01/35] arch-run: Add functions to help handle migration directives from test

2024-04-05 Thread Nicholas Piggin
The migration harness will be expanded to deal with more commands from the test, moving these checks into functions helps keep things managable. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 20 +++- 1 file changed, 15 insertions(+), 5

[kvm-unit-tests PATCH v8 00/35] migration, powerpc improvements

2024-04-05 Thread Nicholas Piggin
/msg00567.html) Thanks, Nick Nicholas Piggin (35): arch-run: Add functions to help handle migration directives from test arch-run: Keep infifo open migration: Add a migrate_skip command (arm|s390): Use migrate_skip in test cases arch-run: Add a "continuous" migration option for test

Re: [kvm-unit-tests PATCH v7 07/35] common: add memory dirtying vs migration test

2024-04-04 Thread Nicholas Piggin
On Fri Mar 29, 2024 at 3:37 AM AEST, Thomas Huth wrote: > On 19/03/2024 08.58, Nicholas Piggin wrote: > > This test stores to a bunch of pages and verifies previous stores, > > while being continually migrated. Default runtime is 5 seconds. > > > > Add this tes

Re: [kvm-unit-tests PATCH v7 06/35] gitlab-ci: Run migration selftest on s390x and powerpc

2024-03-28 Thread Nicholas Piggin
On Tue Mar 26, 2024 at 2:08 AM AEST, Thomas Huth wrote: > On 19/03/2024 08.58, Nicholas Piggin wrote: > > The migration harness is complicated and easy to break so CI will > > be helpful. > > > > Signed-off-by: Nicholas Piggin > > --- > > .gitlab-ci.yml

Re: [PATCH] arch/powerpc/kvm: Add support for reading VPA counters for pseries guests

2024-03-20 Thread Nicholas Piggin
On Wed Mar 20, 2024 at 12:28 AM AEST, Gautam Menghani wrote: > PAPR hypervisor has introduced three new counters in the VPA area of > LPAR CPUs for KVM L2 guest (see [1] for terminology) observability - 2 > for context switches from host to guest and vice versa, and 1 counter > for getting the

Re: [PATCH] KVM: PPC: Book3S HV nestedv2: Cancel pending HDEC exception

2024-03-20 Thread Nicholas Piggin
On Wed Mar 13, 2024 at 5:26 PM AEST, Vaibhav Jain wrote: > This reverts commit 180c6b072bf360b686e53d893d8dcf7dbbaec6bb ("KVM: PPC: > Book3S HV nestedv2: Do not cancel pending decrementer exception") which > prevented cancelling a pending HDEC exception for nestedv2 KVM guests. It > was done to

[kvm-unit-tests PATCH v7 35/35] powerpc: gitlab CI update

2024-03-19 Thread Nicholas Piggin
This adds testing for the powernv machine, and adds a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml| 20 powerpc/unittests.cfg | 14 -- 2 files changed, 16 insertions(+), 18

[kvm-unit-tests PATCH v7 34/35] powerpc: Remove remnants of ppc64 directory and build structure

2024-03-19 Thread Nicholas Piggin
This moves merges ppc64 directories and files into powerpc, and merges the 3 makefiles into one. The configure --arch=powerpc option is aliased to ppc64 for good measure. Signed-off-by: Nicholas Piggin --- MAINTAINERS| 1 - configure

[kvm-unit-tests PATCH v7 33/35] configure: Make arch_libdir a first-class entity

2024-03-19 Thread Nicholas Piggin
dev Cc: kvm-ri...@lists.infradead.org Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- Makefile | 2 +- configure | 18 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4f35fffc6..4e0f54543

[kvm-unit-tests PATCH v7 32/35] powerpc: add pmu tests

2024-03-19 Thread Nicholas Piggin
Add some initial PMU testing. - PMC5/6 tests - PMAE / PMI test - BHRB basic tests Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 2 + lib/powerpc/asm/reg.h | 9 + lib/powerpc/asm/setup.h | 1 + lib/powerpc/setup.c | 23 +++ powerpc/Makefile.common

[kvm-unit-tests PATCH v7 31/35] powerpc: add usermode support

2024-03-19 Thread Nicholas Piggin
instruction interrupt test is added. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 9 + lib/powerpc/asm/reg.h | 1 + lib/powerpc/asm/smp.h | 1 + lib/powerpc/io.c| 7 +++ lib/powerpc/processor.c | 38

[kvm-unit-tests PATCH v7 30/35] powerpc: Add sieve.c common test

2024-03-19 Thread Nicholas Piggin
Now that sieve copes with lack of MMU support, it can be run by powerpc. Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/sieve.c | 1 + powerpc/unittests.cfg | 3 +++ 3 files changed, 5 insertions(+) create mode 12 powerpc/sieve.c diff --git a/powerpc

[kvm-unit-tests PATCH v7 29/35] common/sieve: Support machines without MMU

2024-03-19 Thread Nicholas Piggin
Not all powerpc CPUs provide MMU support. Define vm_available() that is true by default but archs can override it. Use this to run VM tests. Cc: Paolo Bonzini Cc: Thomas Huth Cc: k...@vger.kernel.org Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- common/sieve.c | 14

[kvm-unit-tests PATCH v7 28/35] common/sieve: Use vmalloc.h for setup_mmu definition

2024-03-19 Thread Nicholas Piggin
-by: Nicholas Piggin --- common/sieve.c | 1 + lib/libcflat.h | 2 -- lib/s390x/io.c | 1 + lib/s390x/uv.h | 1 + lib/x86/vm.h | 1 + s390x/mvpg.c | 1 + s390x/selftest.c | 1 + x86/pmu.c | 1 + x86/pmu_lbr.c | 1 + x86

[kvm-unit-tests PATCH v7 27/35] powerpc: Add MMU support

2024-03-19 Thread Nicholas Piggin
Add support for radix MMU, 4kB and 64kB pages. This also adds MMU interrupt test cases, and runs the interrupts test entirely with MMU enabled if it is available (aside from machine check tests). Acked-by: Andrew Jones (configure changes) Signed-off-by: Nicholas Piggin --- configure

[kvm-unit-tests PATCH v7 26/35] powerpc: Add timebase tests

2024-03-19 Thread Nicholas Piggin
This has a known failure on QEMU TCG machines where the decrementer interrupt is not lowered when the DEC wraps from -ve to +ve. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 1 + powerpc/Makefile.common | 1 + powerpc/timebase.c | 329

[kvm-unit-tests PATCH v7 25/35] powerpc: Add atomics tests

2024-03-19 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- powerpc/Makefile.common | 1 + powerpc/atomics.c | 374 powerpc/unittests.cfg | 9 + 3 files changed, 384 insertions(+) create mode 100644 powerpc/atomics.c diff --git a/powerpc/Makefile.common b/powerpc

[kvm-unit-tests PATCH v7 24/35] powerpc: Avoid using larx/stcx. in spinlocks when only one CPU is running

2024-03-19 Thread Nicholas Piggin
The test harness uses spinlocks if they are implemented with larx/stcx. it can prevent some test scenarios such as testing migration of a reservation. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/smp.h| 1 + lib/powerpc/smp.c| 5 + lib/powerpc/spinlock.c | 29

[kvm-unit-tests PATCH v7 23/35] powerpc: Permit ACCEL=tcg,thread=single

2024-03-19 Thread Nicholas Piggin
Modify run script to permit single vs mttcg threading, add a thread=single smp case to unittests.cfg. Signed-off-by: Nicholas Piggin --- powerpc/run | 4 ++-- powerpc/unittests.cfg | 6 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/powerpc/run b/powerpc/run

[kvm-unit-tests PATCH v7 22/35] powerpc: add SMP and IPI support

2024-03-19 Thread Nicholas Piggin
powerpc SMP support is very primitive and does not set up a first-class runtime environment for secondary CPUs. This reworks SMP support, and provides a complete C and harness environment for the secondaries, including interrupt handling, as well as IPI support. Signed-off-by: Nicholas Piggin

[kvm-unit-tests PATCH v7 21/35] powerpc: Remove broken SMP exception stack setup

2024-03-19 Thread Nicholas Piggin
stack for the boot processor. Make the stack 64kB while we're here, to match the size of the regular stack. Signed-off-by: Nicholas Piggin --- lib/powerpc/setup.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/powerpc/setup.c b/lib/powerpc/setup.c index

[kvm-unit-tests PATCH v7 20/35] powerpc: Add rtas stop-self support

2024-03-19 Thread Nicholas Piggin
rtas operations. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/rtas.h | 2 ++ lib/powerpc/rtas.c | 78 +- 2 files changed, 64 insertions(+), 16 deletions(-) diff --git a/lib/powerpc/asm/rtas.h b/lib/powerpc/asm/rtas.h

[kvm-unit-tests PATCH v7 19/35] powerpc: general interrupt tests

2024-03-19 Thread Nicholas Piggin
Add basic testing of various kinds of interrupts, machine check, page fault, illegal, decrementer, trace, syscall, etc. This has a known failure on QEMU TCG pseries machines where MSR[ME] can be incorrectly set to 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 4 + lib

[kvm-unit-tests PATCH v7 18/35] powerpc/sprs: Test hypervisor registers on powernv machine

2024-03-19 Thread Nicholas Piggin
This enables HV privilege registers to be tested with the powernv machine. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/sprs.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/powerpc/sprs.c b/powerpc/sprs.c index

[kvm-unit-tests PATCH v7 17/35] powerpc: Fix emulator illegal instruction test for powernv

2024-03-19 Thread Nicholas Piggin
Illegal instructions cause 0xe40 (HEAI) interrupts rather than program interrupts. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 1 + lib/powerpc/setup.c | 13 + powerpc/emulator.c | 16 3 files changed, 30

[kvm-unit-tests PATCH v7 16/35] powerpc: Support powernv machine with QEMU TCG

2024-03-19 Thread Nicholas Piggin
Add support for QEMU's powernv machine. This uses standard firmware (skiboot) rather than a minimal firmware shim. Reviewed-by: Cédric Le Goater Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/processor.h | 23 +++ lib/powerpc/asm/reg.h | 4 ++ lib/powerpc/hcall.c

[kvm-unit-tests PATCH v7 15/35] scripts: Accommodate powerpc powernv machine differences

2024-03-19 Thread Nicholas Piggin
error message. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/unittests.cfg | 1 + scripts/runtime.bash | 6 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/powerpc/unittests.cfg b/powerpc/unittests.cfg index 432c81d58..4929e71a1 100644 --- a/powerpc

[kvm-unit-tests PATCH v7 14/35] scripts: allow machine option to be specified in unittests.cfg

2024-03-19 Thread Nicholas Piggin
This allows different machines with different requirements to be supported by run_tests.sh, similarly to how different accelerators are handled. Acked-by: Thomas Huth Acked-by: Andrew Jones Signed-off-by: Nicholas Piggin --- docs/unittests.txt | 6 ++ scripts/common.bash | 8

[kvm-unit-tests PATCH v7 13/35] doc: start documentation directory with unittests.cfg doc

2024-03-19 Thread Nicholas Piggin
Consolidate unittests.cfg documentation in one place. Suggested-by: Andrew Jones Signed-off-by: Nicholas Piggin --- arm/unittests.cfg | 26 ++--- docs/unittests.txt| 89 +++ powerpc/unittests.cfg | 25 ++-- riscv/unittests.cfg

[kvm-unit-tests PATCH v7 12/35] powerpc/sprs: Avoid taking PMU interrupts caused by register fuzzing

2024-03-19 Thread Nicholas Piggin
Storing certain values in MMCR0 can cause PMU interrupts when msleep enables MSR[EE], and this crashes the test. Freeze the PMU counters and clear any PMU exception before calling msleep. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 4 powerpc

[kvm-unit-tests PATCH v7 11/35] powerpc/sprs: Specify SPRs with data rather than code

2024-03-19 Thread Nicholas Piggin
, but also the code might one day be reused for a hypervisor-privileged test. Acked-by: Thomas Huth Signed-off-by: Nicholas Piggin --- lib/powerpc/asm/reg.h | 2 + powerpc/sprs.c| 647 +- 2 files changed, 457 insertions(+), 192 deletions(-) diff --git

[kvm-unit-tests PATCH v7 10/35] powerpc: interrupt stack backtracing

2024-03-19 Thread Nicholas Piggin
, so the unwinder can recognize the initial interrupt frame. The additional cstart entry-frame is no longer required because the unwinder now looks for frame == 0 as well as address == 0. Signed-off-by: Nicholas Piggin --- lib/powerpc/processor.c | 4 +++- lib/ppc64/asm/stack.h | 3 +++ lib

[kvm-unit-tests PATCH v7 09/35] powerpc: Fix stack backtrace termination

2024-03-19 Thread Nicholas Piggin
if it were a stack frame. But this is fragile, and does not work with powernv where address 0 contains firmware instructions. Use the existing dummy frame on stack as the NULL caller, and create a new frame on stack for the entry code. Signed-off-by: Nicholas Piggin --- powerpc/cstart64.S | 15

[kvm-unit-tests PATCH v7 08/35] powerpc: Fix KVM caps on POWER9 hosts

2024-03-19 Thread Nicholas Piggin
KVM does not like to run on POWER9 hosts without cap-ccf-assist=off. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- powerpc/run | 2 ++ 1 file changed, 2 insertions(+) diff --git a/powerpc/run b/powerpc/run index e469f1eb3..5cdb94194 100755 --- a/powerpc/run +++ b/powerpc/run

[kvm-unit-tests PATCH v7 07/35] common: add memory dirtying vs migration test

2024-03-19 Thread Nicholas Piggin
. The selftest-migration test time is reduced significantly because this test Signed-off-by: Nicholas Piggin --- common/memory-verify.c | 67 + common/selftest-migration.c | 8 ++--- powerpc/Makefile.common | 1 + powerpc/memory-verify.c | 1 + powerpc

[kvm-unit-tests PATCH v7 06/35] gitlab-ci: Run migration selftest on s390x and powerpc

2024-03-19 Thread Nicholas Piggin
The migration harness is complicated and easy to break so CI will be helpful. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml | 18 +++--- s390x/unittests.cfg | 8 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index

[kvm-unit-tests PATCH v7 04/35] (arm|s390): Use migrate_skip in test cases

2024-03-19 Thread Nicholas Piggin
Have tests use the new migrate_skip command in skip paths, rather than calling migrate_once to prevent harness reporting an error. s390x/migration.c adds a new command that looks like it was missing previously. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- arm/gic.c

[kvm-unit-tests PATCH v7 05/35] arch-run: Add a "continuous" migration option for tests

2024-03-19 Thread Nicholas Piggin
cooperative migration iterations reduced to avoid increasing test time too much. Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 16 +-- lib/migrate.c | 18 lib/migrate.h | 3 ++ scripts/arch-run.bash | 55

[kvm-unit-tests PATCH v7 03/35] migration: Add a migrate_skip command

2024-03-19 Thread Nicholas Piggin
a migration. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- common/selftest-migration.c | 14 - lib/migrate.c | 19 - lib/migrate.h | 2 ++ powerpc/unittests.cfg | 6 ++ s390x/unittests.cfg | 5 + scripts/arch

[kvm-unit-tests PATCH v7 02/35] arch-run: Keep infifo open

2024-03-19 Thread Nicholas Piggin
files and fifos so it does not have to be removed explicitly. With this we can let the cat out of the subshell, simplifying the input pipeline. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions

[kvm-unit-tests PATCH v7 01/35] arch-run: Add functions to help handle migration directives from test

2024-03-19 Thread Nicholas Piggin
The migration harness will be expanded to deal with more commands from the test, moving these checks into functions helps keep things managable. Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git

[kvm-unit-tests PATCH v7 00/35] migration, powerpc improvements

2024-03-19 Thread Nicholas Piggin
tion tests. Thanks, Nick Nicholas Piggin (35): arch-run: Add functions to help handle migration directives from test arch-run: Keep infifo open migration: Add a migrate_skip command (arm|s390): Use migrate_skip in test cases arch-run: Add a "continuous" migration option for te

Re: [kvm-unit-tests PATCH v2 04/13] treewide: lib/stack: Make base_address arch specific

2024-03-11 Thread Nicholas Piggin
generic parts, Reviewed-by: Nicholas Piggin Thanks, Nick > Signed-off-by: Andrew Jones > --- > lib/riscv/stack.c | 18 ++ > lib/stack.c | 8 > lib/stack.h | 2 ++ > 3 files changed, 24 insertions(+), 4 deletions(-) > > diff --git

Re: [kvm-unit-tests PATCH 03/32] powerpc: Fix stack backtrace termination

2024-03-04 Thread Nicholas Piggin
On Tue Feb 27, 2024 at 6:50 PM AEST, Thomas Huth wrote: > On 26/02/2024 11.11, Nicholas Piggin wrote: > > The backtrace handler terminates when it sees a NULL caller address, > > but the powerpc stack setup does not keep such a NULL caller frame > > at the start of the stack.

Re: [kvm-unit-tests PATCH 5/7] arch-run: Add a "continuous" migration option for tests

2024-03-04 Thread Nicholas Piggin
On Mon Mar 4, 2024 at 7:19 PM AEST, Andrew Jones wrote: > On Mon, Mar 04, 2024 at 07:17:35AM +0100, Thomas Huth wrote: > > On 26/02/2024 10.38, Nicholas Piggin wrote: > > > The cooperative migration protocol is very good to control precise > > > pre and post condi

Re: [kvm-unit-tests PATCH 7/7] common: add memory dirtying vs migration test

2024-03-04 Thread Nicholas Piggin
On Mon Mar 4, 2024 at 4:22 PM AEST, Thomas Huth wrote: > On 26/02/2024 10.38, Nicholas Piggin wrote: > > This test stores to a bunch of pages and verifies previous stores, > > while being continually migrated. This can fail due to a QEMU TCG > > physical memory dirty bitm

Re: [kvm-unit-tests PATCH 5/7] arch-run: Add a "continuous" migration option for tests

2024-03-04 Thread Nicholas Piggin
On Mon Mar 4, 2024 at 4:17 PM AEST, Thomas Huth wrote: > On 26/02/2024 10.38, Nicholas Piggin wrote: > > The cooperative migration protocol is very good to control precise > > pre and post conditions for a migration event. However in some cases > > its intrusiveness to the t

Re: [kvm-unit-tests PATCH 6/7] gitlab-ci: Run migration selftest on s390x and powerpc

2024-03-04 Thread Nicholas Piggin
On Sat Mar 2, 2024 at 12:16 AM AEST, Thomas Huth wrote: > On 26/02/2024 10.38, Nicholas Piggin wrote: > > The migration harness is complicated and easy to break so CI will > > be helpful. > > > > Signed-off-by: Nicholas Piggin > > --- > > .gitlab-ci.y

Re: [kvm-unit-tests PATCH 14/32] powerpc: general interrupt tests

2024-03-04 Thread Nicholas Piggin
On Sat Mar 2, 2024 at 12:14 AM AEST, Andrew Jones wrote: > On Fri, Mar 01, 2024 at 02:57:04PM +0100, Thomas Huth wrote: > > On 01/03/2024 14.45, Andrew Jones wrote: > > > On Fri, Mar 01, 2024 at 01:41:22PM +0100, Thomas Huth wrote: > > > > On 26/02/2024 11.12, Nichol

Re: [kvm-unit-tests PATCH 14/32] powerpc: general interrupt tests

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 11:45 PM AEST, Andrew Jones wrote: > On Fri, Mar 01, 2024 at 01:41:22PM +0100, Thomas Huth wrote: > > On 26/02/2024 11.12, Nicholas Piggin wrote: > > > Add basic testing of various kinds of interrupts, machine check, > > > page fault, illegal, decre

Re: [kvm-unit-tests PATCH 1/7] arch-run: Keep infifo open

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 11:32 PM AEST, Thomas Huth wrote: > On 26/02/2024 10.38, Nicholas Piggin wrote: > > The infifo fifo that is used to send characters to QEMU console is > > only able to receive one character before the cat process exits. > > Supporting interactions bet

Re: [kvm-unit-tests PATCH 14/32] powerpc: general interrupt tests

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 10:41 PM AEST, Thomas Huth wrote: > On 26/02/2024 11.12, Nicholas Piggin wrote: > > Add basic testing of various kinds of interrupts, machine check, > > page fault, illegal, decrementer, trace, syscall, etc. > > > > This has a known failure on QEMU

Re: [kvm-unit-tests PATCH 12/32] powerpc: Fix emulator illegal instruction test for powernv

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 9:50 PM AEST, Thomas Huth wrote: > On 26/02/2024 11.11, Nicholas Piggin wrote: > > Illegal instructions cause 0xe40 (HEAI) interrupts rather > > than program interrupts. > > > > Acked-by: Thomas Huth > > Signed-off-by: Nicholas Pigg

Re: [kvm-unit-tests PATCH 07/32] powerpc/sprs: Don't fail changed SPRs that are used by the test harness

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 9:15 PM AEST, Thomas Huth wrote: > On 26/02/2024 11.11, Nicholas Piggin wrote: > > SPRs annotated with SPR_HARNESS can change between consecutive reads > > because the test harness code has changed them. Avoid failing the > > test in this case

Re: [kvm-unit-tests PATCH 04/32] powerpc: interrupt stack backtracing

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 7:53 PM AEST, Thomas Huth wrote: > On 26/02/2024 11.11, Nicholas Piggin wrote: > > Add support for backtracing across interrupt stacks, and > > add interrupt frame backtrace for unhandled interrupts. > > > > Signed-off-by: Nicholas Piggin

Re: [kvm-unit-tests PATCH 03/32] powerpc: Fix stack backtrace termination

2024-03-04 Thread Nicholas Piggin
On Fri Mar 1, 2024 at 7:45 PM AEST, Thomas Huth wrote: > On 27/02/2024 09.50, Thomas Huth wrote: > > On 26/02/2024 11.11, Nicholas Piggin wrote: > >> The backtrace handler terminates when it sees a NULL caller address, > >> but the powerpc stack setup does not ke

Re: [kvm-unit-tests PATCH 32/32] powerpc: gitlab CI update

2024-02-28 Thread Nicholas Piggin
On Wed Feb 28, 2024 at 10:16 PM AEST, Andrew Jones wrote: > On Mon, Feb 26, 2024 at 08:12:18PM +1000, Nicholas Piggin wrote: > > This adds testing for the powernv machine, and adds a gitlab-ci test > > group instead of specifying all tests in .gitlab-ci.yml. > > > > Sig

Re: [kvm-unit-tests PATCH 09/32] scripts: allow machine option to be specified in unittests.cfg

2024-02-28 Thread Nicholas Piggin
On Wed Feb 28, 2024 at 9:47 PM AEST, Andrew Jones wrote: > On Mon, Feb 26, 2024 at 08:11:55PM +1000, Nicholas Piggin wrote: > > This allows different machines with different requirements to be > > supported by run_tests.sh, similarly to how different accelerators > > are ha

Re: [kvm-unit-tests PATCH 04/32] powerpc: interrupt stack backtracing

2024-02-28 Thread Nicholas Piggin
On Wed Feb 28, 2024 at 9:46 PM AEST, Andrew Jones wrote: > On Mon, Feb 26, 2024 at 08:11:50PM +1000, Nicholas Piggin wrote: > > Add support for backtracing across interrupt stacks, and > > add interrupt frame backtrace for unhandled interrupts. > > > > Sig

Re: [kvm-unit-tests PATCH 04/13] treewide: lib/stack: Make base_address arch specific

2024-02-28 Thread Nicholas Piggin
On Thu Feb 29, 2024 at 1:04 AM AEST, Andrew Jones wrote: > Calculating the offset of an address is image specific, which is > architecture specific. Until now, all architectures and architecture > configurations which select CONFIG_RELOC were able to subtract > _etext, but the EFI configuration of

Re: [kvm-unit-tests PATCH 03/13] treewide: lib/stack: Fix backtrace

2024-02-28 Thread Nicholas Piggin
#else > -static inline int > -backtrace_frame(const void *frame __unused, const void **return_addrs > __unused, > - int max_depth __unused) > +extern int backtrace(const void **return_addrs, int max_depth); > + > +static inline int backtrace_frame(const void *frame, const void > **return_addrs, > + int max_depth) > { > return 0; > } > #endif > > -extern int backtrace(const void **return_addrs, int max_depth); > - > #endif Is there a reason to add the inline wrappers rather than just externs and drop the arch_ prefix? Do we want to just generally have all arch specific functions have an arch_ prefix? Fine by me. Reviewed-by: Nicholas Piggin I'm fine to rebase the powerpc patch on top of this if it goes in first. Thanks for the heads up. Thanks, Nick

[kvm-unit-tests PATCH 32/32] powerpc: gitlab CI update

2024-02-26 Thread Nicholas Piggin
This adds testing for the powernv machine, and adds a gitlab-ci test group instead of specifying all tests in .gitlab-ci.yml. Signed-off-by: Nicholas Piggin --- .gitlab-ci.yml| 16 ++-- powerpc/unittests.cfg | 15 --- 2 files changed, 14 insertions(+), 17

  1   2   3   4   5   6   7   8   9   10   >