From: Jiri Olsa <jolsa@redhat.com>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
mingo@redhat.com, alexander.shishkin@linux.intel.com,
Linux-kernel@vger.kernel.org, ak@linux.intel.com,
kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v3 2/2] perf header: Support HYBRID_CPU_PMU_CAPS feature
Date: Fri, 14 May 2021 10:16:18 +0200 [thread overview]
Message-ID: <YJ4x0usa1ljPT5DV@krava> (raw)
In-Reply-To: <20210511053003.27015-3-yao.jin@linux.intel.com>
On Tue, May 11, 2021 at 01:30:03PM +0800, Jin Yao wrote:
SNIP
> diff --git a/tools/perf/Documentation/perf.data-file-format.txt b/tools/perf/Documentation/perf.data-file-format.txt
> index fbee9e580ee4..e6ff8c898ada 100644
> --- a/tools/perf/Documentation/perf.data-file-format.txt
> +++ b/tools/perf/Documentation/perf.data-file-format.txt
> @@ -419,6 +419,22 @@ Example:
> cpu_core cpu list : 0-15
> cpu_atom cpu list : 16-23
>
> + HEADER_HYBRID_CPU_PMU_CAPS = 31,
> +
> + A list of hybrid CPU PMU capabilities.
> +
> +struct {
> + u32 nr_pmu;
> + struct {
> + u32 nr_cpu_pmu_caps;
> + {
> + char name[];
> + char value[];
> + } [nr_cpu_pmu_caps];
> + char pmu_name[];
> + } [nr_pmu];
> +};
when I saw it's similar to the previous one I thought we could have
one big hybrid feature.. but that would be probably more complex and
we might not be able to reuse the code as much as you did
> free_value:
> @@ -3142,6 +3208,64 @@ static int process_cpu_pmu_caps(struct feat_fd *ff,
> return -1;
> }
>
> +static int process_cpu_pmu_caps(struct feat_fd *ff,
> + void *data __maybe_unused)
> +{
> + int ret;
> +
> + ret = process_per_cpu_pmu_caps(ff, &ff->ph->env.nr_cpu_pmu_caps,
> + &ff->ph->env.cpu_pmu_caps,
> + &ff->ph->env.max_branches);
> + return ret;
why the 'ret' var? could be just:
return process_per_cpu_pmu_caps(...
> +}
> +
> +static int process_hybrid_cpu_pmu_caps(struct feat_fd *ff,
> + void *data __maybe_unused)
> +{
> + struct hybrid_cpc_node *nodes;
> + u32 nr_pmu, i;
> + int ret;
> +
> + if (do_read_u32(ff, &nr_pmu))
> + return -1;
> +
> + if (!nr_pmu) {
> + pr_debug("hybrid cpu pmu capabilities not available\n");
> + return 0;
> + }
> +
> + nodes = zalloc(sizeof(*nodes) * nr_pmu);
> + if (!nodes)
> + return -ENOMEM;
> +
> + for (i = 0; i < nr_pmu; i++) {
> + struct hybrid_cpc_node *n = &nodes[i];
> +
> + ret = process_per_cpu_pmu_caps(ff, &n->nr_cpu_pmu_caps,
> + &n->cpu_pmu_caps,
> + &n->max_branches);
> + if (ret)
> + goto err;
> +
> + n->pmu_name = do_read_string(ff);
> + if (!n->pmu_name)
should you set 'ret = -1' in here?
other than this both patches look good to me
thanks,
jirka
> + goto err;
> + }
> +
> + ff->ph->env.nr_hybrid_cpc_nodes = nr_pmu;
> + ff->ph->env.hybrid_cpc_nodes = nodes;
> + return 0;
> +
> +err:
> + for (i = 0; i < nr_pmu; i++) {
> + free(nodes[i].cpu_pmu_caps);
SNIP
next prev parent reply other threads:[~2021-05-14 8:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-11 5:30 [PATCH v3 0/2] perf header: Support HYBRID_TOPOLOGY and HYBRID_CPU_PMU_CAPS Jin Yao
2021-05-11 5:30 ` [PATCH v3 1/2] perf header: Support HYBRID_TOPOLOGY feature Jin Yao
2021-05-11 5:30 ` [PATCH v3 2/2] perf header: Support HYBRID_CPU_PMU_CAPS feature Jin Yao
2021-05-14 8:16 ` Jiri Olsa [this message]
2021-05-14 8:25 ` Jin, Yao
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=YJ4x0usa1ljPT5DV@krava \
--to=jolsa@redhat.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
--cc=yao.jin@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.