[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bba6a29e-7ef6-c21f-745e-527210a1a181@gmail.com>
Date: Fri, 5 Nov 2021 15:43:14 +0800
From: Like Xu <like.xu.linux@...il.com>
To: Wanpeng Li <kernellwp@...il.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...hat.com>, Like Xu <likexu@...cent.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf/x86/lbr: Reset LBR_SELECT during vlbr reset
On 5/11/2021 3:20 pm, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@...cent.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@...cent.com>
> Signed-off-by: Wanpeng Li <wanpengli@...cent.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);
> }
>
> /*
>
Powered by blists - more mailing lists