diff options
author | Oliver Upton <oliver.upton@linux.dev> | 2024-10-07 23:30:25 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2024-10-08 10:40:27 +0100 |
commit | 6ded46b5a4fd7fc9c6104b770627043aaf996abf (patch) | |
tree | d6d7febdea62a3b09d101acd2d10d7011e11039f /drivers/platform/surface/aggregator/ssh_parser.c | |
parent | ae8f8b37610269009326f4318df161206c59843e (diff) |
KVM: arm64: nv: Keep reference on stage-2 MMU when scheduled out
If a vCPU is scheduling out and not in WFI emulation, it is highly
likely it will get scheduled again soon and reuse the MMU it had before.
Dropping the MMU at vcpu_put() can have some unfortunate consequences,
as the MMU could get reclaimed and used in a different context, forcing
another 'cold start' on an otherwise active MMU.
Avoid that altogether by keeping a reference on the MMU if the vCPU is
scheduling out, ensuring that another vCPU cannot reclaim it while the
current vCPU is away. Since there are more MMUs than vCPUs, this does
not affect the guarantee that an unused MMU is available at any time.
Furthermore, this makes the vcpu->arch.hw_mmu ~stable in preemptible
code, at least for where it matters in the stage-2 abort path. Yes, the
MMU can change across WFI emulation, but there isn't even a use case
where this would matter.
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241007233028.2236133-2-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'drivers/platform/surface/aggregator/ssh_parser.c')
0 files changed, 0 insertions, 0 deletions