public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86/pmu: Add '.exclude_hv = 1' for guest perf_event
@ 2020-08-12  5:07 Like Xu
  2020-08-12 10:25 ` Paolo Bonzini
  0 siblings, 1 reply; 9+ messages in thread
From: Like Xu @ 2020-08-12  5:07 UTC (permalink / raw)
  To: Paolo Bonzini, Peter Zijlstra
  Cc: Jin, Yao, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, kvm, linux-kernel

To emulate PMC counter for guest, KVM would create an
event on the host with 'exclude_guest=0, exclude_hv=0'
which simply makes no sense and is utterly broken.

To keep perf semantics consistent, any event created by
pmc_reprogram_counter() should both set exclude_hv and
exclude_host in the KVM context.

Message-ID: <20200811084548.GW3982@worktop.programming.kicks-ass.net>
Signed-off-by: Like Xu <like.xu@linux.intel.com>
---
 arch/x86/kvm/pmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 67741d2a0308..6a30763a10d7 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -108,6 +108,7 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
 		.exclude_host = 1,
 		.exclude_user = exclude_user,
 		.exclude_kernel = exclude_kernel,
+		.exclude_hv = 1,
 		.config = config,
 	};
 
-- 
2.21.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-12 13:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-12  5:07 [PATCH] KVM: x86/pmu: Add '.exclude_hv = 1' for guest perf_event Like Xu
2020-08-12 10:25 ` Paolo Bonzini
2020-08-12 11:11   ` peterz
2020-08-12 11:32     ` Paolo Bonzini
2020-08-12 12:56       ` Xu, Like
2020-08-12 13:04         ` Paolo Bonzini
2020-08-12 13:14           ` Xu, Like
2020-08-12 13:31       ` peterz
2020-08-12 13:51         ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox