* [PATCH 1/2] perf header: Fix numa topology printing
2012-10-23 7:27 perf: header: Regression Andrew Jones
@ 2012-10-23 13:44 ` Namhyung Kim
2012-10-23 14:12 ` Andrew Jones
0 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-10-23 13:44 UTC (permalink / raw)
To: Andrew Jones; +Cc: Arnaldo Carvalho de Melo, LKML
Andrew reported that the commit 7e94cfcc9d20 ("perf header: Use pre-
processed session env when printing") regresses the header output.
It was because of a missed string pointer calculation in the loop.
Reported-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
| 2 ++
1 file changed, 2 insertions(+)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 7daad237dea5..566b84c695c8 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1378,6 +1378,8 @@ static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused,
str = tmp + 1;
fprintf(fp, "# node%u cpu list : %s\n", c, str);
+
+ str += strlen(str) + 1;
}
return;
error:
--
1.7.9.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] perf header: Fix numa topology printing
2012-10-23 13:44 ` [PATCH 1/2] perf header: Fix numa topology printing Namhyung Kim
@ 2012-10-23 14:12 ` Andrew Jones
2012-10-24 7:00 ` Namhyung Kim
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Jones @ 2012-10-23 14:12 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Arnaldo Carvalho de Melo, LKML
On Tue, Oct 23, 2012 at 10:44:49PM +0900, Namhyung Kim wrote:
> Andrew reported that the commit 7e94cfcc9d20 ("perf header: Use pre-
> processed session env when printing") regresses the header output.
> It was because of a missed string pointer calculation in the loop.
>
> Reported-by: Andrew Jones <drjones@redhat.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/header.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 7daad237dea5..566b84c695c8 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -1378,6 +1378,8 @@ static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused,
>
> str = tmp + 1;
> fprintf(fp, "# node%u cpu list : %s\n", c, str);
> +
> + str += strlen(str) + 1;
> }
> return;
> error:
> --
> 1.7.9.2
>
works for me
Tested-by: Andrew Jones <drjones@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] perf header: Fix numa topology printing
2012-10-23 14:12 ` Andrew Jones
@ 2012-10-24 7:00 ` Namhyung Kim
2012-10-24 7:49 ` Andrew Jones
0 siblings, 1 reply; 9+ messages in thread
From: Namhyung Kim @ 2012-10-24 7:00 UTC (permalink / raw)
To: Andrew Jones; +Cc: Arnaldo Carvalho de Melo, LKML
Hi Andrew,
On Tue, 23 Oct 2012 16:12:19 +0200, Andrew Jones wrote:
> On Tue, Oct 23, 2012 at 10:44:49PM +0900, Namhyung Kim wrote:
>> Andrew reported that the commit 7e94cfcc9d20 ("perf header: Use pre-
>> processed session env when printing") regresses the header output.
>> It was because of a missed string pointer calculation in the loop.
>
> works for me
>
> Tested-by: Andrew Jones <drjones@redhat.com>
Did you test both of the patches?
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] perf header: Fix numa topology printing
2012-10-24 7:00 ` Namhyung Kim
@ 2012-10-24 7:49 ` Andrew Jones
2012-10-29 15:17 ` Namhyung Kim
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Jones @ 2012-10-24 7:49 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Arnaldo Carvalho de Melo, LKML
On Wed, Oct 24, 2012 at 04:00:08PM +0900, Namhyung Kim wrote:
> Hi Andrew,
>
> On Tue, 23 Oct 2012 16:12:19 +0200, Andrew Jones wrote:
> > On Tue, Oct 23, 2012 at 10:44:49PM +0900, Namhyung Kim wrote:
> >> Andrew reported that the commit 7e94cfcc9d20 ("perf header: Use pre-
> >> processed session env when printing") regresses the header output.
> >> It was because of a missed string pointer calculation in the loop.
> >
> > works for me
> >
> > Tested-by: Andrew Jones <drjones@redhat.com>
>
> Did you test both of the patches?
Yes, I applied both before testing. I'll add a tested by to the other
as well.
drew
>
> Thanks,
> Namhyung
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] perf header: Fix numa topology printing
2012-10-24 7:49 ` Andrew Jones
@ 2012-10-29 15:17 ` Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2012-10-29 15:17 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Andrew Jones, LKML
2012-10-24 (수), 09:49 +0200, Andrew Jones:
> On Wed, Oct 24, 2012 at 04:00:08PM +0900, Namhyung Kim wrote:
> > On Tue, 23 Oct 2012 16:12:19 +0200, Andrew Jones wrote:
> > > On Tue, Oct 23, 2012 at 10:44:49PM +0900, Namhyung Kim wrote:
> > >> Andrew reported that the commit 7e94cfcc9d20 ("perf header: Use pre-
> > >> processed session env when printing") regresses the header output.
> > >> It was because of a missed string pointer calculation in the loop.
> > >
> > > works for me
> > >
> > > Tested-by: Andrew Jones <drjones@redhat.com>
> >
> > Did you test both of the patches?
>
> Yes, I applied both before testing. I'll add a tested by to the other
> as well.
Arnaldo, I think these two should go through the urgent branch. Would
you apply them?
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 9+ messages in thread
* [GIT PULL 0/2] perf/urgent fixes
@ 2012-10-30 13:02 Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 1/2] perf header: Fix numa topology printing Arnaldo Carvalho de Melo
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-30 13:02 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Andrew Jones,
Namhyung Kim, arnaldo.melo, Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit 0d855354ea351bec6b222e9fea86a876cfafdcb6:
perf, powerpc: Fix hw breakpoints returning -ENOSPC (2012-10-30 10:07:58 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
for you to fetch changes up to f787d9519fb10411f2948f5b9957a1669879ba84:
perf tools: Fix strbuf_addf() when the buffer needs to grow (2012-10-30 10:32:56 -0200)
----------------------------------------------------------------
perf/urgent fixes
. Fix numa topology printing, from Namhyung Kim.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Namhyung Kim (2):
perf header: Fix numa topology printing
perf tools: Fix strbuf_addf() when the buffer needs to grow
tools/perf/util/header.c | 2 ++
tools/perf/util/strbuf.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] perf header: Fix numa topology printing
2012-10-30 13:02 [GIT PULL 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2012-10-30 13:02 ` Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 2/2] perf tools: Fix strbuf_addf() when the buffer needs to grow Arnaldo Carvalho de Melo
2012-11-13 17:55 ` [GIT PULL 0/2] perf/urgent fixes Ingo Molnar
2 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-30 13:02 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Andrew Jones,
Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
Andrew reported that the commit 7e94cfcc9d20 ("perf header: Use pre-
processed session env when printing") regresses the header output. It
was because of a missed string pointer calculation in the loop.
Reported-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andrew Jones <drjones@redhat.com>
Link: http://lkml.kernel.org/r/1350999890-6920-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
| 2 ++
1 file changed, 2 insertions(+)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 7daad23..566b84c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1378,6 +1378,8 @@ static void print_numa_topology(struct perf_header *ph, int fd __maybe_unused,
str = tmp + 1;
fprintf(fp, "# node%u cpu list : %s\n", c, str);
+
+ str += strlen(str) + 1;
}
return;
error:
--
1.7.9.2.358.g22243
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] perf tools: Fix strbuf_addf() when the buffer needs to grow
2012-10-30 13:02 [GIT PULL 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 1/2] perf header: Fix numa topology printing Arnaldo Carvalho de Melo
@ 2012-10-30 13:02 ` Arnaldo Carvalho de Melo
2012-11-13 17:55 ` [GIT PULL 0/2] perf/urgent fixes Ingo Molnar
2 siblings, 0 replies; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-10-30 13:02 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Andrew Jones,
Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
This was found during chasing down the header output regression. The
strbuf_addf() was checking buffer length with a result of vscnprintf()
which cannot be greater than that of strbuf_avail().
Since numa topology and pmu mapping info in header were converted to use
strbuf, it sometimes caused uninteresting behaviors with the broken
strbuf.
Fix it by using vsnprintf() which returns desired output string length
regardless of the available buffer size and grow the buffer if needed.
Reported-by: Andrew Jones <drjones@redhat.com>
Tested-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andrew Jones <drjones@redhat.com>
Link: http://lkml.kernel.org/r/1350999890-6920-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/strbuf.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c
index 2eeb51b..cfa9068 100644
--- a/tools/perf/util/strbuf.c
+++ b/tools/perf/util/strbuf.c
@@ -90,17 +90,17 @@ void strbuf_addf(struct strbuf *sb, const char *fmt, ...)
if (!strbuf_avail(sb))
strbuf_grow(sb, 64);
va_start(ap, fmt);
- len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
+ len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
va_end(ap);
if (len < 0)
- die("your vscnprintf is broken");
+ die("your vsnprintf is broken");
if (len > strbuf_avail(sb)) {
strbuf_grow(sb, len);
va_start(ap, fmt);
- len = vscnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
+ len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
va_end(ap);
if (len > strbuf_avail(sb)) {
- die("this should not happen, your snprintf is broken");
+ die("this should not happen, your vsnprintf is broken");
}
}
strbuf_setlen(sb, sb->len + len);
--
1.7.9.2.358.g22243
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [GIT PULL 0/2] perf/urgent fixes
2012-10-30 13:02 [GIT PULL 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 1/2] perf header: Fix numa topology printing Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 2/2] perf tools: Fix strbuf_addf() when the buffer needs to grow Arnaldo Carvalho de Melo
@ 2012-11-13 17:55 ` Ingo Molnar
2 siblings, 0 replies; 9+ messages in thread
From: Ingo Molnar @ 2012-11-13 17:55 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Andrew Jones, Namhyung Kim, arnaldo.melo,
Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit 0d855354ea351bec6b222e9fea86a876cfafdcb6:
>
> perf, powerpc: Fix hw breakpoints returning -ENOSPC (2012-10-30 10:07:58 +0100)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-urgent-for-mingo
>
> for you to fetch changes up to f787d9519fb10411f2948f5b9957a1669879ba84:
>
> perf tools: Fix strbuf_addf() when the buffer needs to grow (2012-10-30 10:32:56 -0200)
>
> ----------------------------------------------------------------
> perf/urgent fixes
>
> . Fix numa topology printing, from Namhyung Kim.
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Namhyung Kim (2):
> perf header: Fix numa topology printing
> perf tools: Fix strbuf_addf() when the buffer needs to grow
>
> tools/perf/util/header.c | 2 ++
> tools/perf/util/strbuf.c | 8 ++++----
> 2 files changed, 6 insertions(+), 4 deletions(-)
Pulled, thanks Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-13 17:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-30 13:02 [GIT PULL 0/2] perf/urgent fixes Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 1/2] perf header: Fix numa topology printing Arnaldo Carvalho de Melo
2012-10-30 13:02 ` [PATCH 2/2] perf tools: Fix strbuf_addf() when the buffer needs to grow Arnaldo Carvalho de Melo
2012-11-13 17:55 ` [GIT PULL 0/2] perf/urgent fixes Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2012-10-23 7:27 perf: header: Regression Andrew Jones
2012-10-23 13:44 ` [PATCH 1/2] perf header: Fix numa topology printing Namhyung Kim
2012-10-23 14:12 ` Andrew Jones
2012-10-24 7:00 ` Namhyung Kim
2012-10-24 7:49 ` Andrew Jones
2012-10-29 15:17 ` Namhyung Kim
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).