From: Yinghai Lu Date: Sat, 27 Dec 2008 05:05:06 +0000 (-0800) Subject: perf_counter: more barrier in blank weak function X-Git-Tag: firefly_0821_release~13973^2~536 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=01ea1ccaa24dea3552e103be13b7897211607a8b;p=firefly-linux-kernel-4.4.55.git perf_counter: more barrier in blank weak function 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 Signed-off-by: Ingo Molnar --- diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index d7a79f321b1c..37f771691f93 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c @@ -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)