linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: arm64: Fix compilation error
@ 2025-02-14 11:10 Leo Yan
  2025-02-14 11:21 ` James Clark
  2025-02-14 21:23 ` Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Yan @ 2025-02-14 11:10 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, John Garry,
	Will Deacon, James Clark, Mike Leach, Jiri Olsa, Adrian Hunter,
	Liang, Kan, linux-arm-kernel, linux-perf-users, linux-kernel
  Cc: Leo Yan

Since the commit dc6d2bc2d893 ("perf sample: Make user_regs and
intr_regs optional"), the building for Arm64 reports error:

arch/arm64/util/unwind-libdw.c: In function ‘libdw__arch_set_initial_registers’:
arch/arm64/util/unwind-libdw.c:11:32: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
   11 |  struct regs_dump *user_regs = &ui->sample->user_regs;
      |                                ^
cc1: all warnings being treated as errors
make[6]: *** [/home/niayan01/linux/tools/build/Makefile.build:85: arch/arm64/util/unwind-libdw.o] Error 1
make[5]: *** [/home/niayan01/linux/tools/build/Makefile.build:138: util] Error 2
arch/arm64/tests/dwarf-unwind.c: In function ‘test__arch_unwind_sample’:
arch/arm64/tests/dwarf-unwind.c:48:27: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
   48 |  struct regs_dump *regs = &sample->user_regs;
      |                           ^

To fix the issue, use the helper perf_sample__user_regs() to retrieve
the user_regs.

Fixes: dc6d2bc2d893 ("perf sample: Make user_regs and intr_regs optional")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/arch/arm64/tests/dwarf-unwind.c | 2 +-
 tools/perf/arch/arm64/util/unwind-libdw.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c
index b2603d0d3737..440d00f0de14 100644
--- a/tools/perf/arch/arm64/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c
@@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,
 int test__arch_unwind_sample(struct perf_sample *sample,
 		struct thread *thread)
 {
-	struct regs_dump *regs = &sample->user_regs;
+	struct regs_dump *regs = perf_sample__user_regs(sample);
 	u64 *buf;
 
 	buf = calloc(1, sizeof(u64) * PERF_REGS_MAX);
diff --git a/tools/perf/arch/arm64/util/unwind-libdw.c b/tools/perf/arch/arm64/util/unwind-libdw.c
index e056d50ab42e..b89b0a7e5ad9 100644
--- a/tools/perf/arch/arm64/util/unwind-libdw.c
+++ b/tools/perf/arch/arm64/util/unwind-libdw.c
@@ -8,7 +8,7 @@
 bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg)
 {
 	struct unwind_info *ui = arg;
-	struct regs_dump *user_regs = &ui->sample->user_regs;
+	struct regs_dump *user_regs = perf_sample__user_regs(ui->sample);
 	Dwarf_Word dwarf_regs[PERF_REG_ARM64_MAX], dwarf_pc;
 
 #define REG(r) ({						\
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf: arm64: Fix compilation error
  2025-02-14 11:10 [PATCH] perf: arm64: Fix compilation error Leo Yan
@ 2025-02-14 11:21 ` James Clark
  2025-02-14 18:45   ` Namhyung Kim
  2025-02-14 21:23 ` Namhyung Kim
  1 sibling, 1 reply; 4+ messages in thread
From: James Clark @ 2025-02-14 11:21 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, John Garry,
	Will Deacon, Mike Leach, Jiri Olsa, Adrian Hunter, Liang, Kan,
	linux-arm-kernel, linux-perf-users, linux-kernel



On 14/02/2025 11:10 am, Leo Yan wrote:
> Since the commit dc6d2bc2d893 ("perf sample: Make user_regs and
> intr_regs optional"), the building for Arm64 reports error:
> 
> arch/arm64/util/unwind-libdw.c: In function ‘libdw__arch_set_initial_registers’:
> arch/arm64/util/unwind-libdw.c:11:32: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
>     11 |  struct regs_dump *user_regs = &ui->sample->user_regs;
>        |                                ^
> cc1: all warnings being treated as errors
> make[6]: *** [/home/niayan01/linux/tools/build/Makefile.build:85: arch/arm64/util/unwind-libdw.o] Error 1
> make[5]: *** [/home/niayan01/linux/tools/build/Makefile.build:138: util] Error 2
> arch/arm64/tests/dwarf-unwind.c: In function ‘test__arch_unwind_sample’:
> arch/arm64/tests/dwarf-unwind.c:48:27: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
>     48 |  struct regs_dump *regs = &sample->user_regs;
>        |                           ^
> 
> To fix the issue, use the helper perf_sample__user_regs() to retrieve
> the user_regs.
> 
> Fixes: dc6d2bc2d893 ("perf sample: Make user_regs and intr_regs optional")
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
>   tools/perf/arch/arm64/tests/dwarf-unwind.c | 2 +-
>   tools/perf/arch/arm64/util/unwind-libdw.c  | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c
> index b2603d0d3737..440d00f0de14 100644
> --- a/tools/perf/arch/arm64/tests/dwarf-unwind.c
> +++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c
> @@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,
>   int test__arch_unwind_sample(struct perf_sample *sample,
>   		struct thread *thread)
>   {
> -	struct regs_dump *regs = &sample->user_regs;
> +	struct regs_dump *regs = perf_sample__user_regs(sample);
>   	u64 *buf;
>   
>   	buf = calloc(1, sizeof(u64) * PERF_REGS_MAX);
> diff --git a/tools/perf/arch/arm64/util/unwind-libdw.c b/tools/perf/arch/arm64/util/unwind-libdw.c
> index e056d50ab42e..b89b0a7e5ad9 100644
> --- a/tools/perf/arch/arm64/util/unwind-libdw.c
> +++ b/tools/perf/arch/arm64/util/unwind-libdw.c
> @@ -8,7 +8,7 @@
>   bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg)
>   {
>   	struct unwind_info *ui = arg;
> -	struct regs_dump *user_regs = &ui->sample->user_regs;
> +	struct regs_dump *user_regs = perf_sample__user_regs(ui->sample);
>   	Dwarf_Word dwarf_regs[PERF_REG_ARM64_MAX], dwarf_pc;
>   
>   #define REG(r) ({						\

Reviewed-by: James Clark <james.clark@linaro.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf: arm64: Fix compilation error
  2025-02-14 11:21 ` James Clark
@ 2025-02-14 18:45   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2025-02-14 18:45 UTC (permalink / raw)
  To: James Clark
  Cc: Leo Yan, Arnaldo Carvalho de Melo, Ian Rogers, John Garry,
	Will Deacon, Mike Leach, Jiri Olsa, Adrian Hunter, Liang, Kan,
	linux-arm-kernel, linux-perf-users, linux-kernel

On Fri, Feb 14, 2025 at 11:21:52AM +0000, James Clark wrote:
> 
> 
> On 14/02/2025 11:10 am, Leo Yan wrote:
> > Since the commit dc6d2bc2d893 ("perf sample: Make user_regs and
> > intr_regs optional"), the building for Arm64 reports error:
> > 
> > arch/arm64/util/unwind-libdw.c: In function ‘libdw__arch_set_initial_registers’:
> > arch/arm64/util/unwind-libdw.c:11:32: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
> >     11 |  struct regs_dump *user_regs = &ui->sample->user_regs;
> >        |                                ^
> > cc1: all warnings being treated as errors
> > make[6]: *** [/home/niayan01/linux/tools/build/Makefile.build:85: arch/arm64/util/unwind-libdw.o] Error 1
> > make[5]: *** [/home/niayan01/linux/tools/build/Makefile.build:138: util] Error 2
> > arch/arm64/tests/dwarf-unwind.c: In function ‘test__arch_unwind_sample’:
> > arch/arm64/tests/dwarf-unwind.c:48:27: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
> >     48 |  struct regs_dump *regs = &sample->user_regs;
> >        |                           ^
> > 
> > To fix the issue, use the helper perf_sample__user_regs() to retrieve
> > the user_regs.
> > 
> > Fixes: dc6d2bc2d893 ("perf sample: Make user_regs and intr_regs optional")
> > Signed-off-by: Leo Yan <leo.yan@arm.com>

Thanks for the fix, I'll handle other archs too
Namhyung


> > ---
> >   tools/perf/arch/arm64/tests/dwarf-unwind.c | 2 +-
> >   tools/perf/arch/arm64/util/unwind-libdw.c  | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c
> > index b2603d0d3737..440d00f0de14 100644
> > --- a/tools/perf/arch/arm64/tests/dwarf-unwind.c
> > +++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c
> > @@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,
> >   int test__arch_unwind_sample(struct perf_sample *sample,
> >   		struct thread *thread)
> >   {
> > -	struct regs_dump *regs = &sample->user_regs;
> > +	struct regs_dump *regs = perf_sample__user_regs(sample);
> >   	u64 *buf;
> >   	buf = calloc(1, sizeof(u64) * PERF_REGS_MAX);
> > diff --git a/tools/perf/arch/arm64/util/unwind-libdw.c b/tools/perf/arch/arm64/util/unwind-libdw.c
> > index e056d50ab42e..b89b0a7e5ad9 100644
> > --- a/tools/perf/arch/arm64/util/unwind-libdw.c
> > +++ b/tools/perf/arch/arm64/util/unwind-libdw.c
> > @@ -8,7 +8,7 @@
> >   bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg)
> >   {
> >   	struct unwind_info *ui = arg;
> > -	struct regs_dump *user_regs = &ui->sample->user_regs;
> > +	struct regs_dump *user_regs = perf_sample__user_regs(ui->sample);
> >   	Dwarf_Word dwarf_regs[PERF_REG_ARM64_MAX], dwarf_pc;
> >   #define REG(r) ({						\
> 
> Reviewed-by: James Clark <james.clark@linaro.org>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf: arm64: Fix compilation error
  2025-02-14 11:10 [PATCH] perf: arm64: Fix compilation error Leo Yan
  2025-02-14 11:21 ` James Clark
@ 2025-02-14 21:23 ` Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2025-02-14 21:23 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, John Garry, Will Deacon,
	James Clark, Mike Leach, Jiri Olsa, Adrian Hunter, Liang, Kan,
	linux-arm-kernel, linux-perf-users, linux-kernel, Leo Yan

On Fri, 14 Feb 2025 11:10:25 +0000, Leo Yan wrote:
> Since the commit dc6d2bc2d893 ("perf sample: Make user_regs and
> intr_regs optional"), the building for Arm64 reports error:
> 
> arch/arm64/util/unwind-libdw.c: In function ‘libdw__arch_set_initial_registers’:
> arch/arm64/util/unwind-libdw.c:11:32: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
>    11 |  struct regs_dump *user_regs = &ui->sample->user_regs;
>       |                                ^
> cc1: all warnings being treated as errors
> make[6]: *** [/home/niayan01/linux/tools/build/Makefile.build:85: arch/arm64/util/unwind-libdw.o] Error 1
> make[5]: *** [/home/niayan01/linux/tools/build/Makefile.build:138: util] Error 2
> arch/arm64/tests/dwarf-unwind.c: In function ‘test__arch_unwind_sample’:
> arch/arm64/tests/dwarf-unwind.c:48:27: error: initialization of ‘struct regs_dump *’ from incompatible pointer type ‘struct regs_dump **’ [-Werror=incompatible-pointer-types]
>    48 |  struct regs_dump *regs = &sample->user_regs;
>       |                           ^
> 
> [...]
Applied to perf-tools-next, thanks!

Best regards,
Namhyung




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-14 21:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-14 11:10 [PATCH] perf: arm64: Fix compilation error Leo Yan
2025-02-14 11:21 ` James Clark
2025-02-14 18:45   ` Namhyung Kim
2025-02-14 21:23 ` Namhyung Kim

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).