KVM ARM Archive mirror
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: kvmarm@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Eric Auger <eric.auger@redhat.com>,
	Oliver Upton <oliver.upton@linux.dev>
Subject: [PATCH 00/20] KVM: arm64: Transition to a per-ITS translation cache
Date: Tue, 27 Feb 2024 22:42:29 +0000	[thread overview]
Message-ID: <20240227224249.2209194-1-oliver.upton@linux.dev> (raw)

As discussed [*], here is the new take on the LPI translation cache,
migrating to an xarray indexed by (devid, eventid) per ITS.

The end result is quite satisfying, as it becomes possible to rip out
other nasties such as the lpi_list_lock. To that end, patches 2-6 aren't
_directly_ related to the translation cache cleanup, but instead are
done to enable the cleanups at the end of the series.

I changed out my test machine from the last time so the baseline has
moved a bit, but here are the results from the vgic_lpi_stress test:

+----------------------------+------------+-------------------+
|       Configuration        |  v6.8-rc1  | v6.8-rc1 + series |
+----------------------------+------------+-------------------+
| -v 1 -d 1 -e 1 -i 1000000  | 2063296.81 |        1362602.35 |
| -v 16 -d 16 -e 16 -i 10000 |  610678.33 |        5200910.01 |
| -v 16 -d 16 -e 17 -i 10000 |  678361.53 |        5890675.51 |
| -v 32 -d 32 -e 1 -i 100000 |  580918.96 |        8304552.67 |
| -v 1 -d 1 -e 17 -i 1000    | 1512443.94 |         1425953.8 |
+----------------------------+------------+-------------------+

Unlike last time, no dramatic regressions at any performance point. The
regression on a single interrupt stream is to be expected, as the
overheads of SRCU and two tree traversals (kvm_io_bus_get_dev(),
translation cache xarray) are likely greater than that of a linked-list
with a single node.

Keep in mind this is a microbenchmark, and the added overhead shouldn't
lead to real-world performance issues.

Applies to kvmarm/next, due to the dependency on the prior LPI rework
going into 6.9.

[*] https://lore.kernel.org/kvmarm/20240213093250.3960069-1-oliver.upton@linux.dev/

Oliver Upton (20):
  KVM: Treat the device list as an rculist
  KVM: arm64: vgic-its: Walk LPI xarray in its_sync_lpi_pending_table()
  KVM: arm64: vgic-its: Walk LPI xarray in vgic_its_invall()
  KVM: arm64: vgic-its: Walk LPI xarray in vgic_its_cmd_handle_movall()
  KVM: arm64: vgic-debug: Use an xarray mark for debug iterator
  KVM: arm64: vgic-its: Get rid of vgic_copy_lpi_list()
  KVM: arm64: vgic-its: Scope translation cache invalidations to an ITS
  KVM: arm64: vgic-its: Spin off helper for finding ITS by doorbell addr
  KVM: arm64: vgic-its: Maintain a translation cache per ITS
  KVM: arm64: vgic-its: Use the per-ITS translation cache for injection
  KVM: arm64: vgic-its: Rip out the global translation cache
  KVM: arm64: vgic-its: Get rid of the lpi_list_lock
  KVM: selftests: Align with kernel's GIC definitions
  KVM: selftests: Standardise layout of GIC frames
  KVM: selftests: Add quadword MMIO accessors
  KVM: selftests: Add a minimal library for interacting with an ITS
  KVM: selftests: Add helper for enabling LPIs on a redistributor
  KVM: selftests: Use MPIDR_HWID_BITMASK from cputype.h
  KVM: selftests: Hack in support for aligned page allocations
  KVM: selftests: Add stress test for LPI injection

 arch/arm64/kvm/vgic/vgic-debug.c              |  82 ++-
 arch/arm64/kvm/vgic/vgic-init.c               |   8 -
 arch/arm64/kvm/vgic/vgic-its.c                | 335 +++-------
 arch/arm64/kvm/vgic/vgic-mmio-v3.c            |   2 +-
 arch/arm64/kvm/vgic/vgic.c                    |   6 +-
 arch/arm64/kvm/vgic/vgic.h                    |   6 +-
 include/kvm/arm_vgic.h                        |  13 +-
 tools/testing/selftests/kvm/Makefile          |   2 +
 .../selftests/kvm/aarch64/arch_timer.c        |   8 +-
 .../testing/selftests/kvm/aarch64/psci_test.c |   2 +
 .../testing/selftests/kvm/aarch64/vgic_irq.c  |  15 +-
 .../selftests/kvm/aarch64/vgic_lpi_stress.c   | 413 ++++++++++++
 .../kvm/aarch64/vpmu_counter_access.c         |   6 +-
 .../selftests/kvm/dirty_log_perf_test.c       |   5 +-
 .../selftests/kvm/include/aarch64/gic.h       |  21 +-
 .../selftests/kvm/include/aarch64/gic_v3.h    | 586 +++++++++++++++++-
 .../kvm/include/aarch64/gic_v3_its.h          |  19 +
 .../selftests/kvm/include/aarch64/processor.h |  19 +-
 .../selftests/kvm/include/aarch64/vgic.h      |   5 +-
 .../selftests/kvm/include/kvm_util_base.h     |   2 +
 tools/testing/selftests/kvm/lib/aarch64/gic.c |  18 +-
 .../selftests/kvm/lib/aarch64/gic_private.h   |   4 +-
 .../selftests/kvm/lib/aarch64/gic_v3.c        |  99 +--
 .../selftests/kvm/lib/aarch64/gic_v3_its.c    | 248 ++++++++
 .../testing/selftests/kvm/lib/aarch64/vgic.c  |  38 +-
 tools/testing/selftests/kvm/lib/kvm_util.c    |  27 +-
 virt/kvm/kvm_main.c                           |   8 +-
 27 files changed, 1590 insertions(+), 407 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/aarch64/vgic_lpi_stress.c
 create mode 100644 tools/testing/selftests/kvm/include/aarch64/gic_v3_its.h
 create mode 100644 tools/testing/selftests/kvm/lib/aarch64/gic_v3_its.c


base-commit: 8b177908c5fe6e38911f46c82dfa0fec7644d6dc
-- 
2.44.0.rc1.240.g4c46232300-goog


             reply	other threads:[~2024-02-27 22:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 22:42 Oliver Upton [this message]
2024-02-27 22:42 ` [PATCH 01/20] KVM: Treat the device list as an rculist Oliver Upton
2024-02-28 13:33   ` Paolo Bonzini
2024-02-28 17:18   ` Sean Christopherson
2024-02-28 18:07     ` Oliver Upton
2024-02-28 19:13       ` Sean Christopherson
2024-02-28 19:31         ` Oliver Upton
2024-02-28 20:23           ` Paolo Bonzini
2024-02-28 21:07             ` Oliver Upton
2024-02-27 22:42 ` [PATCH 02/20] KVM: arm64: vgic-its: Walk LPI xarray in its_sync_lpi_pending_table() Oliver Upton
2024-02-27 22:42 ` [PATCH 03/20] KVM: arm64: vgic-its: Walk LPI xarray in vgic_its_invall() Oliver Upton
2024-02-27 22:42 ` [PATCH 04/20] KVM: arm64: vgic-its: Walk LPI xarray in vgic_its_cmd_handle_movall() Oliver Upton
2024-02-27 22:42 ` [PATCH 05/20] KVM: arm64: vgic-debug: Use an xarray mark for debug iterator Oliver Upton
2024-02-27 22:42 ` [PATCH 06/20] KVM: arm64: vgic-its: Get rid of vgic_copy_lpi_list() Oliver Upton
2024-02-27 22:42 ` [PATCH 07/20] KVM: arm64: vgic-its: Scope translation cache invalidations to an ITS Oliver Upton
2024-02-27 22:42 ` [PATCH 08/20] KVM: arm64: vgic-its: Spin off helper for finding ITS by doorbell addr Oliver Upton
2024-02-27 22:42 ` [PATCH 09/20] KVM: arm64: vgic-its: Maintain a translation cache per ITS Oliver Upton
2024-02-27 22:42 ` [PATCH 10/20] KVM: arm64: vgic-its: Use the per-ITS translation cache for injection Oliver Upton
2024-02-27 22:42 ` [PATCH 11/20] KVM: arm64: vgic-its: Rip out the global translation cache Oliver Upton
2024-02-27 22:42 ` [PATCH 12/20] KVM: arm64: vgic-its: Get rid of the lpi_list_lock Oliver Upton
2024-02-27 22:42 ` [PATCH 13/20] KVM: selftests: Align with kernel's GIC definitions Oliver Upton
2024-02-27 22:42 ` [PATCH 14/20] KVM: selftests: Standardise layout of GIC frames Oliver Upton
2024-02-27 22:42 ` [PATCH 15/20] KVM: selftests: Add quadword MMIO accessors Oliver Upton
2024-02-27 22:42 ` [PATCH 16/20] KVM: selftests: Add a minimal library for interacting with an ITS Oliver Upton
2024-02-27 22:42 ` [PATCH 17/20] KVM: selftests: Add helper for enabling LPIs on a redistributor Oliver Upton
2024-02-27 22:42 ` [PATCH 18/20] KVM: selftests: Use MPIDR_HWID_BITMASK from cputype.h Oliver Upton
2024-02-27 22:42 ` [PATCH 19/20] KVM: selftests: Hack in support for aligned page allocations Oliver Upton
2024-02-27 22:42 ` [PATCH 20/20] KVM: selftests: Add stress test for LPI injection Oliver Upton

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=20240227224249.2209194-1-oliver.upton@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=eric.auger@redhat.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=yuzenghui@huawei.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 read-only IMAP folder(s) and NNTP newsgroup(s).