Skip to content

Commit

Permalink
perf/rapl: Fix crash in rapl_scale()
Browse files Browse the repository at this point in the history
commit 98b008d upstream.

This patch fixes a systematic crash in rapl_scale()
due to an invalid pointer.

The bug was introduced by commit:

  89cbc76 ("x86: Replace __get_cpu_var uses")

The fix is simple. Just put the parenthesis where it needs
to be, i.e., around rapl_pmu. To my surprise, the compiler
was not complaining about passing an integer instead of a
pointer.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 89cbc76 ("x86: Replace __get_cpu_var uses")
Signed-off-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: cl@linux.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150122203834.GA10228@thinkpad
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Stephane Eranian authored and Greg Kroah-Hartman committed Feb 6, 2015
1 parent 09c0adc commit ce95554
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/perf_event_intel_rapl.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static inline u64 rapl_scale(u64 v)
* or use ldexp(count, -32).
* Watts = Joules/Time delta
*/
return v << (32 - __this_cpu_read(rapl_pmu->hw_unit));
return v << (32 - __this_cpu_read(rapl_pmu)->hw_unit);
}

static u64 rapl_event_update(struct perf_event *event)
Expand Down

0 comments on commit ce95554

Please sign in to comment.