* [PATCH] perf/x86/lbr: Reset LBR_SELECT during vlbr reset
@ 2021-11-05 7:20 Wanpeng Li
2021-11-05 7:43 ` Like Xu
2021-11-11 12:22 ` [tip: perf/urgent] " tip-bot2 for Wanpeng Li
0 siblings, 2 replies; 3+ messages in thread
From: Wanpeng Li @ 2021-11-05 7:20 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Peter Zijlstra, Arnaldo Carvalho de Melo, Jiri Olsa,
Like Xu
From: Wanpeng Li <wanpengli@tencent.com>
lbr_select in kvm guest has residual data even if kvm guest is poweroff.
We can get residual data in the next boot. Because lbr_select is not
reset during kvm vlbr release. Let's reset LBR_SELECT during vlbr reset.
Cc: Like Xu <likexu@tencent.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
arch/x86/events/intel/lbr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index 9e6d6eaeb4cb..1076de93a2f5 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -279,6 +279,8 @@ void intel_pmu_lbr_reset(void)
cpuc->last_task_ctx = NULL;
cpuc->last_log_id = 0;
+ if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
+ wrmsrl(MSR_LBR_SELECT, 0);
}
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/x86/lbr: Reset LBR_SELECT during vlbr reset
2021-11-05 7:20 [PATCH] perf/x86/lbr: Reset LBR_SELECT during vlbr reset Wanpeng Li
@ 2021-11-05 7:43 ` Like Xu
2021-11-11 12:22 ` [tip: perf/urgent] " tip-bot2 for Wanpeng Li
1 sibling, 0 replies; 3+ messages in thread
From: Like Xu @ 2021-11-05 7:43 UTC (permalink / raw)
To: Wanpeng Li, Peter Zijlstra
Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Jiri Olsa, Like Xu, linux-kernel
On 5/11/2021 3:20 pm, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> lbr_select in kvm guest has residual data even if kvm guest is poweroff.
> We can get residual data in the next boot. Because lbr_select is not
> reset during kvm vlbr release. Let's reset LBR_SELECT during vlbr reset.
This is because when a new vlbr event is first scheduled in the current CPU,
the lbr_select is not reset, which causes the previous lbr_select value
to be visible to the next vcpu.
Considering that the requested lbr_select will be reconfigured
when the event is enabled. It is trivial, but a valid fix. Thanks.
>
> Cc: Like Xu <likexu@tencent.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
> arch/x86/events/intel/lbr.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
> index 9e6d6eaeb4cb..1076de93a2f5 100644
> --- a/arch/x86/events/intel/lbr.c
> +++ b/arch/x86/events/intel/lbr.c
> @@ -279,6 +279,8 @@ void intel_pmu_lbr_reset(void)
>
> cpuc->last_task_ctx = NULL;
> cpuc->last_log_id = 0;
> + if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
> + wrmsrl(MSR_LBR_SELECT, 0);
> }
>
> /*
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: perf/urgent] perf/x86/lbr: Reset LBR_SELECT during vlbr reset
2021-11-05 7:20 [PATCH] perf/x86/lbr: Reset LBR_SELECT during vlbr reset Wanpeng Li
2021-11-05 7:43 ` Like Xu
@ 2021-11-11 12:22 ` tip-bot2 for Wanpeng Li
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Wanpeng Li @ 2021-11-11 12:22 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Wanpeng Li, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 0fe39a3929ac7af980347814d552a734b51adacf
Gitweb: https://git.kernel.org/tip/0fe39a3929ac7af980347814d552a734b51adacf
Author: Wanpeng Li <wanpengli@tencent.com>
AuthorDate: Fri, 05 Nov 2021 00:20:51 -07:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 11 Nov 2021 13:09:34 +01:00
perf/x86/lbr: Reset LBR_SELECT during vlbr reset
lbr_select in kvm guest has residual data even if kvm guest is poweroff.
We can get residual data in the next boot. Because lbr_select is not
reset during kvm vlbr release. Let's reset LBR_SELECT during vlbr reset.
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1636096851-36623-1-git-send-email-wanpengli@tencent.com
---
arch/x86/events/intel/lbr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index 6b72e9b..8043213 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -265,6 +265,8 @@ void intel_pmu_lbr_reset(void)
cpuc->last_task_ctx = NULL;
cpuc->last_log_id = 0;
+ if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
+ wrmsrl(MSR_LBR_SELECT, 0);
}
/*
^ 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-05 7:20 [PATCH] perf/x86/lbr: Reset LBR_SELECT during vlbr reset Wanpeng Li
2021-11-05 7:43 ` Like Xu
2021-11-11 12:22 ` [tip: perf/urgent] " tip-bot2 for Wanpeng Li
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).