Re: [PATCH v11 05/11] perf/x86: Keep LBR stack unchanged in host context for guest LBR event

From: Peter Zijlstra
Date: Mon May 18 2020 - 08:09:13 EST


On Thu, May 14, 2020 at 04:30:48PM +0800, Like Xu wrote:
> @@ -544,7 +562,12 @@ void intel_pmu_lbr_enable_all(bool pmi)
> {
> struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
>
> - if (cpuc->lbr_users)
> + /*
> + * When the LBR hardware is scheduled for a guest LBR event,
> + * the guest will dis/enables LBR itself at the appropriate time,
> + * including configuring MSR_LBR_SELECT.
> + */
> + if (cpuc->lbr_users && !cpuc->guest_lbr_enabled)
> __intel_pmu_lbr_enable(pmi);
> }

No!, that should be done through perf_event_attr::exclude_host, as I
believe all the other KVM event do it.