perf/urgent fixes
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.
----------------------------------------------------------------
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(-)
PATCH 1/2 perf header: Fix numa topology printing
From: Namhyung Kim <[email protected]>
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.
--- tools/perf/util/header.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/header.c +2 -0
@@ -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:
Signature · 1 line
1.7.9.2.358.g22243
PATCH 2/2 perf tools: Fix strbuf_addf() when the buffer needs to grow
In reply to Arnaldo Carvalho de MeloFrom: Namhyung Kim <[email protected]>
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.
--- tools/perf/util/strbuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/strbuf.c +4 -4
@@ -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);
Signature · 1 line
1.7.9.2.358.g22243
Quoted 25 lines · 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/linuxtags/perf-urgent-for-mingofor 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 <[email protected]>
Quoted 8 lines
----------------------------------------------------------------
Namhyung Kim (2):
perf header: Fix numa topology printing
perf tools: Fixstrbuf_addf()when the buffer needs to growtools/perf/util/header.c | 2 ++ tools/perf/util/strbuf.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
Pulled, thanks Arnaldo!
Ingo