From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
"acme@kernel.org" <acme@kernel.org>,
"jolsa@kernel.org" <jolsa@kernel.org>,
"adrian.hunter@intel.com" <adrian.hunter@intel.com>,
"irogers@google.com" <irogers@google.com>,
"namhyung@kernel.org" <namhyung@kernel.org>
Cc: "linux-perf-users@vger.kernel.org"
<linux-perf-users@vger.kernel.org>,
"kjain@linux.ibm.com" <kjain@linux.ibm.com>,
"maddy@linux.ibm.com" <maddy@linux.ibm.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"disgoel@linux.vnet.ibm.com" <disgoel@linux.vnet.ibm.com>
Subject: Re: [PATCH 1/3] tools/perf/arch/powerpc: Add load/store in powerpc annotate instructions for data type profling
Date: Sat, 9 Mar 2024 09:48:21 +0000 [thread overview]
Message-ID: <821ddf3c-d383-4b79-a7cb-b67034f56f10@csgroup.eu> (raw)
In-Reply-To: <20240309072513.9418-2-atrajeev@linux.vnet.ibm.com>
Le 09/03/2024 à 08:25, Athira Rajeev a écrit :
> Add powerpc instruction nmemonic table to associate load/store
> instructions with move_ops. mov_ops is used to identify mem_type
> to associate instruction with data type and offset. Also initialize
> and allocate arch specific fields for nr_instructions, instructions and
> nr_instructions_allocate.
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> .../perf/arch/powerpc/annotate/instructions.c | 66 +++++++++++++++++++
> 1 file changed, 66 insertions(+)
>
> diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c
> index a3f423c27cae..07af4442be38 100644
> --- a/tools/perf/arch/powerpc/annotate/instructions.c
> +++ b/tools/perf/arch/powerpc/annotate/instructions.c
> @@ -1,6 +1,65 @@
> // SPDX-License-Identifier: GPL-2.0
> #include <linux/compiler.h>
>
> +/*
> + * powerpc instruction nmemonic table to associate load/store instructions with
> + * move_ops. mov_ops is used to identify mem_type to associate instruction with
> + * data type and offset.
> + */
> +static struct ins powerpc__instructions[] = {
> + { .name = "lbz", .ops = &mov_ops, },
> + { .name = "lbzx", .ops = &mov_ops, },
> + { .name = "lbzu", .ops = &mov_ops, },
> + { .name = "lbzux", .ops = &mov_ops, },
> + { .name = "lhz", .ops = &mov_ops, },
> + { .name = "lhzx", .ops = &mov_ops, },
> + { .name = "lhzu", .ops = &mov_ops, },
> + { .name = "lhzux", .ops = &mov_ops, },
> + { .name = "lha", .ops = &mov_ops, },
> + { .name = "lhax", .ops = &mov_ops, },
> + { .name = "lhau", .ops = &mov_ops, },
> + { .name = "lhaux", .ops = &mov_ops, },
> + { .name = "lwz", .ops = &mov_ops, },
> + { .name = "lwzx", .ops = &mov_ops, },
> + { .name = "lwzu", .ops = &mov_ops, },
> + { .name = "lwzux", .ops = &mov_ops, },
> + { .name = "lwa", .ops = &mov_ops, },
> + { .name = "lwax", .ops = &mov_ops, },
> + { .name = "lwaux", .ops = &mov_ops, },
> + { .name = "ld", .ops = &mov_ops, },
> + { .name = "ldx", .ops = &mov_ops, },
> + { .name = "ldu", .ops = &mov_ops, },
> + { .name = "ldux", .ops = &mov_ops, },
> + { .name = "stb", .ops = &mov_ops, },
> + { .name = "stbx", .ops = &mov_ops, },
> + { .name = "stbu", .ops = &mov_ops, },
> + { .name = "stbux", .ops = &mov_ops, },
> + { .name = "sth", .ops = &mov_ops, },
> + { .name = "sthx", .ops = &mov_ops, },
> + { .name = "sthu", .ops = &mov_ops, },
> + { .name = "sthux", .ops = &mov_ops, },
> + { .name = "stw", .ops = &mov_ops, },
> + { .name = "stwx", .ops = &mov_ops, },
> + { .name = "stwu", .ops = &mov_ops, },
> + { .name = "stwux", .ops = &mov_ops, },
> + { .name = "std", .ops = &mov_ops, },
> + { .name = "stdx", .ops = &mov_ops, },
> + { .name = "stdu", .ops = &mov_ops, },
> + { .name = "stdux", .ops = &mov_ops, },
> + { .name = "lhbrx", .ops = &mov_ops, },
> + { .name = "sthbrx", .ops = &mov_ops, },
> + { .name = "lwbrx", .ops = &mov_ops, },
> + { .name = "stwbrx", .ops = &mov_ops, },
> + { .name = "ldbrx", .ops = &mov_ops, },
> + { .name = "stdbrx", .ops = &mov_ops, },
> + { .name = "lmw", .ops = &mov_ops, },
> + { .name = "stmw", .ops = &mov_ops, },
> + { .name = "lswi", .ops = &mov_ops, },
> + { .name = "lswx", .ops = &mov_ops, },
> + { .name = "stswi", .ops = &mov_ops, },
> + { .name = "stswx", .ops = &mov_ops, },
> +};
What about lwarx and stwcx ?
> +
> static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, const char *name)
> {
> int i;
> @@ -52,6 +111,13 @@ static struct ins_ops *powerpc__associate_instruction_ops(struct arch *arch, con
> static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
> {
> if (!arch->initialized) {
> + arch->nr_instructions = ARRAY_SIZE(powerpc__instructions);
> + arch->instructions = calloc(arch->nr_instructions, sizeof(struct ins));
> + if (arch->instructions == NULL)
Prefered form is
if (!arch->instructions)
> + return -ENOMEM;
> +
> + memcpy(arch->instructions, (struct ins *)powerpc__instructions, sizeof(struct ins) * arch->nr_instructions);
No need to cast powerpc__instructions, it is already a pointer.
> + arch->nr_instructions_allocated = arch->nr_instructions;
> arch->initialized = true;
> arch->associate_instruction_ops = powerpc__associate_instruction_ops;
> arch->objdump.comment_char = '#';
next prev parent reply other threads:[~2024-03-09 9:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-09 7:25 [PATCH 0/3] Add data type profiling support for powerpc Athira Rajeev
2024-03-09 7:25 ` [PATCH 1/3] tools/perf/arch/powerpc: Add load/store in powerpc annotate instructions for data type profling Athira Rajeev
2024-03-09 9:48 ` Christophe Leroy [this message]
2024-03-18 11:01 ` Athira Rajeev
2024-03-09 7:25 ` [PATCH 2/3] tools/erf/util/annotate: Set register_char and memory_ref_char for powerpc Athira Rajeev
2024-03-09 17:43 ` Segher Boessenkool
2024-03-18 11:33 ` Athira Rajeev
2024-03-09 7:25 ` [PATCH 3/3] tools/perf/arch/powerc: Add get_arch_regnum " Athira Rajeev
2024-03-09 9:54 ` Christophe Leroy
2024-03-18 11:00 ` Athira Rajeev
2024-03-26 9:35 ` Tiezhu Yang
2024-04-01 21:46 ` Namhyung Kim
2024-04-01 21:57 ` [PATCH 0/3] Add data type profiling support " Namhyung Kim
-- strict thread matches above, loose matches on Subject: below --
2024-03-09 5:51 Athira Rajeev
2024-03-09 5:51 ` [PATCH 1/3] tools/perf/arch/powerpc: Add load/store in powerpc annotate instructions for data type profling Athira Rajeev
2024-03-09 7:18 ` Athira Rajeev
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=821ddf3c-d383-4b79-a7cb-b67034f56f10@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=namhyung@kernel.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).