Re: [PATCH 4/4] perf/x86/intel: drain PEBS buffer in event read

From: Peter Zijlstra
Date: Tue Dec 19 2017 - 14:02:23 EST


On Mon, Dec 18, 2017 at 03:34:51AM -0800, kan.liang@xxxxxxxxxxxxxxx wrote:
> --- a/arch/x86/events/intel/ds.c
> +++ b/arch/x86/events/intel/ds.c
> @@ -926,6 +926,16 @@ void intel_pmu_pebs_del(struct perf_event *event)
> pebs_update_state(needed_cb, cpuc, event->ctx->pmu);
> }
>
> +void intel_pmu_pebs_read(struct perf_event *event)
> +{
> + struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> +
> + if (pebs_needs_sched_cb(cpuc))
> + return intel_pmu_drain_pebs_buffer();
> +
> + x86_perf_event_update(event, 0, 0);
> +}

This is completely broken.. what if @event isn't a pebs event, but we
do have an auto-reloading pebs event configured?