LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] perf/rapl: fix crash in rapl_scale()
@ 2015-01-22 20:38 Stephane Eranian
2015-01-23 8:39 ` Peter Zijlstra
2015-01-28 14:29 ` [tip:perf/urgent] perf/rapl: Fix " tip-bot for Stephane Eranian
0 siblings, 2 replies; 3+ messages in thread
From: Stephane Eranian @ 2015-01-22 20:38 UTC (permalink / raw)
To: linux-kernel; +Cc: peterz, mingo, vincent.weaver, cl, paulus, acme
This patch fixes a systematic crash in rapl_scale()
due to an invalid pointer.
The bug was introduced by commit:
commit 89cbc76768c2fa4ed95545bf961f3a14ddfeed21
Author: Christoph Lameter <cl@linux.com>
Date: Sun Aug 17 12:30:40 2014 -0500
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>
Signed-off-by: Stephane Eranian <eranian@google.com>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
--
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
index 6e434f8..c4bb8b8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
@@ -142,7 +142,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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/rapl: fix crash in rapl_scale()
2015-01-22 20:38 [PATCH] perf/rapl: fix crash in rapl_scale() Stephane Eranian
@ 2015-01-23 8:39 ` Peter Zijlstra
2015-01-28 14:29 ` [tip:perf/urgent] perf/rapl: Fix " tip-bot for Stephane Eranian
1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2015-01-23 8:39 UTC (permalink / raw)
To: Stephane Eranian; +Cc: linux-kernel, mingo, vincent.weaver, cl, paulus, acme
On Thu, Jan 22, 2015 at 09:38:34PM +0100, Stephane Eranian wrote:
>
> This patch fixes a systematic crash in rapl_scale()
> due to an invalid pointer.
>
> The bug was introduced by commit:
> commit 89cbc76768c2fa4ed95545bf961f3a14ddfeed21
> Author: Christoph Lameter <cl@linux.com>
> Date: Sun Aug 17 12:30:40 2014 -0500
>
> 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>
> Signed-off-by: Stephane Eranian <eranian@google.com>
> Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf/rapl: Fix crash in rapl_scale()
2015-01-22 20:38 [PATCH] perf/rapl: fix crash in rapl_scale() Stephane Eranian
2015-01-23 8:39 ` Peter Zijlstra
@ 2015-01-28 14:29 ` tip-bot for Stephane Eranian
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Stephane Eranian @ 2015-01-28 14:29 UTC (permalink / raw)
To: linux-tip-commits
Cc: peterz, eranian, torvalds, mingo, tglx, acme, vincent.weaver,
hpa, linux-kernel
Commit-ID: 98b008dff8452653909d9263efda925873e8d8bb
Gitweb: http://git.kernel.org/tip/98b008dff8452653909d9263efda925873e8d8bb
Author: Stephane Eranian <eranian@google.com>
AuthorDate: Thu, 22 Jan 2015 21:38:34 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 28 Jan 2015 13:04:35 +0100
perf/rapl: Fix crash in rapl_scale()
This patch fixes a systematic crash in rapl_scale()
due to an invalid pointer.
The bug was introduced by commit:
89cbc76768c2 ("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: 89cbc76768c2 ("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>
---
arch/x86/kernel/cpu/perf_event_intel_rapl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
index 6e434f8..c4bb8b8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
@@ -142,7 +142,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)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-28 21:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 20:38 [PATCH] perf/rapl: fix crash in rapl_scale() Stephane Eranian
2015-01-23 8:39 ` Peter Zijlstra
2015-01-28 14:29 ` [tip:perf/urgent] perf/rapl: Fix " tip-bot for Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).