perf header: exempt x86_64 from core id test
PATCH 1/1 perf header: exempt x86_64 from core id test
On a VM running on an x86_64 architecture, it is possible for the socket id to be greater than the processor number. So exclude x86_64 arch from the core id test.
--- tools/perf/util/header.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/header.c +4 -1
@@ -2618,9 +2618,12 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)* The socket_id number might be higher than the numbers of cpus. * This depends on the configuration. * AArch64 is the same. +* It is also possible for a VM running x86_64 to have a larger +* socket_id number than the number of cpus. */ if (ph->env.arch && (!strncmp (ph->env.arch,"s390" ,4 ) - || !strncmp (ph->env.arch,"aarch64" ,7 ))) + || !strncmp (ph->env.arch,"aarch64" ,7 ) + || !strncmp (ph->env.arch,"x86_64" ,6 ))) do_core_id_test = false;for (i =0 ; i < (u32 )cpu_nr; i++) {
Signature · 1 line
2.49.0
Ian Rogers
reviewerQuoted 16 lines · Anubhav Shelat
On a VM running on an
x86_64architecture, it is possible for the socket id to be greater than the processor number. So excludex86_64arch from the core id test.Signed-off-by Anubhav Shelat <[email protected]>--- tools/perf/util/header.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/perf/util/header.c +0
-0@@ -2618,9 +2618,12 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)* The socket_id number might be higher than the numbers of cpus.
tools/perf/util/header.c static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused) · line 2627
Quoted 10 lines
tools/perf/util/header.c +4
-1* This depends on the configuration. * AArch64 is the same. +* It is also possible for a VM running x86_64 to have a larger +* socket_id number than the number of cpus. */ if (ph->env.arch && (!strncmp (ph->env.arch,"s390" ,4 ) - || !strncmp (ph->env.arch,"aarch64" ,7 ))) + || !strncmp (ph->env.arch,"aarch64" ,7 ) + || !strncmp (ph->env.arch,"x86_64" ,6 ))) do_core_id_test = false;
Why do we have a boolean called do_core_id_test that is checking a value assigned to the socket_id? :-)
I think at this point the test:
```
if (do_core_id_test && nr != (u32)-1 && nr > (u32)cpu_nr) {
pr_debug("socket_id number is too big."
"You may need to upgrade the perf tool.\n");
goto free_cpu;
}
```has no purpose and we can just delete it.
Thanks,
Ian
Quoted 5 lines
tools/perf/util/header.c +0
-1for (i =0 ; i < (u32 )cpu_nr; i++) { --2.49.0
Yeah that makes more sense. I can send a patch to delete the test.
Anubhav
Quoted 50 lines · Ian Rogers
Quoted 16 lines · Anubhav Shelat
On a VM running on an
x86_64architecture, it is possible for the socket id to be greater than the processor number. So excludex86_64arch from the core id test.Signed-off-by Anubhav Shelat <[email protected]>--- tools/perf/util/header.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/perf/util/header.c +0
-0@@ -2618,9 +2618,12 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)* The socket_id number might be higher than the numbers of cpus. tools/perf/util/header.c static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused) · line 2627
Quoted 10 lines
tools/perf/util/header.c +4
-1* This depends on the configuration. * AArch64 is the same. +* It is also possible for a VM running x86_64 to have a larger +* socket_id number than the number of cpus. */ if (ph->env.arch && (!strncmp (ph->env.arch,"s390" ,4 ) - || !strncmp (ph->env.arch,"aarch64" ,7 ))) + || !strncmp (ph->env.arch,"aarch64" ,7 ) + || !strncmp (ph->env.arch,"x86_64" ,6 ))) do_core_id_test = false;Why do we have a boolean called
do_core_id_testthat is checking a value assigned to thesocket_id? :-)
I think at this point the test:``` if (do_core_id_test && nr != (u32)-1 && nr > (u32)cpu_nr) { pr_debug("socket_id number is too big." "You may need to upgrade the perf tool.\n"); goto free_cpu; } ```has no purpose and we can just delete it.
Thanks,
IanQuoted 5 lines
tools/perf/util/header.c +0
-1for (i =0 ; i < (u32 )cpu_nr; i++) { --2.49.0