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]
Message-ID: <c78b2533-6960-99c9-543a-965d669d1ece@arm.com>
Date:   Fri, 3 Dec 2021 09:38:43 +0000
From:   German Gomez <german.gomez@....com>
To:     linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        acme@...nel.org
Cc:     John Garry <john.garry@...wei.com>, Will Deacon <will@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-csky@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v1 4/4] perf tools: Support register names from all
 architectures


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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ