lkml.org 
[lkml]   [2021]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v1 4/4] perf tools: Support register names from all architectures
From
Date

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.

\
 
 \ /
  Last update: 2021-12-03 10:39    [W:0.117 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site