On Thu, 09 Nov 2023 18:28:47 -0800, Sean Christopherson wrote: > Optimize code used by, or which impacts, kvm_pmu_trigger_event() to try > and make a dent in the overhead of emulating PMU events in software, which > is quite noticeable due to it kicking in anytime the guest has a vPMU and > KVM is skipping an instruction. > > Note, Jim has a proposal/idea[*] (that I supported) to make > kvm_pmu_trigger_event() even more performant. I opted not to do that as > it's a bit more invasive, and I started chewing on this not so much because > I care _that_ much about performance, but because it irritates me that the > PMU code makes things way harder than they need to be. > > [...] Applied to kvm-x86 pmu, thanks! [01/10] KVM: x86/pmu: Zero out PMU metadata on AMD if PMU is disabled https://github.com/kvm-x86/linux/commit/f933b88e2015 [02/10] KVM: x86/pmu: Add common define to capture fixed counters offset https://github.com/kvm-x86/linux/commit/be6b067dae15 [03/10] KVM: x86/pmu: Move pmc_idx => pmc translation helper to common code https://github.com/kvm-x86/linux/commit/b31880ca2f41 [04/10] KVM: x86/pmu: Snapshot and clear reprogramming bitmap before reprogramming https://github.com/kvm-x86/linux/commit/004a0aa56ede [05/10] KVM: x86/pmu: Add macros to iterate over all PMCs given a bitmap https://github.com/kvm-x86/linux/commit/e5a65d4f723a [06/10] KVM: x86/pmu: Process only enabled PMCs when emulating events in software https://github.com/kvm-x86/linux/commit/d2b321ea9380 [07/10] KVM: x86/pmu: Snapshot event selectors that KVM emulates in software https://github.com/kvm-x86/linux/commit/f19063b1ca05 [08/10] KVM: x86/pmu: Expand the comment about what bits are check emulating events https://github.com/kvm-x86/linux/commit/afda2d7666f8 [09/10] KVM: x86/pmu: Check eventsel first when emulating (branch) insns retired https://github.com/kvm-x86/linux/commit/e35529fb4ac9 [10/10] KVM: x86/pmu: Avoid CPL lookup if PMC enabline for USER and KERNEL is the same https://github.com/kvm-x86/linux/commit/83bdfe04c968 -- https://github.com/kvm-x86/linux/tree/next