Skip to content

Commit

Permalink
perf_counter: more barrier in blank weak function
Browse files Browse the repository at this point in the history
Impact: fix panic possible panic

Some versions of GCC inline the weak global function if it's empty.
Add a barrier() to work it around.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Dec 27, 2008
1 parent e44aef5 commit 01ea1cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ hw_perf_counter_init(struct perf_counter *counter)
}

u64 __weak hw_perf_save_disable(void) { return 0; }
void __weak hw_perf_restore(u64 ctrl) { }
void __weak hw_perf_counter_setup(void) { }
void __weak hw_perf_restore(u64 ctrl) { barrier(); }
void __weak hw_perf_counter_setup(void) { barrier(); }

static void
list_add_counter(struct perf_counter *counter, struct perf_counter_context *ctx)
Expand Down

0 comments on commit 01ea1cc

Please sign in to comment.