Re: [PATCH V4 4/7] perf/x86/intel: Support LBR event logging

From: Peter Zijlstra
Date: Thu Oct 19 2023 - 07:12:21 EST


On Wed, Oct 04, 2023 at 11:40:41AM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:
> +static __always_inline void get_lbr_events(struct cpu_hw_events *cpuc,
> + int i, u64 info)
> +{
> + /*
> + * The later code will decide what content can be disclosed
> + * to the perf tool. It's no harmful to unconditionally update
> + * the cpuc->lbr_events.
> + * Pleae see intel_pmu_lbr_event_reorder()
> + */
> + cpuc->lbr_events[i] = info & LBR_INFO_EVENTS;
> +}

You could be forcing an extra cachemiss here. A long time ago I had
hacks to profile perf with perf, but perhaps PT can be abused for that
now?