From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, arjan@linux.intel.com, a.p.zijlstra@chello.nl,
efault@gmx.de, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/core] perf_counter tools: remove glib dependency and fix bugs in kerneltop.c, fix poll()
Date: Tue, 24 Mar 2009 10:00:30 GMT [thread overview]
Message-ID: <tip-afc2a3523fc6664f3713b594daa1857f37ad87df@git.kernel.org> (raw)
In-Reply-To: <18888.29986.340328.540512@cargo.ozlabs.ibm.com>
Commit-ID: afc2a3523fc6664f3713b594daa1857f37ad87df
Gitweb: http://git.kernel.org/tip/afc2a3523fc6664f3713b594daa1857f37ad87df
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Tue, 24 Mar 2009 10:50:24 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 24 Mar 2009 10:56:18 +0100
perf_counter tools: remove glib dependency and fix bugs in kerneltop.c, fix poll()
Paul Mackerras wrote:
> I noticed the poll stuff is bogus - we have a 2D array of struct
> pollfds (MAX_NR_CPUS x MAX_COUNTERS), we fill in a sub-array (with the
> rest being uninitialized, since the array is on the stack) and then
> pass the first nr_cpus elements to poll. Not what we really meant, I
> suspect. :) Not even if we only have one counter, since it's the
> counter dimension that varies fastest.
This should fix the most obvious poll fubar.. not enough to fix the
full problem though..
Reported-by: Paul Mackerras <paulus@samba.org>
Reported-by: Mike Galbraith <efault@gmx.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arjan van de Ven <arjan@linux.intel.com>
LKML-Reference: <18888.29986.340328.540512@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
Documentation/perf_counter/kerneltop.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/Documentation/perf_counter/kerneltop.c b/Documentation/perf_counter/kerneltop.c
index ea13e4e..7ebde7a 100644
--- a/Documentation/perf_counter/kerneltop.c
+++ b/Documentation/perf_counter/kerneltop.c
@@ -1157,10 +1157,10 @@ static void mmap_read(struct mmap_data *md)
int main(int argc, char *argv[])
{
- struct pollfd event_array[MAX_NR_CPUS][MAX_COUNTERS];
+ struct pollfd event_array[MAX_NR_CPUS * MAX_COUNTERS];
struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
struct perf_counter_hw_event hw_event;
- int i, counter, group_fd;
+ int i, counter, group_fd, nr_poll = 0;
unsigned int cpu;
int ret;
@@ -1214,8 +1214,9 @@ int main(int argc, char *argv[])
if (group && group_fd == -1)
group_fd = fd[i][counter];
- event_array[i][counter].fd = fd[i][counter];
- event_array[i][counter].events = POLLIN;
+ event_array[nr_poll].fd = fd[i][counter];
+ event_array[nr_poll].events = POLLIN;
+ nr_poll++;
mmap_array[i][counter].counter = counter;
mmap_array[i][counter].prev = 0;
@@ -1247,7 +1248,7 @@ int main(int argc, char *argv[])
}
if (hits == events)
- ret = poll(event_array[0], nr_cpus, 1000);
+ ret = poll(event_array, nr_poll, 1000);
hits = events;
}
next prev parent reply other threads:[~2009-03-24 10:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 5:52 [PATCH] perf_counter tools: remove glib dependency and fix bugs in kerneltop.c Paul Mackerras
2009-03-24 7:57 ` Peter Zijlstra
2009-03-24 9:20 ` Ingo Molnar
2009-03-24 9:36 ` [tip:perfcounters/core] " Paul Mackerras
2009-03-24 9:38 ` Ingo Molnar
2009-03-24 10:12 ` Paul Mackerras
2009-03-24 10:14 ` Ingo Molnar
2009-03-24 10:00 ` Peter Zijlstra [this message]
[not found] ` <1237875063.7530.11.camel@marge.simson.net>
[not found] ` <1237875580.7827.3.camel@marge.simson.net>
[not found] ` <1237877884.8754.2.camel@marge.simson.net>
[not found] ` <18888.38308.223722.602357@cargo.ozlabs.ibm.com>
[not found] ` <1237888224.24918.159.camel@twins>
[not found] ` <1237891863.13862.27.camel@marge.simson.net>
[not found] ` <1237892368.24918.160.camel@twins>
2009-03-24 12:18 ` [PATCH] perf_counter: fix perf_poll() Peter Zijlstra
2009-03-24 12:21 ` Peter Zijlstra
2009-03-24 12:25 ` Ingo Molnar
2009-03-24 13:06 ` [tip:perfcounters/core] " Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-afc2a3523fc6664f3713b594daa1857f37ad87df@git.kernel.org \
--to=a.p.zijlstra@chello.nl \
--cc=arjan@linux.intel.com \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox