Message ID | 20231110022857.1273836-1-seanjc@google.com (mailing list archive) |
---|---|
Headers | show |
Series | KVM: x86/pmu: Optimize triggering of emulated events | expand |
Hi Sean, On 11/9/23 18:28, Sean Christopherson wrote: > > base-commit: ef1883475d4a24d8eaebb84175ed46206a688103 May I have a silly question? May I have the tree that the commit is the base? I do not find it in kvm-x86. https://github.com/kvm-x86/linux/commit/ef1883475d4a24d8eaebb84175ed46206a688103 Thank you very much! Dongli Zhang
On Thu, Nov 09, 2023, Dongli Zhang wrote: > Hi Sean, > > On 11/9/23 18:28, Sean Christopherson wrote: > > > > base-commit: ef1883475d4a24d8eaebb84175ed46206a688103 > > May I have a silly question? > > May I have the tree that the commit is the base? I do not find it in kvm-x86. > > https://github.com/kvm-x86/linux/commit/ef1883475d4a24d8eaebb84175ed46206a688103 It's kvm-x86/next (which I failed to explicitly call out), plus two PMU series as mentioned in the cover letter. https://lore.kernel.org/all/20231103230541.352265-1-seanjc@google.com https://lore.kernel.org/all/20231110021306.1269082-1-seanjc@google.com
On 10.11.2023 15:56, Sean Christopherson wrote: > On Thu, Nov 09, 2023, Dongli Zhang wrote: >> Hi Sean, >> >> On 11/9/23 18:28, Sean Christopherson wrote: >>> base-commit: ef1883475d4a24d8eaebb84175ed46206a688103 >> May I have a silly question? >> >> May I have the tree that the commit is the base? I do not find it in kvm-x86. >> >> https://github.com/kvm-x86/linux/commit/ef1883475d4a24d8eaebb84175ed46206a688103 > It's kvm-x86/next (which I failed to explicitly call out), plus two PMU series > as mentioned in the cover letter. > > https://lore.kernel.org/all/20231103230541.352265-1-seanjc@google.com > https://lore.kernel.org/all/20231110021306.1269082-1-seanjc@google.com Hi Sean, i have tested my testcase on your patchset, results look impressive, thank you for your work! Note, for AMD node PMU totally disabled case gave a bit worse results on kvm-next kernel vs stock latest mainstream. The difference is tiny though. *AMD node*: CPU: AMD Zen 3 (three!): AMD EPYC 7443P 24-Core Processor ----------------------------------------------------------------------------------------- | Kernel | CPUID rate | ----------------------------------------------------------------------------------------- | stock ms 6.6.0+ (commit 305230142ae0) | 1360250 | | stock ms 6.6.0+ + kvm.enable_pmu=0 | 1542894 (+13.4%) | | kvm-next ms 6.6.0+ + patches from Sean + kvm.enable_pmu=1 | 1498864 | | kvm-next ms 6.6.0+ + patches from Sean + kvm.enable_pmu=0 | 1526396 (+1.84%) | ----------------------------------------------------------------------------------------- *Intel node*: CPU: Intel(R) Xeon(R) E-2136 CPU @ 3.30GHz ----------------------------------------------------------------------------------------- | Kernel | CPUID rate | ----------------------------------------------------------------------------------------- | stock ms 6.6.0+ | 1431608 | | stock ms 6.6.0+ + kvm.enable_pmu=0 | 1553839 (+8.5%) | | kvm-next ms 6.6.0+ + patches from Sean + kvm.enable_pmu=1 | 1559365 | | kvm-next ms 6.6.0+ + patches from Sean + kvm.enable_pmu=0 | 1582281 (+1.5%) | ----------------------------------------------------------------------------------------- Note: in order to disable PMU completely i used "kvm" module "enable_pmu=0" option (not used KVM_PMU_CAP_DISABLEthis time). Hope that helps. -- Best regards, Konstantin Khorenko, Virtuozzo Linux Kernel Team
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