perf header: Add die information in CPU topology

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.

Use similar method for core and socket to support die id and sibling
dies string.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Reviewed-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1559688644-106558-2-git-send-email-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Kan Liang
2019-06-04 15:50:41 -07:00
committed by Arnaldo Carvalho de Melo
parent b74d8686a1
commit acae8b36cd
6 changed files with 172 additions and 13 deletions

View File

@@ -153,7 +153,7 @@ struct {
String lists defining the core and CPU threads topology.
The string lists are followed by a variable length array
which contains core_id and socket_id of each cpu.
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.
@@ -162,14 +162,19 @@ struct {
struct perf_header_string_list threads; /* Variable length */
struct {
uint32_t core_id;
uint32_t die_id;
uint32_t socket_id;
} cpus[nr]; /* Variable length records */
};
Example:
sibling cores : 0-3
sibling cores : 0-8
sibling dies : 0-3
sibling dies : 4-7
sibling threads : 0-1
sibling threads : 2-3
sibling threads : 4-5
sibling threads : 6-7
HEADER_NUMA_TOPOLOGY = 14,