* [PATCH -tip/master] x86,perf: P4 PMU - fix counters management logic
[not found] <20100514185822.GF13509@lenovo>
@ 2010-05-14 19:08 ` Cyrill Gorcunov
2010-05-15 8:41 ` [tip:perf/core] x86, perf: " tip-bot for Cyrill Gorcunov
0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2010-05-14 19:08 UTC (permalink / raw)
To: Ingo Molnar, Lin Ming, Jaswinder Singh Rajput
Cc: Peter Zijlstra, Frederic Weisbecker, LKML
Jaswinder reported GP:
|
| Message from syslogd@ht at May 14 09:39:32 ...
| kernel:[ 314.908612] EIP: [<c100ccca>]
| x86_perf_event_set_period+0x19d/0x1b2 SS:ESP 0068:edac3d70
|
Ming has narrowed it down to comparision issue between arguments with
different sizes and signs. As result event index reached wrong value
which in turn led to GP fault.
Same time was found that p4_next_cntr has a broken logic and should
return counter index if only it was not yet borrowed for another event.
Reported-by: Jaswinder Singh Rajput <jaswinderlinux@gmail.com>
Reported-by: Lin Ming <ming.m.lin@intel.com>
Bisected-by: Lin Ming <ming.m.lin@intel.com>
Tested-by: Jaswinder Singh Rajput <jaswinderlinux@gmail.com>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Ingo Molnar <mingo@elte.hu>
CC: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
Forgot to CC LKML in first place, sorry for message duplication.
arch/x86/kernel/cpu/perf_event_p4.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event_p4.c
+++ linux-2.6.git/arch/x86/kernel/cpu/perf_event_p4.c
@@ -18,7 +18,7 @@
struct p4_event_bind {
unsigned int opcode; /* Event code and ESCR selector */
unsigned int escr_msr[2]; /* ESCR MSR for this event */
- unsigned char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */
+ char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */
};
struct p4_cache_event_bind {
@@ -747,11 +747,11 @@ static int p4_get_escr_idx(unsigned int
static int p4_next_cntr(int thread, unsigned long *used_mask,
struct p4_event_bind *bind)
{
- int i = 0, j;
+ int i, j;
for (i = 0; i < P4_CNTR_LIMIT; i++) {
- j = bind->cntr[thread][i++];
- if (j == -1 || !test_bit(j, used_mask))
+ j = bind->cntr[thread][i];
+ if (j != -1 && !test_bit(j, used_mask))
return j;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:perf/core] x86, perf: P4 PMU - fix counters management logic
2010-05-14 19:08 ` [PATCH -tip/master] x86,perf: P4 PMU - fix counters management logic Cyrill Gorcunov
@ 2010-05-15 8:41 ` tip-bot for Cyrill Gorcunov
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Cyrill Gorcunov @ 2010-05-15 8:41 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, gorcunov, a.p.zijlstra, gorcunov,
fweisbec, jaswinderlinux, ming.m.lin, tglx, mingo
Commit-ID: 1ff3d7d79204612ebe2e611d2592f8898908ca00
Gitweb: http://git.kernel.org/tip/1ff3d7d79204612ebe2e611d2592f8898908ca00
Author: Cyrill Gorcunov <gorcunov@gmail.com>
AuthorDate: Fri, 14 May 2010 23:08:15 +0400
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Sat, 15 May 2010 08:38:55 +0200
x86, perf: P4 PMU - fix counters management logic
Jaswinder reported this #GP:
|
| Message from syslogd@ht at May 14 09:39:32 ...
| kernel:[ 314.908612] EIP: [<c100ccca>]
| x86_perf_event_set_period+0x19d/0x1b2 SS:ESP 0068:edac3d70
|
Ming has narrowed it down to a comparision issue
between arguments with different sizes and
signs. As result event index reached a wrong
value which in turn led to a GP fault.
At the same time it was found that p4_next_cntr
has broken logic and should return the counter
index only if it was not yet borrowed for
another event.
Reported-by: Jaswinder Singh Rajput <jaswinderlinux@gmail.com>
Reported-by: Lin Ming <ming.m.lin@intel.com>
Bisected-by: Lin Ming <ming.m.lin@intel.com>
Tested-by: Jaswinder Singh Rajput <jaswinderlinux@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100514190815.GG13509@lenovo>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/perf_event_p4.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index cb875b1..424fc8d 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -18,7 +18,7 @@
struct p4_event_bind {
unsigned int opcode; /* Event code and ESCR selector */
unsigned int escr_msr[2]; /* ESCR MSR for this event */
- unsigned char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */
+ char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */
};
struct p4_cache_event_bind {
@@ -747,11 +747,11 @@ static int p4_get_escr_idx(unsigned int addr)
static int p4_next_cntr(int thread, unsigned long *used_mask,
struct p4_event_bind *bind)
{
- int i = 0, j;
+ int i, j;
for (i = 0; i < P4_CNTR_LIMIT; i++) {
- j = bind->cntr[thread][i++];
- if (j == -1 || !test_bit(j, used_mask))
+ j = bind->cntr[thread][i];
+ if (j != -1 && !test_bit(j, used_mask))
return j;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-15 8:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20100514185822.GF13509@lenovo>
2010-05-14 19:08 ` [PATCH -tip/master] x86,perf: P4 PMU - fix counters management logic Cyrill Gorcunov
2010-05-15 8:41 ` [tip:perf/core] x86, perf: " tip-bot for Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox