All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: kan.liang@linux.intel.com
Cc: jolsa@kernel.org, Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org, peterz@infradead.org,
	ak@linux.intel.com
Subject: Re: [PATCH V3 2/5] perf header: Add die information in CPU topology
Date: Thu, 6 Jun 2019 17:08:26 -0300	[thread overview]
Message-ID: <20190606200826.GI21245@kernel.org> (raw)
In-Reply-To: <20190606191210.GG21245@kernel.org>

Em Thu, Jun 06, 2019 at 04:12:10PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Jun 04, 2019 at 03:50:41PM -0700, kan.liang@linux.intel.com escreveu:
> > From: Kan Liang <kan.liang@linux.intel.com>
> > 
> > With the new CPUID.1F, a new level type of CPU topology, 'die', is
> > introduced. The 'die' information in CPU topology should be added in
> > perf header.
> > 
> > To be compatible with old perf.data, the patch checks the section size
> > before reading the die information. The new info is added at the end of
> > the cpu_topology section, the old perf tool ignores the extra data.
> > It never reads data crossing the section boundary.
> > 
> > The new perf tool with the patch can be used on legacy kernel. Add a
> > new function has_die_topology() to check if die topology information is
> > supported by kernel. The function only check X86 and CPU 0. Assuming
> > other CPUs have same topology.
> 
> You're changing the header, how would a new tool handle an old perf.data
> where this 'die_id' is not present? What about an old tool dealing with
> a perf.data with this die_id?
> 
> I couldn't see any provision for that, am I missing something?
> 
> /me goes to read tools/perf/util/cputopo.c ...
> 
> Yeah, its just the description on the perf.data doc file that confused
> me, I'll clarify that after finishing reviewing/applying this patchkit.

So I have this on top, please check.

- Arnaldo

commit a9396a70fc7101c108e1c91fa1771557bbbb57a1
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Thu Jun 6 17:03:18 2019 -0300

    perf data: Fix perf.data documentation for HEADER_CPU_TOPOLOGY
    
    The 'die' info isn't in the same array as core and socket ids, and we
    missed the 'dies' string list, that comes right after the 'core' +
    'socket' id variable length array, followed by the VLA for the dies.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Fixes: c9cb12c5ba08 ("perf header: Add die information in CPU topology")
    Link: https://lkml.kernel.org/n/tip-nubi6mxp2n8ofvlx7ph6k3h6@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/Documentation/perf.data-file-format.txt b/tools/perf/Documentation/perf.data-file-format.txt
index de78183f6881..5f54feb19977 100644
--- a/tools/perf/Documentation/perf.data-file-format.txt
+++ b/tools/perf/Documentation/perf.data-file-format.txt
@@ -151,20 +151,35 @@ struct {
 
 	HEADER_CPU_TOPOLOGY = 13,
 
-String lists defining the core and CPU threads topology.
-The string lists are followed by a variable length array
-which contains core_id, die_id (for x86) and socket_id of each cpu.
-The number of entries can be determined by the size of the
-section minus the sizes of both string lists.
-
 struct {
+	/*
+	 * First revision of HEADER_CPU_TOPOLOGY
+	 *
+	 * See 'struct perf_header_string_list' definition earlier
+	 * in this file.
+	 */
+
        struct perf_header_string_list cores; /* Variable length */
        struct perf_header_string_list threads; /* Variable length */
+
+       /*
+        * Second revision of HEADER_CPU_TOPOLOGY, older tools
+        * will not consider what comes next
+        */
+
        struct {
 	      uint32_t core_id;
-	      uint32_t die_id;
 	      uint32_t socket_id;
        } cpus[nr]; /* Variable length records */
+       /* 'nr' comes from previously processed HEADER_NRCPUS's nr_cpu_avail */
+
+        /*
+	 * Third revision of HEADER_CPU_TOPOLOGY, older tools
+	 * will not consider what comes next
+	 */
+
+	struct perf_header_string_list dies; /* Variable length */
+	uint32_t die_id[nr_cpus_avail]; /* from previously processed HEADER_NR_CPUS, VLA */
 };
 
 Example:

  reply	other threads:[~2019-06-06 20:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 22:50 [PATCH V3 1/5] perf cpumap: Retrieve die id information kan.liang
2019-06-04 22:50 ` [PATCH V3 2/5] perf header: Add die information in CPU topology kan.liang
2019-06-06 19:12   ` Arnaldo Carvalho de Melo
2019-06-06 20:08     ` Arnaldo Carvalho de Melo [this message]
2019-06-06 20:56       ` Liang, Kan
2019-06-17 19:32   ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-04 22:50 ` [PATCH V3 3/5] perf stat: Support per-die aggregation kan.liang
2019-06-04 22:50 ` [PATCH V3 4/5] perf header: Rename "sibling cores" to "sibling sockets" kan.liang
2019-06-17 19:34   ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-04 22:50 ` [PATCH V3 5/5] perf tools: Apply new CPU topology sysfs attributes kan.liang
2019-06-17 19:34   ` [tip:perf/core] " tip-bot for Kan Liang
2019-06-05  9:09 ` [PATCH V3 1/5] perf cpumap: Retrieve die id information Jiri Olsa
2019-06-06 19:19   ` Arnaldo Carvalho de Melo
2019-06-17 19:32 ` [tip:perf/core] " tip-bot for Kan Liang

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=20190606200826.GI21245@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.