lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ci5LY-sO0DYNk4TOa2RYC5XtAUXK8Q4=BO1YJGXWBV=5A@mail.gmail.com>
Date:   Tue, 28 Dec 2021 16:02:04 -0800
From:   Namhyung Kim <namhyung@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Andi Kleen <ak@...ux.intel.com>, Jiri Olsa <jolsa@...hat.com>,
        John Garry <john.garry@...wei.com>,
        Kajol Jain <kjain@...ux.ibm.com>,
        "Paul A . Clarke" <pc@...ibm.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Riccardo Mancini <rickyman7@...il.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        linux-perf-users <linux-perf-users@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Vineet Singh <vineet.singh@...el.com>,
        James Clark <james.clark@....com>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Leo Yan <leo.yan@...aro.org>, coresight@...ts.linaro.org,
        linux-arm-kernel@...ts.infradead.org,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 24/48] perf cpumap: Add CPU to aggr_cpu_id

On Wed, Dec 22, 2021 at 11:47 PM Ian Rogers <irogers@...gle.com> wrote:
>
> With no aggregration, such as 'perf stat -A', the aggr_cpu_id lacks a
> way to describe per CPU aggregation and the core is set to the CPU in
> places like print_counter_aggrdata in stat-display.c. Setting the core
> to the CPU is undesirable as the CPU will exceed valid core values and
> lead to confusion. Add a CPU variable to address this.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
[SNIP]
> diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
> index 985c87f1f1ca..a535fd360d46 100644
> --- a/tools/perf/util/cpumap.c
> +++ b/tools/perf/util/cpumap.c
> @@ -253,6 +253,20 @@ struct aggr_cpu_id aggr_cpu_id__core(int cpu, void *data)
>
>  }
>
> +struct aggr_cpu_id aggr_cpu_id__cpu(int cpu, void *data)
> +{
> +       struct aggr_cpu_id id;
> +
> +       /* aggr_cpu_id__die returns a struct with socket and die set*/

A copy and paste error?

Thanks,
Namhyung


> +       id = aggr_cpu_id__core(cpu, data);
> +       if (aggr_cpu_id__is_empty(&id))
> +               return id;
> +
> +       id.cpu = cpu;
> +       return id;
> +
> +}
> +
>  struct aggr_cpu_id aggr_cpu_id__node(int cpu, void *data __maybe_unused)
>  {
>         struct aggr_cpu_id id = aggr_cpu_id__empty();
> @@ -576,7 +590,8 @@ bool aggr_cpu_id__equal(const struct aggr_cpu_id *a, const struct aggr_cpu_id *b
>                 a->node == b->node &&
>                 a->socket == b->socket &&
>                 a->die == b->die &&
> -               a->core == b->core;
> +               a->core == b->core &&
> +               a->cpu == b->cpu;
>  }
>
>  bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a)
> @@ -585,7 +600,8 @@ bool aggr_cpu_id__is_empty(const struct aggr_cpu_id *a)
>                 a->node == -1 &&
>                 a->socket == -1 &&
>                 a->die == -1 &&
> -               a->core == -1;
> +               a->core == -1 &&
> +               a->cpu == -1;
>  }
>
>  struct aggr_cpu_id aggr_cpu_id__empty(void)
> @@ -595,7 +611,8 @@ struct aggr_cpu_id aggr_cpu_id__empty(void)
>                 .node = -1,
>                 .socket = -1,
>                 .die = -1,
> -               .core = -1
> +               .core = -1,
> +               .cpu = -1
>         };
>         return ret;
>  }
> diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
> index 8acef8ff8753..651c6417d3c3 100644
> --- a/tools/perf/util/cpumap.h
> +++ b/tools/perf/util/cpumap.h
> @@ -22,6 +22,8 @@ struct aggr_cpu_id {
>         int die;
>         /** The core id as read from /sys/devices/system/cpu/cpuX/topology/core_id. */
>         int core;
> +       /** CPU aggregation, note there is one CPU for each SMT thread. */
> +       int cpu;
>  };
>
>  /** A collection of aggr_cpu_id values, the "built" version is sorted and uniqued. */
> @@ -109,6 +111,12 @@ struct aggr_cpu_id aggr_cpu_id__die(int cpu, void *data);
>   * compatible with aggr_cpu_id_get_t.
>   */
>  struct aggr_cpu_id aggr_cpu_id__core(int cpu, void *data);
> +/**
> + * aggr_cpu_id__core - Create an aggr_cpu_id with the cpu, core, die and socket
> + * populated with the cpu, core, die and socket for cpu. The function signature
> + * is compatible with aggr_cpu_id_get_t.
> + */
> +struct aggr_cpu_id aggr_cpu_id__cpu(int cpu, void *data);
>  /**
>   * aggr_cpu_id__node - Create an aggr_cpu_id with the numa node populated for
>   * cpu. The function signature is compatible with aggr_cpu_id_get_t.
> --
> 2.34.1.307.g9b7440fafd-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ