lkml.org 
[lkml]   [2013]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:perf/core] tools/perf: Add required memory barriers
On Wed, 6 Nov 2013, tip-bot for Peter Zijlstra wrote:

> Commit-ID: a94d342b9cb09edfe888ea972af0883b6a8d992b
> Gitweb: http://git.kernel.org/tip/a94d342b9cb09edfe888ea972af0883b6a8d992b
> Author: Peter Zijlstra <peterz@infradead.org>
> AuthorDate: Wed, 30 Oct 2013 11:42:46 +0100
> Committer: Ingo Molnar <mingo@kernel.org>
> CommitDate: Wed, 6 Nov 2013 12:34:26 +0100
>
> tools/perf: Add required memory barriers
>
> To match patch bf378d341e48 ("perf: Fix perf ring buffer memory
> ordering") change userspace to also adhere to the ordering outlined.

...

> +++ b/tools/perf/util/evlist.h
> @@ -177,7 +177,7 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist, int err, char *buf, s
> static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
> {
> struct perf_event_mmap_page *pc = mm->base;
> - int head = pc->data_head;
> + int head = ACCESS_ONCE(pc->data_head);
> rmb();
> return head;

so is this ACCESS_ONCE required now for proper access to the mmap buffer?

remember that there are users trying to use this outside of the kernel
where we don't necessarily have access to internal kernl macros. Some of
these users aren't necessarily GPLv2 compatible either (PAPI for example
is more or less BSD licensed) so just cutting and pasting chunks of
internal kernel macros isn't always the best route either.

Vince



\
 
 \ /
  Last update: 2013-11-06 15:21    [W:1.745 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site