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

Peter Zijlstra
2020-05-18T12:09:15Z

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.