[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YL463Zly9cKpSe7A@hirez.programming.kicks-ass.net>
Date: Mon, 7 Jun 2021 17:27:25 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Leo Yan <leo.yan@...aro.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 1/8] perf/ring_buffer: Add comment for barriers on AUX
ring buffer
On Wed, Jun 02, 2021 at 06:30:00PM +0800, Leo Yan wrote:
> AUX ring buffer applies almost the same barriers as perf ring buffer,
> but there has an exception for ordering between writing the AUX trace
> data and updating user_page::aux_head.
>
> This patch adds comment for how to use the barriers on AUX ring buffer,
> and gives comment to ask the drivers to flush the trace data into AUX
> ring buffer prior to updating user_page::aux_head.
>
> Signed-off-by: Leo Yan <leo.yan@...aro.org>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> kernel/events/ring_buffer.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 52868716ec35..5cf6579be05e 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -509,6 +509,15 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
> perf_event_aux_event(handle->event, aux_head, size,
> handle->aux_flags);
>
> + /*
> + * See perf_output_put_handle(), AUX ring buffer applies the same
> + * barrier pairing as the perf ring buffer; except for B, since
> + * AUX ring buffer is written by hardware trace, we cannot simply
> + * use the generic memory barrier (like smp_wmb()) prior to update
> + * user_page::aux_head, the hardware trace driver takes the
> + * responsibility to ensure the trace data has been flushed into
> + * the AUX buffer before calling perf_aux_output_end().
> + */
> WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
> if (rb_need_aux_wakeup(rb))
> wakeup = true;
> --
> 2.25.1
>
Powered by blists - more mailing lists