On Sun, Mar 02, 2025 at 02:00:12PM -0800, Dongli Zhang wrote: > Date: Sun, 2 Mar 2025 14:00:12 -0800 > From: Dongli Zhang <dongli.zhang@xxxxxxxxxx> > Subject: [PATCH v2 04/10] target/i386/kvm: set KVM_PMU_CAP_DISABLE if > "-pmu" is configured > X-Mailer: git-send-email 2.43.5 > > Although AMD PERFCORE and PerfMonV2 are removed when "-pmu" is configured, > there is no way to fully disable KVM AMD PMU virtualization. Neither > "-cpu host,-pmu" nor "-cpu EPYC" achieves this. > > As a result, the following message still appears in the VM dmesg: > > [ 0.263615] Performance Events: AMD PMU driver. > > However, the expected output should be: > > [ 0.596381] Performance Events: PMU not available due to virtualization, using software events only. > [ 0.600972] NMI watchdog: Perf NMI watchdog permanently disabled > > This occurs because AMD does not use any CPUID bit to indicate PMU > availability. > > To address this, KVM_CAP_PMU_CAPABILITY is used to set KVM_PMU_CAP_DISABLE > when "-pmu" is configured. > > Signed-off-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx> > --- > Changed since v1: > - Switch back to the initial implementation with "-pmu". > https://lore.kernel.org/all/20221119122901.2469-3-dongli.zhang@xxxxxxxxxx > - Mention that "KVM_PMU_CAP_DISABLE doesn't change the PMU behavior on > Intel platform because current "pmu" property works as expected." > > target/i386/kvm/kvm.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) Overall LGTM. And with Xiaoyao's comment fixed :-) Reviewed-by: Zhao Liu <zhao1.liu@xxxxxxxxx> Thanks, Zhao