]> git.baikalelectronics.ru Git - kernel.git/commit
perf script python: Fix buffer size to report iregs in perf script
authorKajol Jain <kjain@linux.ibm.com>
Mon, 28 Jun 2021 06:23:41 +0000 (11:53 +0530)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 7 Jul 2021 14:15:44 +0000 (11:15 -0300)
commitfcd7953315bab56ab73f5251295253c878a3a96e
tree8b39dec104c39976ba00fd636259732d383925c9
parentfd6850a472d720613a94838acf92e3389e4f05a7
perf script python: Fix buffer size to report iregs in perf script

Commit 5f89991bbd90cd96 ("perf script python: Add more PMU fields to
event handler dict") added functionality to report fields like weight,
iregs, uregs etc via perf report.  That commit predefined buffer size to
512 bytes to print those fields.

But in PowerPC, since we added extended regs support in:

  9925c310e028519b ("perf powerpc: Support exposing Performance Monitor Counter SPRs as part of extended regs")
  24f98a3d50545c20 ("powerpc/perf: Add extended regs support for power10 platform")

Now iregs can carry more bytes of data and this predefined buffer size
can result to data loss in perf script output.

This patch resolves this issue by making the buffer size dynamic, based
on the number of registers needed to print. It also changes the
regs_map() return type from int to void, as it is not being used by the
set_regs_in_dict(), its only caller.

Fixes: 9925c310e028519b ("perf powerpc: Support exposing Performance Monitor Counter SPRs as part of extended regs")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lore.kernel.org/lkml/20210628062341.155839-1-kjain@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/scripting-engines/trace-event-python.c