Re: [PATCH v6 00/12] perf tools: fix perf stat with large socket IDs

From: Arnaldo Carvalho de Melo
Date: Thu Dec 24 2020 - 07:31:23 EST


Em Wed, Dec 23, 2020 at 11:17:47PM +0100, Jiri Olsa escreveu:
> On Fri, Dec 04, 2020 at 11:48:36AM +0000, John Garry wrote:
> > On 03/12/2020 15:39, Jiri Olsa wrote:
> >
> > +
> >
> > > On Thu, Nov 26, 2020 at 04:13:16PM +0200, James Clark wrote:
> > > > Changes since v5:
> > > > * Fix test for cpu_map__get_die() by shifting id before testing.
> > > > * Fix test for cpu_map__get_socket() by not using cpu_map__id_to_socket()
> > > > which is only valid in CPU aggregation mode.
> > > >
> > > > James Clark (12):
> > > > perf tools: Improve topology test
> > > > perf tools: Use allocator for perf_cpu_map
> > > > perf tools: Add new struct for cpu aggregation
> > > > perf tools: Replace aggregation ID with a struct
> > > > perf tools: add new map type for aggregation
> > > > perf tools: drop in cpu_aggr_map struct
> > > > perf tools: Start using cpu_aggr_id in map
> > > > perf tools: Add separate node member
> > > > perf tools: Add separate socket member
> > > > perf tools: Add separate die member
> > > > perf tools: Add separate core member
> > > > perf tools: Add separate thread member
> > >
> > > Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > >
> >
> > Tested-by: John Garry <john.garry@xxxxxxxxxx>
>
> hi,
> I was wondering where this went, and noticed that
> Arnaldo was not CC-ed on the cover letter ;-)

Looking at it right now, used the Message-ID and b4 got everything,
there are some fuzzies that I'm checking:

[acme@five perf]$ git am --show-current-patch=diff | patch -p1
patching file tools/perf/builtin-stat.c
Hunk #1 succeeded at 1186 (offset -2 lines).
Hunk #2 succeeded at 1347 (offset -2 lines).
Hunk #3 succeeded at 1373 (offset -2 lines).
Hunk #4 succeeded at 1399 (offset -2 lines).
Hunk #5 succeeded at 1448 (offset -2 lines).
patching file tools/perf/tests/topology.c
patching file tools/perf/util/cpumap.c
patching file tools/perf/util/cpumap.h
patching file tools/perf/util/stat-display.c
Hunk #8 succeeded at 326 with fuzz 2 (offset -3 lines).
Hunk #9 succeeded at 334 (offset -3 lines).
Hunk #10 succeeded at 397 (offset -3 lines).
Hunk #11 succeeded at 500 (offset -3 lines).
Hunk #12 succeeded at 589 (offset -3 lines).
Hunk #13 succeeded at 598 (offset -3 lines).
Hunk #14 succeeded at 634 (offset -3 lines).
Hunk #15 succeeded at 656 (offset -3 lines).
Hunk #16 succeeded at 739 (offset -3 lines).
Hunk #17 succeeded at 763 (offset -3 lines).
Hunk #18 succeeded at 781 (offset -3 lines).
Hunk #19 succeeded at 827 (offset -3 lines).
Hunk #20 succeeded at 855 (offset -3 lines).
Hunk #21 succeeded at 870 (offset -3 lines).
Hunk #22 succeeded at 888 (offset -3 lines).
Hunk #23 succeeded at 897 (offset -3 lines).
Hunk #24 succeeded at 908 (offset -3 lines).
Hunk #25 succeeded at 1159 (offset -3 lines).
patching file tools/perf/util/stat.c
patching file tools/perf/util/stat.h
[acme@five perf]$

[acme@five perf]$ git am --show-current-patch=diff | head -20
---
tools/perf/builtin-stat.c | 76 +++++++++++++----------
tools/perf/tests/topology.c | 17 +++---
tools/perf/util/cpumap.c | 82 ++++++++++++++-----------
tools/perf/util/cpumap.h | 10 +--
tools/perf/util/stat-display.c | 108 +++++++++++++++++++--------------
tools/perf/util/stat.c | 2 +-
tools/perf/util/stat.h | 5 +-
7 files changed, 173 insertions(+), 127 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index f15b2f8aa14d..f10c67a26472 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1188,65 +1188,67 @@ static struct option stat_options[] = {
OPT_END()
};

-static int perf_stat__get_socket(struct perf_stat_config *config __maybe_unused,
+static struct aggr_cpu_id perf_stat__get_socket(struct perf_stat_config *config __maybe_unused,
[acme@five perf]$

> jirka
>
> >
> > I still think that vendors (like us) need to fix/improve their firmware
> > tables so that we don't get silly big numbers for socket/package IDs, like
> > S5418-D0, below:
> >
> > $./perf stat -a --per-die
> >
> > Performance counter stats for 'system wide':
> >
> > S36-D0 48 72,216.31 msec cpu-clock # 47.933 CPUs utilized
> > S36-D0 48 174 context-switches # 0.002 K/sec
> > S36-D0 48 48 cpu-migrations # 0.001 K/sec
> > S36-D0 48 0 page-faults # 0.000 K/sec
> > S36-D0 48 7,991,698 cycles # 0.000 GHz
> > S36-D0 48 4,750,040 instructions # 0.59 insn per cycle
> > S36-D0 1 <not supported> branches
> > S36-D0 48 32,928 branch-misses # 0.00% of all branches
> > S5418-D0 48 72,189.54 msec cpu-clock # 47.915 CPUs utilized
> > S5418-D0 48 176 context-switches # 0.002 K/sec
> > S5418-D0 48 48 cpu-migrations # 0.001 K/sec
> > S5418-D0 48 0 page-faults # 0.000 K/sec
> > S5418-D0 48 5,677,218 cycles # 0.000 GHz
> > S5418-D0 48 3,872,285 instructions # 0.68 insn per cycle
> > S5418-D0 1 <not supported> branches
> > S5418-D0 48 29,208 branch-misses # 0.00% of all branches
> >
> > 1.506615297 seconds time elapsed
> >
> > but at least it works now. Thanks.
> >
> > >
> > > >
> > > > tools/perf/builtin-stat.c | 128 ++++++++++++------------
> > > > tools/perf/tests/topology.c | 64 ++++++++++--
> > > > tools/perf/util/cpumap.c | 171 ++++++++++++++++++++++-----------
> > > > tools/perf/util/cpumap.h | 55 ++++++-----
> > > > tools/perf/util/stat-display.c | 102 ++++++++++++--------
> > > > tools/perf/util/stat.c | 2 +-
> > > > tools/perf/util/stat.h | 9 +-
> > > > 7 files changed, 337 insertions(+), 194 deletions(-)
> > > >
> > > > --
> > > > 2.28.0
> > > >
> > >
> > > .
> > >
> >
>

--

- Arnaldo