Commit 991ea848 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Greg Kroah-Hartman
Browse files

perf/ring-buffer: Always use {READ,WRITE}_ONCE() for rb->user_page data

[ Upstream commit 4d839dd9


We must use {READ,WRITE}_ONCE() on rb->user_page data such that
concurrent usage will see whole values. A few key sites were missing
Suggested-by: default avatarYabin Cui <>
Signed-off-by: default avatarPeter Zijlstra (Intel) <>
Cc: Alexander Shishkin <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Jiri Olsa <>
Cc: Linus Torvalds <>
Cc: Peter Zijlstra <>
Cc: Stephane Eranian <>
Cc: Thomas Gleixner <>
Cc: Vince Weaver <>
Fixes: 7b732a75 ("perf_counter: new output ABI - part 1")

Signed-off-by: default avatarIngo Molnar <>
Signed-off-by: default avatarSasha Levin <>
parent c133c9db
......@@ -101,7 +101,7 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
* See perf_output_begin().
smp_wmb(); /* B, matches C */
rb->user_page->data_head = head;
WRITE_ONCE(rb->user_page->data_head, head);
* We must publish the head before decrementing the nest count,
......@@ -490,7 +490,7 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size)
rb->user_page->aux_head = rb->aux_head;
WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
if (rb_need_aux_wakeup(rb))
wakeup = true;
......@@ -522,7 +522,7 @@ int perf_aux_output_skip(struct perf_output_handle *handle, unsigned long size)
rb->aux_head += size;
rb->user_page->aux_head = rb->aux_head;
WRITE_ONCE(rb->user_page->aux_head, rb->aux_head);
if (rb_need_aux_wakeup(rb)) {
handle->wakeup = rb->aux_wakeup + rb->aux_watermark;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment