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: <CAP-5=fVzcQCUA611byVn47Fyt0mWLfQ2q_619zqYwJB=7ckPtw@mail.gmail.com>
Date:   Tue, 28 Sep 2021 11:00:47 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     John Garry <john.garry@...wei.com>
Cc:     will@...nel.org, mathieu.poirier@...aro.org, leo.yan@...aro.org,
        peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...hat.com, namhyung@...nel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        linuxarm@...wei.com, zhangshaokun@...ilicon.com,
        liuqi115@...wei.com
Subject: Re: [PATCH 2/5] perf jevents: Support ConfigCode

On Thu, Sep 16, 2021 at 5:39 AM John Garry <john.garry@...wei.com> wrote:
>
> Some PMUs use "config=XXX" for eventcodes, like:
>
> more /sys/bus/event_source/devices/hisi_sccl1_ddrc3/events/act_cmd
> config=0x5
>
> However jevents would give an alias with .event field "event=0x5" for this
> event. This is handled without issue by the parse events code, but the pmu
> alias code gets a bit confused, as it warns about assigning "event=0x5"
> over "config=0x5" in perf_pmu_assign_str() when merging aliases:
> ./perf stat -v -e act_cmd
> ...
> alias act_cmd differs in field 'value'
> ...
>
> To make things a bit more straightforward, allow jevents to support
> "config=XXX" as well, by supporting a "ConfigCode" field.
>
> Signed-off-by: John Garry <john.garry@...wei.com>

Acked-by: Ian Rogers <irogers@...gle.com>

Thanks,
Ian

> ---
>  tools/perf/pmu-events/jevents.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
> index 6731b3cf0c2f..ef92c2fdd45d 100644
> --- a/tools/perf/pmu-events/jevents.c
> +++ b/tools/perf/pmu-events/jevents.c
> @@ -575,10 +575,12 @@ static int json_events(const char *fn,
>                 struct json_event je = {};
>                 char *arch_std = NULL;
>                 unsigned long long eventcode = 0;
> +               unsigned long long configcode = 0;
>                 struct msrmap *msr = NULL;
>                 jsmntok_t *msrval = NULL;
>                 jsmntok_t *precise = NULL;
>                 jsmntok_t *obj = tok++;
> +               bool configcode_present = false;
>
>                 EXPECT(obj->type == JSMN_OBJECT, obj, "expected object");
>                 for (j = 0; j < obj->size; j += 2) {
> @@ -601,6 +603,12 @@ static int json_events(const char *fn,
>                                 addfield(map, &code, "", "", val);
>                                 eventcode |= strtoul(code, NULL, 0);
>                                 free(code);
> +                       } else if (json_streq(map, field, "ConfigCode")) {
> +                               char *code = NULL;
> +                               addfield(map, &code, "", "", val);
> +                               configcode |= strtoul(code, NULL, 0);
> +                               free(code);
> +                               configcode_present = true;
>                         } else if (json_streq(map, field, "ExtSel")) {
>                                 char *code = NULL;
>                                 addfield(map, &code, "", "", val);
> @@ -682,7 +690,10 @@ static int json_events(const char *fn,
>                                 addfield(map, &extra_desc, " ",
>                                                 "(Precise event)", NULL);
>                 }
> -               snprintf(buf, sizeof buf, "event=%#llx", eventcode);
> +               if (configcode_present)
> +                       snprintf(buf, sizeof buf, "config=%#llx", configcode);
> +               else
> +                       snprintf(buf, sizeof buf, "event=%#llx", eventcode);
>                 addfield(map, &event, ",", buf, NULL);
>                 if (je.desc && extra_desc)
>                         addfield(map, &je.desc, " ", extra_desc, NULL);
> --
> 2.26.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ