Linux-csky Archive mirror
 help / color / mirror / Atom feed
From: German Gomez <german.gomez@arm.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org
Cc: John Garry <john.garry@huawei.com>, Will Deacon <will@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Leo Yan <leo.yan@linaro.org>, Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v1 4/4] perf tools: Support register names from all architectures
Date: Fri, 3 Dec 2021 09:38:43 +0000	[thread overview]
Message-ID: <c78b2533-6960-99c9-543a-965d669d1ece@arm.com> (raw)
In-Reply-To: <20211201123334.679131-5-german.gomez@arm.com>


On 01/12/2021 12:33, German Gomez wrote:
> [...]
>
> diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
> index eeac181eb..a201181fc 100644
> --- a/tools/perf/util/perf_regs.h
> +++ b/tools/perf/util/perf_regs.h
> @@ -27,15 +27,42 @@ uint64_t arch__user_reg_mask(void);
>  #ifdef HAVE_PERF_REGS_SUPPORT
>  extern const struct sample_reg sample_reg_masks[];
>  
> +#include <string.h>
>  #include <perf_regs.h>
>  
>  #define DWARF_MINIMAL_REGS ((1ULL << PERF_REG_IP) | (1ULL << PERF_REG_SP))
>  
>  int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
>  
> -static inline const char *perf_reg_name(int id)
> +#include "perf_regs_csky.h"
> +#include "perf_regs_mips.h"
> +#include "perf_regs_powerpc.h"
> +#include "perf_regs_riscv.h"
> +#include "perf_regs_s390.h"
> +#include "perf_regs_x86.h"
> +#include "perf_regs_arm.h"
> +#include "perf_regs_arm64.h"

Something that slipped through: this is failing to compile perf on ARM32
due to the order of the imports:

util/../../arch/arm64/include/uapi/asm/perf_regs.h:5:6: error: nested redefinition of ‘enum perf_event_arm_regs’
    5 | enum perf_event_arm_regs {
      |      ^~~~~~~~~~~~~~~~~~~

Both #import <perf_regs.h> and "perf_regs_arm.h" are importing the same
header (/tools/arch/arm/include/uapi/asm/perf_regs.h) so this part of
the [PATCH 3/4] isn't doing anything:

diff --git a/tools/perf/util/perf_regs_arm.h b/tools/perf/util/perf_regs_arm.h
new file mode 100644
index 000000000..779b40d6c
--- /dev/null
+++ b/tools/perf/util/perf_regs_arm.h
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __PERF_REGS_ARM_H
+#define __PERF_REGS_ARM_H
+
+/*
+ * ARM and ARM64 registers are grouped under enums of the same name.
+ * Temporarily rename the name of the enum to prevent the naming collision.
+ */
+#define perf_event_arm_regs perf_event_arm_regs_workaround
+
+#include "../../arch/arm/include/uapi/asm/perf_regs.h"

There is a similar workaround in the csky version. Although it should
compile, I think some of the register names might be missing (the ones
under #if defined(__CSKYABIV2__)).

I'm wondering if it would be wiser to update this changeset to only
consider a small number of platforms (maybe x86 and arm64) and see how
it goes.


      reply	other threads:[~2021-12-03  9:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 12:33 [PATCH v1 0/4] Support register names from all architectures German Gomez
2021-12-01 12:33 ` [PATCH v1 1/4] perf tools: Prevent out-of-bounds access to registers German Gomez
2021-12-08 21:35   ` Jiri Olsa
2021-12-10  9:17   ` kajoljain
2021-12-10 13:38     ` Arnaldo Carvalho de Melo
2021-12-10 15:28       ` German Gomez
2021-12-10 16:19         ` Arnaldo Carvalho de Melo
2021-12-01 12:33 ` [PATCH v1 2/4] perf script: Add "struct machine" parameter to process_event callback German Gomez
2021-12-02 16:03   ` Athira Rajeev
2021-12-03 12:00     ` German Gomez
2021-12-13 18:22       ` Arnaldo Carvalho de Melo
2021-12-13 18:31         ` German Gomez
2021-12-13 19:59           ` Arnaldo Carvalho de Melo
2021-12-01 12:33 ` [PATCH v1 3/4] perf tools: Crete header files with register names German Gomez
2021-12-01 12:33 ` [PATCH v1 4/4] perf tools: Support register names from all architectures German Gomez
2021-12-03  9:38   ` German Gomez [this message]

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=c78b2533-6960-99c9-543a-965d669d1ece@arm.com \
    --to=german.gomez@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=namhyung@kernel.org \
    --cc=will@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 read-only IMAP folder(s) and NNTP newsgroup(s).