[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241001-kvm-arm64-fix-pkvm-sve-vl-v7-0-7b0171a36695@kernel.org>
Date: Tue, 01 Oct 2024 12:29:05 +0100
From: Mark Brown <broonie@...nel.org>
To: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>, Fuad Tabba <tabba@...gle.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kvmarm@...ts.linux.dev, Mark Brown <broonie@...nel.org>
Subject: [PATCH v7 0/4] KVM: arm64: Fix underallocation of storage for SVE
state
As observed during review the pKVM support for saving host SVE state is
broken if an asymmetric system has VLs larger than the maximum shared
VL, fix this by discovering then using the maximum VL for allocations
and using RDVL during the save/restore process.
Fuad posted[1] another attempt to address this issues but as indicated
in review I have maintanability concerns since the VL configuration does
not follow best practices and the enumeration is not well integrated
with the rest of the enumeration code. I also posted[2] an alternative
which restricts the host to the maximum shared VL.
This bug has persisted for multiple kernel releases at this point in
spite of being identified prior the original patch being applied.
[1] https://lore.kernel.org/r/20240606092623.2236172-1-tabba@google.com
[2] https://lore.kernel.org/r/20240912-kvm-arm64-limit-guest-vl-v2-1-dd2c29cb2ac9@kernel.org
Signed-off-by: Mark Brown <broonie@...nel.org>
---
Changes in v7:
- Rebase ont v6.12-rc1.
- Link to v6: https://lore.kernel.org/r/20240730-kvm-arm64-fix-pkvm-sve-vl-v6-0-cae8a2e0bd66@kernel.org
Changes in v6:
- Rebase onto v6.11-rc1.
- Link to v5: https://lore.kernel.org/r/20240708-kvm-arm64-fix-pkvm-sve-vl-v5-0-d2175738456b@kernel.org
Changes in v5:
- Clarify commit message on patch 3.
- Link to v4: https://lore.kernel.org/r/20240704-kvm-arm64-fix-pkvm-sve-vl-v4-0-b6898ab23dc4@kernel.org
Changes in v4:
- Roll in Catalin's acks.
- Link to v3: https://lore.kernel.org/r/20240607-kvm-arm64-fix-pkvm-sve-vl-v3-0-59e781706d65@kernel.org
Changes in v3:
- Replace %u with %lu in late CPU error message.
Changes in v2:
- Downgrade check for a late CPU increasing maximum VL to a warning only
but do it unconditionally since pKVM prevents late CPUs anyway.
- Commit log tweaks.
- Link to v1: https://lore.kernel.org/r/20240605-kvm-arm64-fix-pkvm-sve-vl-v1-0-680d6b43b4c1@kernel.org
---
Mark Brown (4):
arm64/fpsimd: Introduce __bit_to_vl() helper
arm64/fpsimd: Discover maximum vector length implemented by any CPU
KVM: arm64: Fix FFR offset calculation for pKVM host state save and restore
KVM: arm64: Avoid underallocating storage for host SVE state
arch/arm64/include/asm/fpsimd.h | 17 +++++++++++++++
arch/arm64/include/asm/kvm_host.h | 2 +-
arch/arm64/include/asm/kvm_hyp.h | 3 ++-
arch/arm64/include/asm/kvm_pkvm.h | 2 +-
arch/arm64/kernel/fpsimd.c | 38 +++++++++++++++++++++++++++------
arch/arm64/kvm/hyp/fpsimd.S | 5 +++++
arch/arm64/kvm/hyp/include/hyp/switch.h | 2 +-
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 6 +++---
arch/arm64/kvm/hyp/nvhe/pkvm.c | 2 +-
arch/arm64/kvm/reset.c | 6 +++---
10 files changed, 65 insertions(+), 18 deletions(-)
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20240604-kvm-arm64-fix-pkvm-sve-vl-13cd71fd7db0
Best regards,
--
Mark Brown <broonie@...nel.org>
Powered by blists - more mailing lists