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]
Date:   Fri, 23 Jun 2023 22:28:57 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Yang Jihong <yangjihong1@...wei.com>
Cc:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...nel.org, irogers@...gle.com, adrian.hunter@...el.com,
        anshuman.khandual@....com, jesussanp@...gle.com,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/4] perf tools: Add printing perf_event_attr config
 symbol in perf_event_attr__fprintf()

Hello,

On Thu, Jun 22, 2023 at 10:46 PM Yang Jihong <yangjihong1@...wei.com> wrote:
>
> When printing perf_event_attr, always display perf_event_attr config and
> its symbol to improve the readability of debugging information.
>

[SNIP]
> +
> +#ifdef HAVE_LIBTRACEEVENT
> +static void __p_config_tracepoint_id(char *buf, size_t size, u64 value)
> +{
> +       char *str = tracepoint_id_to_name(value);

This makes the python module import test failing due to the
undefined symbol.  I'll fix it by adding a dummy function in
util/python.c file.  But next time, please run `perf test` first
and make sure you don't break anything.

Thanks,
Namhyung


> +
> +       print_id_hex(str);
> +       free(str);
> +}
> +#endif
> +
> +static void __p_config_id(char *buf, size_t size, u32 type, u64 value)
> +{
> +       switch (type) {
> +       case PERF_TYPE_HARDWARE:
> +               return __p_config_hw_id(buf, size, value);
> +       case PERF_TYPE_SOFTWARE:
> +               return __p_config_sw_id(buf, size, value);
> +       case PERF_TYPE_HW_CACHE:
> +               return __p_config_hw_cache_id(buf, size, value);
> +       case PERF_TYPE_TRACEPOINT:
> +#ifdef HAVE_LIBTRACEEVENT
> +               return __p_config_tracepoint_id(buf, size, value);
> +#endif
> +       case PERF_TYPE_RAW:
> +       case PERF_TYPE_BREAKPOINT:
> +       default:
> +               snprintf(buf, size, "%#"PRIx64, value);
> +               return;
> +       }
> +}
> +
>  #define BUF_SIZE               1024
>
>  #define p_hex(val)             snprintf(buf, BUF_SIZE, "%#"PRIx64, (uint64_t)(val))
> @@ -111,6 +246,7 @@ static void __p_type_id(char *buf, size_t size, u64 value)
>  #define p_branch_sample_type(val) __p_branch_sample_type(buf, BUF_SIZE, val)
>  #define p_read_format(val)     __p_read_format(buf, BUF_SIZE, val)
>  #define p_type_id(val)         __p_type_id(buf, BUF_SIZE, val)
> +#define p_config_id(val)       __p_config_id(buf, BUF_SIZE, attr->type, val)
>
>  #define PRINT_ATTRn(_n, _f, _p, _a)                    \
>  do {                                                   \
> @@ -130,7 +266,7 @@ int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
>
>         PRINT_ATTRn("type", type, p_type_id, true);
>         PRINT_ATTRf(size, p_unsigned);
> -       PRINT_ATTRf(config, p_hex);
> +       PRINT_ATTRn("config", config, p_config_id, true);
>         PRINT_ATTRn("{ sample_period, sample_freq }", sample_period, p_unsigned, false);
>         PRINT_ATTRf(sample_type, p_sample_type);
>         PRINT_ATTRf(read_format, p_read_format);
> --
> 2.30.GIT
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ