linux-kernel.vger.kernel.org archive mirror
 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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf/x86/vlbr: Add c->flags to vlbr event constraints
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Wanpeng Li @ 2021-11-04  2:35 UTC (permalink / raw)
  To: Like Xu
  Cc: Peter Zijlstra, Alexander Shishkin, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Jiri Olsa,
	linux-perf-users, LKML

On Wed, 3 Nov 2021 at 17:17, Like Xu <like.xu.linux@gmail.com> wrote:
>
> 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>

Tested-by: Wanpeng Li <wanpengli@tencent.com>

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

* [tip: perf/urgent] perf/x86/vlbr: Add c->flags to vlbr event constraints
  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-bot2 for Like Xu
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Like Xu @ 2021-11-11 12:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Wanpeng Li, Like Xu, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     5863702561e625903ec678551cb056a4b19e0b8a
Gitweb:        https://git.kernel.org/tip/5863702561e625903ec678551cb056a4b19e0b8a
Author:        Like Xu <likexu@tencent.com>
AuthorDate:    Wed, 03 Nov 2021 17:17:16 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 11 Nov 2021 13:09:34 +01:00

perf/x86/vlbr: Add c->flags to vlbr event constraints

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.

Fixes: 097e4311cda9 ("perf/x86: Add constraint to create guest LBR event without hw counter")
Reported-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Like Xu <likexu@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Wanpeng Li <wanpengli@tencent.com>
Link: https://lore.kernel.org/r/20211103091716.59906-1-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 6039644..42cf01e 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3048,8 +3048,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;
 }

^ permalink raw reply related	[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;
as well as URLs for NNTP newsgroup(s).