linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Anubhav Shelat <ashelat@redhat.com>
Cc: mpetlan@redhat.com, acme@kernel.org, namhyung@kernel.org,
	 linux-perf-users@vger.kernel.org, peterz@infradead.org,
	mingo@redhat.com,  mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	 adrian.hunter@intel.com, kan.liang@linux.intel.com,
	 dapeng1.mi@linux.intel.com, james.clark@linaro.org
Subject: Re: [PATCH] perf header: exempt x86_64 from core id test
Date: Tue, 17 Jun 2025 09:46:04 -0700	[thread overview]
Message-ID: <CAP-5=fUh6-gbbcX4znPHdocwjaGqHJRUqKcK-S93jMbNpZ8hSA@mail.gmail.com> (raw)
In-Reply-To: <20250617150847.4029177-2-ashelat@redhat.com>

On Tue, Jun 17, 2025 at 8:11 AM Anubhav Shelat <ashelat@redhat.com> wrote:
>
> 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.
>
> Signed-off-by: Anubhav Shelat <ashelat@redhat.com>
> ---
>  tools/perf/util/header.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index e3cdc3b7b4ab..c1b4651d0c6a 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -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;

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

>
>         for (i = 0; i < (u32)cpu_nr; i++) {
> --
> 2.49.0
>

  reply	other threads:[~2025-06-17 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17 15:08 [PATCH] perf header: exempt x86_64 from core id test Anubhav Shelat
2025-06-17 16:46 ` Ian Rogers [this message]
2025-06-18 13:55   ` Anubhav Shelat

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='CAP-5=fUh6-gbbcX4znPHdocwjaGqHJRUqKcK-S93jMbNpZ8hSA@mail.gmail.com' \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=ashelat@redhat.com \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).