mbox series

[00/10] KVM: arm64: selftests: Introduce arch_timer selftest

Message ID 20210813211211.2983293-1-rananta@google.com (mailing list archive)
Headers show
Series KVM: arm64: selftests: Introduce arch_timer selftest | expand

Message

Raghavendra Rao Ananta Aug. 13, 2021, 9:12 p.m. UTC
Hello,

The patch series adds a KVM selftest to validate the behavior of
ARM's generic timer (patch-10). The test programs the timer IRQs
periodically, and for each interrupt, it validates the behaviour
against the architecture specifications. The test further provides
a command-line interface to configure the number of vCPUs, the
period of the timer, and the number of iterations that the test
has to run for.

Since the test heavily depends on interrupts, the patch series also
adds a basic support for ARM Generic Interrupt Controller v3 (GICv3)
to the KVM's aarch64 selftest framework (patch-9).

Furthermore, additional processor utilities such as accessing the MMIO
(via readl/writel), read/write to assembler unsupported registers,
basic delay generation, enable/disable local IRQs, spinlock support,
and so on, are also introduced that the test/GICv3 takes advantage of.
These are presented in patches 1 through 8.

The patch series, specifically the library support, is derived from the
kvm-unit-tests and the kernel itself.

Regards,
Raghavendra

Raghavendra Rao Ananta (10):
  KVM: arm64: selftests: Add MMIO readl/writel support
  KVM: arm64: selftests: Add write_sysreg_s and read_sysreg_s
  KVM: arm64: selftests: Add support for cpu_relax
  KVM: arm64: selftests: Add basic support for arch_timers
  KVM: arm64: selftests: Add basic support to generate delays
  KVM: arm64: selftests: Add support to disable and enable local IRQs
  KVM: arm64: selftests: Add support to get the vcpuid from MPIDR_EL1
  KVM: arm64: selftests: Add light-weight spinlock support
  KVM: arm64: selftests: Add basic GICv3 support
  KVM: arm64: selftests: Add arch_timer test

 tools/testing/selftests/kvm/.gitignore        |   1 +
 tools/testing/selftests/kvm/Makefile          |   3 +-
 .../selftests/kvm/aarch64/arch_timer.c        | 382 ++++++++++++++++++
 .../kvm/include/aarch64/arch_timer.h          | 138 +++++++
 .../selftests/kvm/include/aarch64/delay.h     |  25 ++
 .../selftests/kvm/include/aarch64/gic.h       |  21 +
 .../selftests/kvm/include/aarch64/processor.h | 140 ++++++-
 .../selftests/kvm/include/aarch64/spinlock.h  |  13 +
 tools/testing/selftests/kvm/lib/aarch64/gic.c |  93 +++++
 .../selftests/kvm/lib/aarch64/gic_private.h   |  21 +
 .../selftests/kvm/lib/aarch64/gic_v3.c        | 240 +++++++++++
 .../selftests/kvm/lib/aarch64/gic_v3.h        |  70 ++++
 .../selftests/kvm/lib/aarch64/spinlock.c      |  27 ++
 13 files changed, 1172 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/arch_timer.c
 create mode 100644 tools/testing/selftests/kvm/include/aarch64/arch_timer.h
 create mode 100644 tools/testing/selftests/kvm/include/aarch64/delay.h
 create mode 100644 tools/testing/selftests/kvm/include/aarch64/gic.h
 create mode 100644 tools/testing/selftests/kvm/include/aarch64/spinlock.h
 create mode 100644 tools/testing/selftests/kvm/lib/aarch64/gic.c
 create mode 100644 tools/testing/selftests/kvm/lib/aarch64/gic_private.h
 create mode 100644 tools/testing/selftests/kvm/lib/aarch64/gic_v3.c
 create mode 100644 tools/testing/selftests/kvm/lib/aarch64/gic_v3.h
 create mode 100644 tools/testing/selftests/kvm/lib/aarch64/spinlock.c

Comments

Andrew Jones Aug. 16, 2021, 12:15 p.m. UTC | #1
On Fri, Aug 13, 2021 at 09:12:01PM +0000, Raghavendra Rao Ananta wrote:
> Hello,
> 
> The patch series adds a KVM selftest to validate the behavior of
> ARM's generic timer (patch-10). The test programs the timer IRQs
> periodically, and for each interrupt, it validates the behaviour
> against the architecture specifications. The test further provides
> a command-line interface to configure the number of vCPUs, the
> period of the timer, and the number of iterations that the test
> has to run for.
> 
> Since the test heavily depends on interrupts, the patch series also
> adds a basic support for ARM Generic Interrupt Controller v3 (GICv3)
> to the KVM's aarch64 selftest framework (patch-9).
> 
> Furthermore, additional processor utilities such as accessing the MMIO
> (via readl/writel), read/write to assembler unsupported registers,
> basic delay generation, enable/disable local IRQs, spinlock support,
> and so on, are also introduced that the test/GICv3 takes advantage of.
> These are presented in patches 1 through 8.
> 
> The patch series, specifically the library support, is derived from the
> kvm-unit-tests and the kernel itself.
> 

Hi Raghavendra,

I appreciate the new support being added to aarch64 kselftests in order to
support new tests. I'm curious as to why the kvm-unit-tests timer test
wasn't extended instead, though. Also, I'm curious if you've seen any
room for improvements to the kvm-unit-tests code and, if so, if you plan
to submit patches for those improvements.

Thanks,
drew
Raghavendra Rao Ananta Aug. 16, 2021, 8:56 p.m. UTC | #2
On Mon, Aug 16, 2021 at 5:15 AM Andrew Jones <drjones@redhat.com> wrote:
>
> On Fri, Aug 13, 2021 at 09:12:01PM +0000, Raghavendra Rao Ananta wrote:
> > Hello,
> >
> > The patch series adds a KVM selftest to validate the behavior of
> > ARM's generic timer (patch-10). The test programs the timer IRQs
> > periodically, and for each interrupt, it validates the behaviour
> > against the architecture specifications. The test further provides
> > a command-line interface to configure the number of vCPUs, the
> > period of the timer, and the number of iterations that the test
> > has to run for.
> >
> > Since the test heavily depends on interrupts, the patch series also
> > adds a basic support for ARM Generic Interrupt Controller v3 (GICv3)
> > to the KVM's aarch64 selftest framework (patch-9).
> >
> > Furthermore, additional processor utilities such as accessing the MMIO
> > (via readl/writel), read/write to assembler unsupported registers,
> > basic delay generation, enable/disable local IRQs, spinlock support,
> > and so on, are also introduced that the test/GICv3 takes advantage of.
> > These are presented in patches 1 through 8.
> >
> > The patch series, specifically the library support, is derived from the
> > kvm-unit-tests and the kernel itself.
> >
>
> Hi Raghavendra,
>
> I appreciate the new support being added to aarch64 kselftests in order to
> support new tests. I'm curious as to why the kvm-unit-tests timer test
> wasn't extended instead, though. Also, I'm curious if you've seen any
> room for improvements to the kvm-unit-tests code and, if so, if you plan
> to submit patches for those improvements.


Hi  Andrew,

Interesting question! It's more about ease and flexibility in
controlling the guest via the VMM-
Since arch_timer's interface is mostly per-CPU, we'd like to extend
this test case to be
more stressful, such as migrating the vCPUs across pCPUs rapidly, or
even affining
a large number of vCPUs to a single pCPU, and so on.

On the other hand, since the patch series brings-in a lot of aarch64
goodies with it,
such as interrupt support, it might encourage others to add more arch
specific tests
easily :) For example, we also plan to add tests that verifies KVM
interface for interrupts,
for which the GIC support in the series would come handy.

I'm still gaining understanding of kvm-unit-tests. However, I'm
curious to know your thoughts as
well in-support of kvm-unit-tests.

Unfortunately, I don't have any immediate plans to submit patches on
arch_timer for
kvm-unit-tests.

Thanks,
Raghavendra

>
>
> Thanks,
> drew
>