mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/x86/vlbr: Add c->flags to vlbr event constraints
@ 2021-11-03  9:17 Like Xu
  2021-11-04  2:35 ` Wanpeng Li
  2021-11-11 12:22 ` [tip: perf/urgent] " tip-bot2 for Like Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Like Xu @ 2021-11-03  9:17 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Alexander Shishkin, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Jiri Olsa, linux-perf-users, linux-kernel

From: Like Xu <likexu@tencent.com>

Just like what we do in the x86_get_event_constraints(), the
PERF_X86_EVENT_LBR_SELECT flag should also be propagated
to event->hw.flags so that the host lbr driver can save/restore
MSR_LBR_SELECT for the special vlbr event created by KVM or BPF.

Reported-by: Wanpeng Li <wanpengli@tencent.com>
Fixes: 097e4311cda9 ("perf/x86: Add constraint to create guest LBR event without hw counter")
Signed-off-by: Like Xu <likexu@tencent.com>
---
 arch/x86/events/intel/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 7011e87be6d0..30b5d1b3cb03 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -2997,8 +2997,10 @@ intel_vlbr_constraints(struct perf_event *event)
 {
 	struct event_constraint *c = &vlbr_constraint;
 
-	if (unlikely(constraint_match(c, event->hw.config)))
+	if (unlikely(constraint_match(c, event->hw.config))) {
+		event->hw.flags |= c->flags;
 		return c;
+	}
 
 	return NULL;
 }
-- 
2.33.0


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

end of thread, other threads:[~2021-11-11 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03  9:17 [PATCH] perf/x86/vlbr: Add c->flags to vlbr event constraints Like Xu
2021-11-04  2:35 ` Wanpeng Li
2021-11-11 12:22 ` [tip: perf/urgent] " tip-bot2 for Like Xu

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

all inboxes | Powered by JetHome®