KVM: PPC: Book3S HV: Don't always save PMU for guest capable of nesting
authorNicholas Piggin <npiggin@gmail.com>
Tue, 23 Nov 2021 09:51:48 +0000 (19:51 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 24 Nov 2021 10:08:57 +0000 (21:08 +1100)
commitd3c8a2d3740d93778ea102d4c781746d284177bf
treeacbdd215e8cc9bb051be35e5812584b25d55e0dc
parent46f9caf1a246a5c0622fa8cc7e673658e925f97e
KVM: PPC: Book3S HV: Don't always save PMU for guest capable of nesting

Provide a config option that controls the workaround added by commit
63279eeb7f93 ("KVM: PPC: Book3S HV: Always save guest pmu for guest
capable of nesting"). The option defaults to y for now, but is expected
to go away within a few releases.

Nested capable guests running with the earlier commit 178266389794
("KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest
SPRs are live") will now indicate the PMU in-use status of their guests,
which means the parent does not need to unconditionally save the PMU for
nested capable guests.

After this latest round of performance optimisations, this option costs
about 540 cycles or 10% entry/exit performance on a POWER9 nested-capable
guest.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
References: 178266389794 ("KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211123095231.1036501-11-npiggin@gmail.com
arch/powerpc/kvm/Kconfig
arch/powerpc/kvm/book3s_hv.c