* [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-26 0:26 ` Namhyung Kim
2024-09-29 2:01 ` Masami Hiramatsu
2024-09-24 16:04 ` [PATCH v1 02/11] perf build: Remove defined but never used variable Ian Rogers
` (10 subsequent siblings)
11 siblings, 2 replies; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
NO_DWARF could mean more than NO_LIBDW support, in particular no
libunwind support. Rename to be more intention revealing.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Makefile.config | 16 ++++++++--------
tools/perf/Makefile.perf | 2 +-
tools/perf/arch/arm/Makefile | 2 +-
tools/perf/arch/arm64/Makefile | 2 +-
tools/perf/arch/csky/Makefile | 2 +-
tools/perf/arch/loongarch/Makefile | 2 +-
tools/perf/arch/mips/Makefile | 2 +-
tools/perf/arch/powerpc/Makefile | 2 +-
tools/perf/arch/riscv/Makefile | 2 +-
tools/perf/arch/s390/Makefile | 2 +-
tools/perf/arch/sh/Makefile | 2 +-
tools/perf/arch/sparc/Makefile | 2 +-
tools/perf/arch/x86/Makefile | 2 +-
tools/perf/arch/xtensa/Makefile | 2 +-
tools/perf/builtin-probe.c | 2 +-
15 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 5e26d3a91b36..55a39211496d 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1)
endif
ifdef NO_LIBELF
- NO_DWARF := 1
+ NO_LIBDW := 1
NO_LIBUNWIND := 1
NO_LIBDW_DWARF_UNWIND := 1
NO_LIBBPF := 1
@@ -471,9 +471,9 @@ else
endif
endif
ifneq ($(feature-dwarf), 1)
- ifndef NO_DWARF
+ ifndef NO_LIBDW
$(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
- NO_DWARF := 1
+ NO_LIBDW := 1
endif
else
ifneq ($(feature-dwarf_getlocations), 1)
@@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1)
endif
endif
-ifdef NO_DWARF
+ifdef NO_LIBDW
NO_LIBDW_DWARF_UNWIND := 1
endif
@@ -574,17 +574,17 @@ ifndef NO_LIBELF
endif
endif
- ifndef NO_DWARF
+ ifndef NO_LIBDW
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
$(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
- NO_DWARF := 1
+ NO_LIBDW := 1
else
CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += ${DWARFLIBS}
$(call detected,CONFIG_DWARF)
endif # PERF_HAVE_DWARF_REGS
- endif # NO_DWARF
+ endif # NO_LIBDW
ifndef NO_LIBBPF
ifeq ($(feature-bpf), 1)
@@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP
endif
ifeq ($(SRCARCH),powerpc)
- ifndef NO_DWARF
+ ifndef NO_LIBDW
CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
endif
endif
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9dd2e8d3f3c9..a144bfaf8aeb 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -40,7 +40,7 @@ include ../scripts/utilities.mak
#
# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
#
-# Define NO_DWARF if you do not want debug-info analysis feature at all.
+# Define NO_LIBDW if you do not want debug-info analysis feature at all.
#
# Define WERROR=0 to disable treating any warnings as errors.
#
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
index 1d88fdab13bf..9b164d379548 100644
--- a/tools/perf/arch/arm/Makefile
+++ b/tools/perf/arch/arm/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
index 5735ed4479bb..8a5ffbfe809f 100644
--- a/tools/perf/arch/arm64/Makefile
+++ b/tools/perf/arch/arm64/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile
index 88c08eed9c7b..119b06a64bed 100644
--- a/tools/perf/arch/csky/Makefile
+++ b/tools/perf/arch/csky/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile
index c89d6bb6b184..1cc5eb01f32b 100644
--- a/tools/perf/arch/loongarch/Makefile
+++ b/tools/perf/arch/loongarch/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
index cd0b011b3be5..733f7b76f52d 100644
--- a/tools/perf/arch/mips/Makefile
+++ b/tools/perf/arch/mips/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index bf6d323574f6..7672d555f6cd 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile
index 90c3c476a242..4664a78a1afd 100644
--- a/tools/perf/arch/riscv/Makefile
+++ b/tools/perf/arch/riscv/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 56994e63b43a..3f66e2ede3f7 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
index 88c08eed9c7b..119b06a64bed 100644
--- a/tools/perf/arch/sh/Makefile
+++ b/tools/perf/arch/sh/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
index 4031db72ba71..7741184894c8 100644
--- a/tools/perf/arch/sparc/Makefile
+++ b/tools/perf/arch/sparc/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 67b4969a6738..9aa58acb5564 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makefile
index 88c08eed9c7b..119b06a64bed 100644
--- a/tools/perf/arch/xtensa/Makefile
+++ b/tools/perf/arch/xtensa/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
-ifndef NO_DWARF
+ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 003a3bcebfdf..91672bb3047c 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -616,7 +616,7 @@ __cmd_probe(int argc, const char **argv)
set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE);
set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE);
#else
-# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_DWARF=1", c)
+# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_LIBDW=1", c)
set_nobuild('L', "line", false);
set_nobuild('V', "vars", false);
set_nobuild('\0', "externs", false);
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW
2024-09-24 16:04 ` [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW Ian Rogers
@ 2024-09-26 0:26 ` Namhyung Kim
2024-09-26 15:02 ` Ian Rogers
2024-09-29 2:01 ` Masami Hiramatsu
1 sibling, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 0:26 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Sep 24, 2024 at 09:04:08AM -0700, Ian Rogers wrote:
> NO_DWARF could mean more than NO_LIBDW support, in particular no
> libunwind support. Rename to be more intention revealing.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/Makefile.config | 16 ++++++++--------
> tools/perf/Makefile.perf | 2 +-
> tools/perf/arch/arm/Makefile | 2 +-
> tools/perf/arch/arm64/Makefile | 2 +-
> tools/perf/arch/csky/Makefile | 2 +-
> tools/perf/arch/loongarch/Makefile | 2 +-
> tools/perf/arch/mips/Makefile | 2 +-
> tools/perf/arch/powerpc/Makefile | 2 +-
> tools/perf/arch/riscv/Makefile | 2 +-
> tools/perf/arch/s390/Makefile | 2 +-
> tools/perf/arch/sh/Makefile | 2 +-
> tools/perf/arch/sparc/Makefile | 2 +-
> tools/perf/arch/x86/Makefile | 2 +-
> tools/perf/arch/xtensa/Makefile | 2 +-
> tools/perf/builtin-probe.c | 2 +-
> 15 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 5e26d3a91b36..55a39211496d 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1)
> endif
>
> ifdef NO_LIBELF
> - NO_DWARF := 1
> + NO_LIBDW := 1
> NO_LIBUNWIND := 1
> NO_LIBDW_DWARF_UNWIND := 1
> NO_LIBBPF := 1
> @@ -471,9 +471,9 @@ else
> endif
> endif
> ifneq ($(feature-dwarf), 1)
> - ifndef NO_DWARF
> + ifndef NO_LIBDW
> $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> - NO_DWARF := 1
> + NO_LIBDW := 1
> endif
> else
> ifneq ($(feature-dwarf_getlocations), 1)
> @@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1)
> endif
> endif
>
> -ifdef NO_DWARF
> +ifdef NO_LIBDW
> NO_LIBDW_DWARF_UNWIND := 1
> endif
>
> @@ -574,17 +574,17 @@ ifndef NO_LIBELF
> endif
> endif
>
> - ifndef NO_DWARF
> + ifndef NO_LIBDW
> ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
> - NO_DWARF := 1
> + NO_LIBDW := 1
> else
> CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
> LDFLAGS += $(LIBDW_LDFLAGS)
> EXTLIBS += ${DWARFLIBS}
> $(call detected,CONFIG_DWARF)
> endif # PERF_HAVE_DWARF_REGS
> - endif # NO_DWARF
> + endif # NO_LIBDW
>
> ifndef NO_LIBBPF
> ifeq ($(feature-bpf), 1)
> @@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP
> endif
>
> ifeq ($(SRCARCH),powerpc)
> - ifndef NO_DWARF
> + ifndef NO_LIBDW
> CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
> endif
> endif
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 9dd2e8d3f3c9..a144bfaf8aeb 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -40,7 +40,7 @@ include ../scripts/utilities.mak
> #
> # Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
> #
> -# Define NO_DWARF if you do not want debug-info analysis feature at all.
> +# Define NO_LIBDW if you do not want debug-info analysis feature at all.
Can we keep NO_DWARF for compatibility and set NO_LIBDW=1 internally?
I think it's fine to change it here to advertise NO_LIBDW over NO_DWARF
but still want to support NO_DWARF as well.
Also it seem we don't have an entry in the tests/make for no-dwarf
build. Can you please add one too?
Thanks,
Namhyung
> #
> # Define WERROR=0 to disable treating any warnings as errors.
> #
> diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
> index 1d88fdab13bf..9b164d379548 100644
> --- a/tools/perf/arch/arm/Makefile
> +++ b/tools/perf/arch/arm/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_JITDUMP := 1
> diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
> index 5735ed4479bb..8a5ffbfe809f 100644
> --- a/tools/perf/arch/arm64/Makefile
> +++ b/tools/perf/arch/arm64/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_JITDUMP := 1
> diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile
> index 88c08eed9c7b..119b06a64bed 100644
> --- a/tools/perf/arch/csky/Makefile
> +++ b/tools/perf/arch/csky/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile
> index c89d6bb6b184..1cc5eb01f32b 100644
> --- a/tools/perf/arch/loongarch/Makefile
> +++ b/tools/perf/arch/loongarch/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
> index cd0b011b3be5..733f7b76f52d 100644
> --- a/tools/perf/arch/mips/Makefile
> +++ b/tools/perf/arch/mips/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
>
> diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
> index bf6d323574f6..7672d555f6cd 100644
> --- a/tools/perf/arch/powerpc/Makefile
> +++ b/tools/perf/arch/powerpc/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
>
> diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile
> index 90c3c476a242..4664a78a1afd 100644
> --- a/tools/perf/arch/riscv/Makefile
> +++ b/tools/perf/arch/riscv/Makefile
> @@ -1,4 +1,4 @@
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
> index 56994e63b43a..3f66e2ede3f7 100644
> --- a/tools/perf/arch/s390/Makefile
> +++ b/tools/perf/arch/s390/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> HAVE_KVM_STAT_SUPPORT := 1
> diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
> index 88c08eed9c7b..119b06a64bed 100644
> --- a/tools/perf/arch/sh/Makefile
> +++ b/tools/perf/arch/sh/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
> index 4031db72ba71..7741184894c8 100644
> --- a/tools/perf/arch/sparc/Makefile
> +++ b/tools/perf/arch/sparc/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
>
> diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
> index 67b4969a6738..9aa58acb5564 100644
> --- a/tools/perf/arch/x86/Makefile
> +++ b/tools/perf/arch/x86/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> HAVE_KVM_STAT_SUPPORT := 1
> diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makefile
> index 88c08eed9c7b..119b06a64bed 100644
> --- a/tools/perf/arch/xtensa/Makefile
> +++ b/tools/perf/arch/xtensa/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 003a3bcebfdf..91672bb3047c 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -616,7 +616,7 @@ __cmd_probe(int argc, const char **argv)
> set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE);
> set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE);
> #else
> -# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_DWARF=1", c)
> +# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_LIBDW=1", c)
> set_nobuild('L', "line", false);
> set_nobuild('V', "vars", false);
> set_nobuild('\0', "externs", false);
> --
> 2.46.0.792.g87dc391469-goog
>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW
2024-09-26 0:26 ` Namhyung Kim
@ 2024-09-26 15:02 ` Ian Rogers
2024-09-26 19:28 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-26 15:02 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Sep 25, 2024 at 5:26 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Tue, Sep 24, 2024 at 09:04:08AM -0700, Ian Rogers wrote:
> > NO_DWARF could mean more than NO_LIBDW support, in particular no
> > libunwind support. Rename to be more intention revealing.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> > tools/perf/Makefile.config | 16 ++++++++--------
> > tools/perf/Makefile.perf | 2 +-
> > tools/perf/arch/arm/Makefile | 2 +-
> > tools/perf/arch/arm64/Makefile | 2 +-
> > tools/perf/arch/csky/Makefile | 2 +-
> > tools/perf/arch/loongarch/Makefile | 2 +-
> > tools/perf/arch/mips/Makefile | 2 +-
> > tools/perf/arch/powerpc/Makefile | 2 +-
> > tools/perf/arch/riscv/Makefile | 2 +-
> > tools/perf/arch/s390/Makefile | 2 +-
> > tools/perf/arch/sh/Makefile | 2 +-
> > tools/perf/arch/sparc/Makefile | 2 +-
> > tools/perf/arch/x86/Makefile | 2 +-
> > tools/perf/arch/xtensa/Makefile | 2 +-
> > tools/perf/builtin-probe.c | 2 +-
> > 15 files changed, 22 insertions(+), 22 deletions(-)
> >
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 5e26d3a91b36..55a39211496d 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1)
> > endif
> >
> > ifdef NO_LIBELF
> > - NO_DWARF := 1
> > + NO_LIBDW := 1
> > NO_LIBUNWIND := 1
> > NO_LIBDW_DWARF_UNWIND := 1
> > NO_LIBBPF := 1
> > @@ -471,9 +471,9 @@ else
> > endif
> > endif
> > ifneq ($(feature-dwarf), 1)
> > - ifndef NO_DWARF
> > + ifndef NO_LIBDW
> > $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> > - NO_DWARF := 1
> > + NO_LIBDW := 1
> > endif
> > else
> > ifneq ($(feature-dwarf_getlocations), 1)
> > @@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1)
> > endif
> > endif
> >
> > -ifdef NO_DWARF
> > +ifdef NO_LIBDW
> > NO_LIBDW_DWARF_UNWIND := 1
> > endif
> >
> > @@ -574,17 +574,17 @@ ifndef NO_LIBELF
> > endif
> > endif
> >
> > - ifndef NO_DWARF
> > + ifndef NO_LIBDW
> > ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> > $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
> > - NO_DWARF := 1
> > + NO_LIBDW := 1
> > else
> > CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
> > LDFLAGS += $(LIBDW_LDFLAGS)
> > EXTLIBS += ${DWARFLIBS}
> > $(call detected,CONFIG_DWARF)
> > endif # PERF_HAVE_DWARF_REGS
> > - endif # NO_DWARF
> > + endif # NO_LIBDW
> >
> > ifndef NO_LIBBPF
> > ifeq ($(feature-bpf), 1)
> > @@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP
> > endif
> >
> > ifeq ($(SRCARCH),powerpc)
> > - ifndef NO_DWARF
> > + ifndef NO_LIBDW
> > CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
> > endif
> > endif
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index 9dd2e8d3f3c9..a144bfaf8aeb 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -40,7 +40,7 @@ include ../scripts/utilities.mak
> > #
> > # Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
> > #
> > -# Define NO_DWARF if you do not want debug-info analysis feature at all.
> > +# Define NO_LIBDW if you do not want debug-info analysis feature at all.
>
> Can we keep NO_DWARF for compatibility and set NO_LIBDW=1 internally?
> I think it's fine to change it here to advertise NO_LIBDW over NO_DWARF
> but still want to support NO_DWARF as well.
This would be actively confusing. NO_DWARF should really imply
NO_LIBUNWIND, it is like removing the ability for "perf record
--call-graph dwarf" to work - dwarf meaning libdw or libunwind in the
tool. Having NO_DWARF control NO_LIBDW, I'm not sure what I'm being
asked to do. The point of this clean up is to make the names mean what
they should mean and not something potentially confusingly broader,
but you're asking for the confusingly broader case to mean just libdw.
I don't follow and I don't see how it serves the purpose of the
cleanup.
> Also it seem we don't have an entry in the tests/make for no-dwarf
> build. Can you please add one too?
Sure.
Thanks,
Ian
> Thanks,
> Namhyung
>
>
> > #
> > # Define WERROR=0 to disable treating any warnings as errors.
> > #
> > diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
> > index 1d88fdab13bf..9b164d379548 100644
> > --- a/tools/perf/arch/arm/Makefile
> > +++ b/tools/perf/arch/arm/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > PERF_HAVE_JITDUMP := 1
> > diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
> > index 5735ed4479bb..8a5ffbfe809f 100644
> > --- a/tools/perf/arch/arm64/Makefile
> > +++ b/tools/perf/arch/arm64/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > PERF_HAVE_JITDUMP := 1
> > diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile
> > index 88c08eed9c7b..119b06a64bed 100644
> > --- a/tools/perf/arch/csky/Makefile
> > +++ b/tools/perf/arch/csky/Makefile
> > @@ -1,4 +1,4 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile
> > index c89d6bb6b184..1cc5eb01f32b 100644
> > --- a/tools/perf/arch/loongarch/Makefile
> > +++ b/tools/perf/arch/loongarch/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> > diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
> > index cd0b011b3be5..733f7b76f52d 100644
> > --- a/tools/perf/arch/mips/Makefile
> > +++ b/tools/perf/arch/mips/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> >
> > diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
> > index bf6d323574f6..7672d555f6cd 100644
> > --- a/tools/perf/arch/powerpc/Makefile
> > +++ b/tools/perf/arch/powerpc/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> >
> > diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile
> > index 90c3c476a242..4664a78a1afd 100644
> > --- a/tools/perf/arch/riscv/Makefile
> > +++ b/tools/perf/arch/riscv/Makefile
> > @@ -1,4 +1,4 @@
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> > diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
> > index 56994e63b43a..3f66e2ede3f7 100644
> > --- a/tools/perf/arch/s390/Makefile
> > +++ b/tools/perf/arch/s390/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > HAVE_KVM_STAT_SUPPORT := 1
> > diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
> > index 88c08eed9c7b..119b06a64bed 100644
> > --- a/tools/perf/arch/sh/Makefile
> > +++ b/tools/perf/arch/sh/Makefile
> > @@ -1,4 +1,4 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
> > index 4031db72ba71..7741184894c8 100644
> > --- a/tools/perf/arch/sparc/Makefile
> > +++ b/tools/perf/arch/sparc/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> >
> > diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
> > index 67b4969a6738..9aa58acb5564 100644
> > --- a/tools/perf/arch/x86/Makefile
> > +++ b/tools/perf/arch/x86/Makefile
> > @@ -1,5 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > HAVE_KVM_STAT_SUPPORT := 1
> > diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makefile
> > index 88c08eed9c7b..119b06a64bed 100644
> > --- a/tools/perf/arch/xtensa/Makefile
> > +++ b/tools/perf/arch/xtensa/Makefile
> > @@ -1,4 +1,4 @@
> > # SPDX-License-Identifier: GPL-2.0-only
> > -ifndef NO_DWARF
> > +ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> > index 003a3bcebfdf..91672bb3047c 100644
> > --- a/tools/perf/builtin-probe.c
> > +++ b/tools/perf/builtin-probe.c
> > @@ -616,7 +616,7 @@ __cmd_probe(int argc, const char **argv)
> > set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE);
> > set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE);
> > #else
> > -# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_DWARF=1", c)
> > +# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_LIBDW=1", c)
> > set_nobuild('L', "line", false);
> > set_nobuild('V', "vars", false);
> > set_nobuild('\0', "externs", false);
> > --
> > 2.46.0.792.g87dc391469-goog
> >
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW
2024-09-26 15:02 ` Ian Rogers
@ 2024-09-26 19:28 ` Namhyung Kim
2024-09-29 2:01 ` Masami Hiramatsu
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 19:28 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 08:02:45AM -0700, Ian Rogers wrote:
> On Wed, Sep 25, 2024 at 5:26 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Tue, Sep 24, 2024 at 09:04:08AM -0700, Ian Rogers wrote:
> > > NO_DWARF could mean more than NO_LIBDW support, in particular no
> > > libunwind support. Rename to be more intention revealing.
> > >
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > > tools/perf/Makefile.config | 16 ++++++++--------
> > > tools/perf/Makefile.perf | 2 +-
> > > tools/perf/arch/arm/Makefile | 2 +-
> > > tools/perf/arch/arm64/Makefile | 2 +-
> > > tools/perf/arch/csky/Makefile | 2 +-
> > > tools/perf/arch/loongarch/Makefile | 2 +-
> > > tools/perf/arch/mips/Makefile | 2 +-
> > > tools/perf/arch/powerpc/Makefile | 2 +-
> > > tools/perf/arch/riscv/Makefile | 2 +-
> > > tools/perf/arch/s390/Makefile | 2 +-
> > > tools/perf/arch/sh/Makefile | 2 +-
> > > tools/perf/arch/sparc/Makefile | 2 +-
> > > tools/perf/arch/x86/Makefile | 2 +-
> > > tools/perf/arch/xtensa/Makefile | 2 +-
> > > tools/perf/builtin-probe.c | 2 +-
> > > 15 files changed, 22 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 5e26d3a91b36..55a39211496d 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1)
> > > endif
> > >
> > > ifdef NO_LIBELF
> > > - NO_DWARF := 1
> > > + NO_LIBDW := 1
> > > NO_LIBUNWIND := 1
> > > NO_LIBDW_DWARF_UNWIND := 1
> > > NO_LIBBPF := 1
> > > @@ -471,9 +471,9 @@ else
> > > endif
> > > endif
> > > ifneq ($(feature-dwarf), 1)
> > > - ifndef NO_DWARF
> > > + ifndef NO_LIBDW
> > > $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> > > - NO_DWARF := 1
> > > + NO_LIBDW := 1
> > > endif
> > > else
> > > ifneq ($(feature-dwarf_getlocations), 1)
> > > @@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1)
> > > endif
> > > endif
> > >
> > > -ifdef NO_DWARF
> > > +ifdef NO_LIBDW
> > > NO_LIBDW_DWARF_UNWIND := 1
> > > endif
> > >
> > > @@ -574,17 +574,17 @@ ifndef NO_LIBELF
> > > endif
> > > endif
> > >
> > > - ifndef NO_DWARF
> > > + ifndef NO_LIBDW
> > > ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> > > $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
> > > - NO_DWARF := 1
> > > + NO_LIBDW := 1
> > > else
> > > CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
> > > LDFLAGS += $(LIBDW_LDFLAGS)
> > > EXTLIBS += ${DWARFLIBS}
> > > $(call detected,CONFIG_DWARF)
> > > endif # PERF_HAVE_DWARF_REGS
> > > - endif # NO_DWARF
> > > + endif # NO_LIBDW
> > >
> > > ifndef NO_LIBBPF
> > > ifeq ($(feature-bpf), 1)
> > > @@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP
> > > endif
> > >
> > > ifeq ($(SRCARCH),powerpc)
> > > - ifndef NO_DWARF
> > > + ifndef NO_LIBDW
> > > CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
> > > endif
> > > endif
> > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > > index 9dd2e8d3f3c9..a144bfaf8aeb 100644
> > > --- a/tools/perf/Makefile.perf
> > > +++ b/tools/perf/Makefile.perf
> > > @@ -40,7 +40,7 @@ include ../scripts/utilities.mak
> > > #
> > > # Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
> > > #
> > > -# Define NO_DWARF if you do not want debug-info analysis feature at all.
> > > +# Define NO_LIBDW if you do not want debug-info analysis feature at all.
> >
> > Can we keep NO_DWARF for compatibility and set NO_LIBDW=1 internally?
> > I think it's fine to change it here to advertise NO_LIBDW over NO_DWARF
> > but still want to support NO_DWARF as well.
>
> This would be actively confusing. NO_DWARF should really imply
> NO_LIBUNWIND, it is like removing the ability for "perf record
> --call-graph dwarf" to work - dwarf meaning libdw or libunwind in the
> tool. Having NO_DWARF control NO_LIBDW, I'm not sure what I'm being
> asked to do. The point of this clean up is to make the names mean what
> they should mean and not something potentially confusingly broader,
> but you're asking for the confusingly broader case to mean just libdw.
> I don't follow and I don't see how it serves the purpose of the
> cleanup.
I have no idea how many people use NO_DWARF actually. We can probably
ignore such users and convert it to NO_LIBDW.
What I actually thought was
ifeq ($(NO_DWARF),1)
NO_LIBDW := 1
NO_LIBUNWIND := 1
endif
but it'd break the compatibility too. :(
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW
2024-09-26 19:28 ` Namhyung Kim
@ 2024-09-29 2:01 ` Masami Hiramatsu
0 siblings, 0 replies; 51+ messages in thread
From: Masami Hiramatsu @ 2024-09-29 2:01 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, 26 Sep 2024 12:28:09 -0700
Namhyung Kim <namhyung@kernel.org> wrote:
> On Thu, Sep 26, 2024 at 08:02:45AM -0700, Ian Rogers wrote:
> > On Wed, Sep 25, 2024 at 5:26 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > On Tue, Sep 24, 2024 at 09:04:08AM -0700, Ian Rogers wrote:
> > > > NO_DWARF could mean more than NO_LIBDW support, in particular no
> > > > libunwind support. Rename to be more intention revealing.
> > > >
> > > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > > ---
> > > > tools/perf/Makefile.config | 16 ++++++++--------
> > > > tools/perf/Makefile.perf | 2 +-
> > > > tools/perf/arch/arm/Makefile | 2 +-
> > > > tools/perf/arch/arm64/Makefile | 2 +-
> > > > tools/perf/arch/csky/Makefile | 2 +-
> > > > tools/perf/arch/loongarch/Makefile | 2 +-
> > > > tools/perf/arch/mips/Makefile | 2 +-
> > > > tools/perf/arch/powerpc/Makefile | 2 +-
> > > > tools/perf/arch/riscv/Makefile | 2 +-
> > > > tools/perf/arch/s390/Makefile | 2 +-
> > > > tools/perf/arch/sh/Makefile | 2 +-
> > > > tools/perf/arch/sparc/Makefile | 2 +-
> > > > tools/perf/arch/x86/Makefile | 2 +-
> > > > tools/perf/arch/xtensa/Makefile | 2 +-
> > > > tools/perf/builtin-probe.c | 2 +-
> > > > 15 files changed, 22 insertions(+), 22 deletions(-)
> > > >
> > > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > > index 5e26d3a91b36..55a39211496d 100644
> > > > --- a/tools/perf/Makefile.config
> > > > +++ b/tools/perf/Makefile.config
> > > > @@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1)
> > > > endif
> > > >
> > > > ifdef NO_LIBELF
> > > > - NO_DWARF := 1
> > > > + NO_LIBDW := 1
> > > > NO_LIBUNWIND := 1
> > > > NO_LIBDW_DWARF_UNWIND := 1
> > > > NO_LIBBPF := 1
> > > > @@ -471,9 +471,9 @@ else
> > > > endif
> > > > endif
> > > > ifneq ($(feature-dwarf), 1)
> > > > - ifndef NO_DWARF
> > > > + ifndef NO_LIBDW
> > > > $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> > > > - NO_DWARF := 1
> > > > + NO_LIBDW := 1
> > > > endif
> > > > else
> > > > ifneq ($(feature-dwarf_getlocations), 1)
> > > > @@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1)
> > > > endif
> > > > endif
> > > >
> > > > -ifdef NO_DWARF
> > > > +ifdef NO_LIBDW
> > > > NO_LIBDW_DWARF_UNWIND := 1
> > > > endif
> > > >
> > > > @@ -574,17 +574,17 @@ ifndef NO_LIBELF
> > > > endif
> > > > endif
> > > >
> > > > - ifndef NO_DWARF
> > > > + ifndef NO_LIBDW
> > > > ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> > > > $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
> > > > - NO_DWARF := 1
> > > > + NO_LIBDW := 1
> > > > else
> > > > CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
> > > > LDFLAGS += $(LIBDW_LDFLAGS)
> > > > EXTLIBS += ${DWARFLIBS}
> > > > $(call detected,CONFIG_DWARF)
> > > > endif # PERF_HAVE_DWARF_REGS
> > > > - endif # NO_DWARF
> > > > + endif # NO_LIBDW
> > > >
> > > > ifndef NO_LIBBPF
> > > > ifeq ($(feature-bpf), 1)
> > > > @@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP
> > > > endif
> > > >
> > > > ifeq ($(SRCARCH),powerpc)
> > > > - ifndef NO_DWARF
> > > > + ifndef NO_LIBDW
> > > > CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
> > > > endif
> > > > endif
> > > > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > > > index 9dd2e8d3f3c9..a144bfaf8aeb 100644
> > > > --- a/tools/perf/Makefile.perf
> > > > +++ b/tools/perf/Makefile.perf
> > > > @@ -40,7 +40,7 @@ include ../scripts/utilities.mak
> > > > #
> > > > # Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
> > > > #
> > > > -# Define NO_DWARF if you do not want debug-info analysis feature at all.
> > > > +# Define NO_LIBDW if you do not want debug-info analysis feature at all.
> > >
> > > Can we keep NO_DWARF for compatibility and set NO_LIBDW=1 internally?
> > > I think it's fine to change it here to advertise NO_LIBDW over NO_DWARF
> > > but still want to support NO_DWARF as well.
> >
> > This would be actively confusing. NO_DWARF should really imply
> > NO_LIBUNWIND, it is like removing the ability for "perf record
> > --call-graph dwarf" to work - dwarf meaning libdw or libunwind in the
> > tool. Having NO_DWARF control NO_LIBDW, I'm not sure what I'm being
> > asked to do. The point of this clean up is to make the names mean what
> > they should mean and not something potentially confusingly broader,
> > but you're asking for the confusingly broader case to mean just libdw.
> > I don't follow and I don't see how it serves the purpose of the
> > cleanup.
>
> I have no idea how many people use NO_DWARF actually. We can probably
> ignore such users and convert it to NO_LIBDW.
>
> What I actually thought was
>
> ifeq ($(NO_DWARF),1)
> NO_LIBDW := 1
> NO_LIBUNWIND := 1
> endif
Maybe we can add another patch to do this for new compile option?
Thanks,
>
> but it'd break the compatibility too. :(
>
> Thanks,
> Namhyung
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW
2024-09-24 16:04 ` [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW Ian Rogers
2024-09-26 0:26 ` Namhyung Kim
@ 2024-09-29 2:01 ` Masami Hiramatsu
1 sibling, 0 replies; 51+ messages in thread
From: Masami Hiramatsu @ 2024-09-29 2:01 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, Kan Liang, John Garry, Will Deacon, James Clark,
Mike Leach, Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Nick Terrell, Guilherme Amadio, Changbin Du,
Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, 24 Sep 2024 09:04:08 -0700
Ian Rogers <irogers@google.com> wrote:
> NO_DWARF could mean more than NO_LIBDW support, in particular no
> libunwind support. Rename to be more intention revealing.
>
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks,
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/Makefile.config | 16 ++++++++--------
> tools/perf/Makefile.perf | 2 +-
> tools/perf/arch/arm/Makefile | 2 +-
> tools/perf/arch/arm64/Makefile | 2 +-
> tools/perf/arch/csky/Makefile | 2 +-
> tools/perf/arch/loongarch/Makefile | 2 +-
> tools/perf/arch/mips/Makefile | 2 +-
> tools/perf/arch/powerpc/Makefile | 2 +-
> tools/perf/arch/riscv/Makefile | 2 +-
> tools/perf/arch/s390/Makefile | 2 +-
> tools/perf/arch/sh/Makefile | 2 +-
> tools/perf/arch/sparc/Makefile | 2 +-
> tools/perf/arch/x86/Makefile | 2 +-
> tools/perf/arch/xtensa/Makefile | 2 +-
> tools/perf/builtin-probe.c | 2 +-
> 15 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 5e26d3a91b36..55a39211496d 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1)
> endif
>
> ifdef NO_LIBELF
> - NO_DWARF := 1
> + NO_LIBDW := 1
> NO_LIBUNWIND := 1
> NO_LIBDW_DWARF_UNWIND := 1
> NO_LIBBPF := 1
> @@ -471,9 +471,9 @@ else
> endif
> endif
> ifneq ($(feature-dwarf), 1)
> - ifndef NO_DWARF
> + ifndef NO_LIBDW
> $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> - NO_DWARF := 1
> + NO_LIBDW := 1
> endif
> else
> ifneq ($(feature-dwarf_getlocations), 1)
> @@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1)
> endif
> endif
>
> -ifdef NO_DWARF
> +ifdef NO_LIBDW
> NO_LIBDW_DWARF_UNWIND := 1
> endif
>
> @@ -574,17 +574,17 @@ ifndef NO_LIBELF
> endif
> endif
>
> - ifndef NO_DWARF
> + ifndef NO_LIBDW
> ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
> - NO_DWARF := 1
> + NO_LIBDW := 1
> else
> CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
> LDFLAGS += $(LIBDW_LDFLAGS)
> EXTLIBS += ${DWARFLIBS}
> $(call detected,CONFIG_DWARF)
> endif # PERF_HAVE_DWARF_REGS
> - endif # NO_DWARF
> + endif # NO_LIBDW
>
> ifndef NO_LIBBPF
> ifeq ($(feature-bpf), 1)
> @@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP
> endif
>
> ifeq ($(SRCARCH),powerpc)
> - ifndef NO_DWARF
> + ifndef NO_LIBDW
> CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
> endif
> endif
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 9dd2e8d3f3c9..a144bfaf8aeb 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -40,7 +40,7 @@ include ../scripts/utilities.mak
> #
> # Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
> #
> -# Define NO_DWARF if you do not want debug-info analysis feature at all.
> +# Define NO_LIBDW if you do not want debug-info analysis feature at all.
> #
> # Define WERROR=0 to disable treating any warnings as errors.
> #
> diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
> index 1d88fdab13bf..9b164d379548 100644
> --- a/tools/perf/arch/arm/Makefile
> +++ b/tools/perf/arch/arm/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_JITDUMP := 1
> diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
> index 5735ed4479bb..8a5ffbfe809f 100644
> --- a/tools/perf/arch/arm64/Makefile
> +++ b/tools/perf/arch/arm64/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_JITDUMP := 1
> diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile
> index 88c08eed9c7b..119b06a64bed 100644
> --- a/tools/perf/arch/csky/Makefile
> +++ b/tools/perf/arch/csky/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile
> index c89d6bb6b184..1cc5eb01f32b 100644
> --- a/tools/perf/arch/loongarch/Makefile
> +++ b/tools/perf/arch/loongarch/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
> index cd0b011b3be5..733f7b76f52d 100644
> --- a/tools/perf/arch/mips/Makefile
> +++ b/tools/perf/arch/mips/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
>
> diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
> index bf6d323574f6..7672d555f6cd 100644
> --- a/tools/perf/arch/powerpc/Makefile
> +++ b/tools/perf/arch/powerpc/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
>
> diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile
> index 90c3c476a242..4664a78a1afd 100644
> --- a/tools/perf/arch/riscv/Makefile
> +++ b/tools/perf/arch/riscv/Makefile
> @@ -1,4 +1,4 @@
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
> index 56994e63b43a..3f66e2ede3f7 100644
> --- a/tools/perf/arch/s390/Makefile
> +++ b/tools/perf/arch/s390/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> HAVE_KVM_STAT_SUPPORT := 1
> diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
> index 88c08eed9c7b..119b06a64bed 100644
> --- a/tools/perf/arch/sh/Makefile
> +++ b/tools/perf/arch/sh/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
> index 4031db72ba71..7741184894c8 100644
> --- a/tools/perf/arch/sparc/Makefile
> +++ b/tools/perf/arch/sparc/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
>
> diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
> index 67b4969a6738..9aa58acb5564 100644
> --- a/tools/perf/arch/x86/Makefile
> +++ b/tools/perf/arch/x86/Makefile
> @@ -1,5 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> HAVE_KVM_STAT_SUPPORT := 1
> diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makefile
> index 88c08eed9c7b..119b06a64bed 100644
> --- a/tools/perf/arch/xtensa/Makefile
> +++ b/tools/perf/arch/xtensa/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -ifndef NO_DWARF
> +ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 003a3bcebfdf..91672bb3047c 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -616,7 +616,7 @@ __cmd_probe(int argc, const char **argv)
> set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE);
> set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE);
> #else
> -# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_DWARF=1", c)
> +# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_LIBDW=1", c)
> set_nobuild('L', "line", false);
> set_nobuild('V', "vars", false);
> set_nobuild('\0', "externs", false);
> --
> 2.46.0.792.g87dc391469-goog
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v1 02/11] perf build: Remove defined but never used variable
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
2024-09-24 16:04 ` [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-29 2:02 ` Masami Hiramatsu
2024-09-24 16:04 ` [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw Ian Rogers
` (9 subsequent siblings)
11 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
Previously NO_DWARF_UNWIND was part of conditional compilation but it
is now unused so remove.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Makefile.config | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 55a39211496d..182e14e39cd5 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -753,8 +753,6 @@ endif
ifeq ($(dwarf-post-unwind),1)
CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
$(call detected,CONFIG_DWARF_UNWIND)
-else
- NO_DWARF_UNWIND := 1
endif
ifndef NO_LOCAL_LIBUNWIND
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 02/11] perf build: Remove defined but never used variable
2024-09-24 16:04 ` [PATCH v1 02/11] perf build: Remove defined but never used variable Ian Rogers
@ 2024-09-29 2:02 ` Masami Hiramatsu
0 siblings, 0 replies; 51+ messages in thread
From: Masami Hiramatsu @ 2024-09-29 2:02 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, Kan Liang, John Garry, Will Deacon, James Clark,
Mike Leach, Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Nick Terrell, Guilherme Amadio, Changbin Du,
Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, 24 Sep 2024 09:04:09 -0700
Ian Rogers <irogers@google.com> wrote:
> Previously NO_DWARF_UNWIND was part of conditional compilation but it
> is now unused so remove.
>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you!
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/Makefile.config | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 55a39211496d..182e14e39cd5 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -753,8 +753,6 @@ endif
> ifeq ($(dwarf-post-unwind),1)
> CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
> $(call detected,CONFIG_DWARF_UNWIND)
> -else
> - NO_DWARF_UNWIND := 1
> endif
>
> ifndef NO_LOCAL_LIBUNWIND
> --
> 2.46.0.792.g87dc391469-goog
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
2024-09-24 16:04 ` [PATCH v1 01/11] perf build: Rename NO_DWARF to NO_LIBDW Ian Rogers
2024-09-24 16:04 ` [PATCH v1 02/11] perf build: Remove defined but never used variable Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-26 0:28 ` Namhyung Kim
2024-09-29 2:06 ` Masami Hiramatsu
2024-09-24 16:04 ` [PATCH v1 04/11] perf build: Combine libdw-dwarf-unwind into libdw feature tests Ian Rogers
` (8 subsequent siblings)
11 siblings, 2 replies; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
Be more intention revealing that the dwarf test is actually testing
for libdw support.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/build/Makefile.feature | 6 +++---
tools/build/feature/Makefile | 16 ++++++++--------
tools/build/feature/test-all.c | 6 +++---
.../build/feature/{test-dwarf.c => test-libdw.c} | 0
tools/perf/Makefile.config | 6 +++---
5 files changed, 17 insertions(+), 17 deletions(-)
rename tools/build/feature/{test-dwarf.c => test-libdw.c} (100%)
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index ffd117135094..6025810cc346 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -30,7 +30,7 @@ endef
#
FEATURE_TESTS_BASIC := \
backtrace \
- dwarf \
+ libdw \
dwarf_getlocations \
dwarf_getcfi \
eventfd \
@@ -120,7 +120,7 @@ ifeq ($(FEATURE_TESTS),all)
endif
FEATURE_DISPLAY ?= \
- dwarf \
+ libdw \
dwarf_getlocations \
glibc \
libbfd \
@@ -233,7 +233,7 @@ endef
#
# generates feature value assignment for name, like:
-# $(call feature_assign,dwarf) == feature-dwarf=1
+# $(call feature_assign,libdw) == feature-libdw=1
#
feature_assign = feature-$(1)=$(feature-$(1))
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 5938cf799dc6..bece326ac93b 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -5,7 +5,7 @@ FILES= \
test-all.bin \
test-backtrace.bin \
test-bionic.bin \
- test-dwarf.bin \
+ test-libdw.bin \
test-dwarf_getlocations.bin \
test-dwarf_getcfi.bin \
test-eventfd.bin \
@@ -168,9 +168,9 @@ $(OUTPUT)test-libopencsd.bin:
$(BUILD) # -lopencsd_c_api -lopencsd provided by
# $(FEATURE_CHECK_LDFLAGS-libopencsd)
-DWARFLIBS := -ldw
+DWLIBS := -ldw
ifeq ($(findstring -static,${LDFLAGS}),-static)
- DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
+ DWLIBS += -lelf -lz -llzma -lbz2 -lzstd
LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
@@ -179,18 +179,18 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
# Elfutils merged libebl.a into libdw.a starting from version 0.177,
# Link libebl.a only if libdw is older than this version.
ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
- DWARFLIBS += -lebl
+ DWLIBS += -lebl
endif
endif
-$(OUTPUT)test-dwarf.bin:
- $(BUILD) $(DWARFLIBS)
+$(OUTPUT)test-libdw.bin:
+ $(BUILD) $(DWLIBS)
$(OUTPUT)test-dwarf_getlocations.bin:
- $(BUILD) $(DWARFLIBS)
+ $(BUILD) $(DWLIBS)
$(OUTPUT)test-dwarf_getcfi.bin:
- $(BUILD) $(DWARFLIBS)
+ $(BUILD) $(DWLIBS)
$(OUTPUT)test-libelf-getphdrnum.bin:
$(BUILD) -lelf
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 6f4bf386a3b5..d60e072b6eca 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -38,8 +38,8 @@
# include "test-glibc.c"
#undef main
-#define main main_test_dwarf
-# include "test-dwarf.c"
+#define main main_test_libdw
+# include "test-libdw.c"
#undef main
#define main main_test_dwarf_getlocations
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
main_test_get_current_dir_name();
main_test_gettid();
main_test_glibc();
- main_test_dwarf();
+ main_test_libdw();
main_test_dwarf_getlocations();
main_test_eventfd();
main_test_libelf_getphdrnum();
diff --git a/tools/build/feature/test-dwarf.c b/tools/build/feature/test-libdw.c
similarity index 100%
rename from tools/build/feature/test-dwarf.c
rename to tools/build/feature/test-libdw.c
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 182e14e39cd5..c8e157cc0c5e 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -159,8 +159,8 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
DWARFLIBS += -lebl
endif
endif
-FEATURE_CHECK_CFLAGS-dwarf := $(LIBDW_CFLAGS)
-FEATURE_CHECK_LDFLAGS-dwarf := $(LIBDW_LDFLAGS) $(DWARFLIBS)
+FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
@@ -470,7 +470,7 @@ else
$(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR)
endif
endif
- ifneq ($(feature-dwarf), 1)
+ ifneq ($(feature-libdw), 1)
ifndef NO_LIBDW
$(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
NO_LIBDW := 1
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw
2024-09-24 16:04 ` [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw Ian Rogers
@ 2024-09-26 0:28 ` Namhyung Kim
2024-09-26 15:37 ` Ian Rogers
2024-09-29 2:06 ` Masami Hiramatsu
1 sibling, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 0:28 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Sep 24, 2024 at 09:04:10AM -0700, Ian Rogers wrote:
> Be more intention revealing that the dwarf test is actually testing
> for libdw support.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/build/Makefile.feature | 6 +++---
> tools/build/feature/Makefile | 16 ++++++++--------
> tools/build/feature/test-all.c | 6 +++---
> .../build/feature/{test-dwarf.c => test-libdw.c} | 0
> tools/perf/Makefile.config | 6 +++---
> 5 files changed, 17 insertions(+), 17 deletions(-)
> rename tools/build/feature/{test-dwarf.c => test-libdw.c} (100%)
>
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index ffd117135094..6025810cc346 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -30,7 +30,7 @@ endef
> #
> FEATURE_TESTS_BASIC := \
> backtrace \
> - dwarf \
> + libdw \
> dwarf_getlocations \
> dwarf_getcfi \
> eventfd \
> @@ -120,7 +120,7 @@ ifeq ($(FEATURE_TESTS),all)
> endif
>
> FEATURE_DISPLAY ?= \
> - dwarf \
> + libdw \
> dwarf_getlocations \
> glibc \
> libbfd \
> @@ -233,7 +233,7 @@ endef
>
> #
> # generates feature value assignment for name, like:
> -# $(call feature_assign,dwarf) == feature-dwarf=1
> +# $(call feature_assign,libdw) == feature-libdw=1
> #
> feature_assign = feature-$(1)=$(feature-$(1))
>
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 5938cf799dc6..bece326ac93b 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -5,7 +5,7 @@ FILES= \
> test-all.bin \
> test-backtrace.bin \
> test-bionic.bin \
> - test-dwarf.bin \
> + test-libdw.bin \
> test-dwarf_getlocations.bin \
> test-dwarf_getcfi.bin \
> test-eventfd.bin \
> @@ -168,9 +168,9 @@ $(OUTPUT)test-libopencsd.bin:
> $(BUILD) # -lopencsd_c_api -lopencsd provided by
> # $(FEATURE_CHECK_LDFLAGS-libopencsd)
>
> -DWARFLIBS := -ldw
> +DWLIBS := -ldw
> ifeq ($(findstring -static,${LDFLAGS}),-static)
> - DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
> + DWLIBS += -lelf -lz -llzma -lbz2 -lzstd
>
> LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
> LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
> @@ -179,18 +179,18 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> # Elfutils merged libebl.a into libdw.a starting from version 0.177,
> # Link libebl.a only if libdw is older than this version.
> ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
> - DWARFLIBS += -lebl
> + DWLIBS += -lebl
> endif
> endif
>
> -$(OUTPUT)test-dwarf.bin:
> - $(BUILD) $(DWARFLIBS)
> +$(OUTPUT)test-libdw.bin:
> + $(BUILD) $(DWLIBS)
>
> $(OUTPUT)test-dwarf_getlocations.bin:
> - $(BUILD) $(DWARFLIBS)
> + $(BUILD) $(DWLIBS)
>
> $(OUTPUT)test-dwarf_getcfi.bin:
> - $(BUILD) $(DWARFLIBS)
> + $(BUILD) $(DWLIBS)
>
> $(OUTPUT)test-libelf-getphdrnum.bin:
> $(BUILD) -lelf
> diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
> index 6f4bf386a3b5..d60e072b6eca 100644
> --- a/tools/build/feature/test-all.c
> +++ b/tools/build/feature/test-all.c
> @@ -38,8 +38,8 @@
> # include "test-glibc.c"
> #undef main
>
> -#define main main_test_dwarf
> -# include "test-dwarf.c"
> +#define main main_test_libdw
> +# include "test-libdw.c"
> #undef main
>
> #define main main_test_dwarf_getlocations
> @@ -187,7 +187,7 @@ int main(int argc, char *argv[])
> main_test_get_current_dir_name();
> main_test_gettid();
> main_test_glibc();
> - main_test_dwarf();
> + main_test_libdw();
> main_test_dwarf_getlocations();
> main_test_eventfd();
> main_test_libelf_getphdrnum();
> diff --git a/tools/build/feature/test-dwarf.c b/tools/build/feature/test-libdw.c
> similarity index 100%
> rename from tools/build/feature/test-dwarf.c
> rename to tools/build/feature/test-libdw.c
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 182e14e39cd5..c8e157cc0c5e 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -159,8 +159,8 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> DWARFLIBS += -lebl
> endif
> endif
> -FEATURE_CHECK_CFLAGS-dwarf := $(LIBDW_CFLAGS)
> -FEATURE_CHECK_LDFLAGS-dwarf := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> +FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
> +FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
s/DWARFLIBS/DWLIBS/ ?
> FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
> FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
Ditto.
Thanks,
Namhyung
> FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
> @@ -470,7 +470,7 @@ else
> $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR)
> endif
> endif
> - ifneq ($(feature-dwarf), 1)
> + ifneq ($(feature-libdw), 1)
> ifndef NO_LIBDW
> $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> NO_LIBDW := 1
> --
> 2.46.0.792.g87dc391469-goog
>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw
2024-09-26 0:28 ` Namhyung Kim
@ 2024-09-26 15:37 ` Ian Rogers
2024-09-26 18:23 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-26 15:37 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Sep 25, 2024 at 5:28 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Tue, Sep 24, 2024 at 09:04:10AM -0700, Ian Rogers wrote:
> > Be more intention revealing that the dwarf test is actually testing
> > for libdw support.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> > tools/build/Makefile.feature | 6 +++---
> > tools/build/feature/Makefile | 16 ++++++++--------
> > tools/build/feature/test-all.c | 6 +++---
> > .../build/feature/{test-dwarf.c => test-libdw.c} | 0
> > tools/perf/Makefile.config | 6 +++---
> > 5 files changed, 17 insertions(+), 17 deletions(-)
> > rename tools/build/feature/{test-dwarf.c => test-libdw.c} (100%)
> >
> > diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> > index ffd117135094..6025810cc346 100644
> > --- a/tools/build/Makefile.feature
> > +++ b/tools/build/Makefile.feature
> > @@ -30,7 +30,7 @@ endef
> > #
> > FEATURE_TESTS_BASIC := \
> > backtrace \
> > - dwarf \
> > + libdw \
> > dwarf_getlocations \
> > dwarf_getcfi \
> > eventfd \
> > @@ -120,7 +120,7 @@ ifeq ($(FEATURE_TESTS),all)
> > endif
> >
> > FEATURE_DISPLAY ?= \
> > - dwarf \
> > + libdw \
> > dwarf_getlocations \
> > glibc \
> > libbfd \
> > @@ -233,7 +233,7 @@ endef
> >
> > #
> > # generates feature value assignment for name, like:
> > -# $(call feature_assign,dwarf) == feature-dwarf=1
> > +# $(call feature_assign,libdw) == feature-libdw=1
> > #
> > feature_assign = feature-$(1)=$(feature-$(1))
> >
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index 5938cf799dc6..bece326ac93b 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -5,7 +5,7 @@ FILES= \
> > test-all.bin \
> > test-backtrace.bin \
> > test-bionic.bin \
> > - test-dwarf.bin \
> > + test-libdw.bin \
> > test-dwarf_getlocations.bin \
> > test-dwarf_getcfi.bin \
> > test-eventfd.bin \
> > @@ -168,9 +168,9 @@ $(OUTPUT)test-libopencsd.bin:
> > $(BUILD) # -lopencsd_c_api -lopencsd provided by
> > # $(FEATURE_CHECK_LDFLAGS-libopencsd)
> >
> > -DWARFLIBS := -ldw
> > +DWLIBS := -ldw
> > ifeq ($(findstring -static,${LDFLAGS}),-static)
> > - DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
> > + DWLIBS += -lelf -lz -llzma -lbz2 -lzstd
> >
> > LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
> > LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
> > @@ -179,18 +179,18 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> > # Elfutils merged libebl.a into libdw.a starting from version 0.177,
> > # Link libebl.a only if libdw is older than this version.
> > ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
> > - DWARFLIBS += -lebl
> > + DWLIBS += -lebl
> > endif
> > endif
> >
> > -$(OUTPUT)test-dwarf.bin:
> > - $(BUILD) $(DWARFLIBS)
> > +$(OUTPUT)test-libdw.bin:
> > + $(BUILD) $(DWLIBS)
> >
> > $(OUTPUT)test-dwarf_getlocations.bin:
> > - $(BUILD) $(DWARFLIBS)
> > + $(BUILD) $(DWLIBS)
> >
> > $(OUTPUT)test-dwarf_getcfi.bin:
> > - $(BUILD) $(DWARFLIBS)
> > + $(BUILD) $(DWLIBS)
> >
> > $(OUTPUT)test-libelf-getphdrnum.bin:
> > $(BUILD) -lelf
> > diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
> > index 6f4bf386a3b5..d60e072b6eca 100644
> > --- a/tools/build/feature/test-all.c
> > +++ b/tools/build/feature/test-all.c
> > @@ -38,8 +38,8 @@
> > # include "test-glibc.c"
> > #undef main
> >
> > -#define main main_test_dwarf
> > -# include "test-dwarf.c"
> > +#define main main_test_libdw
> > +# include "test-libdw.c"
> > #undef main
> >
> > #define main main_test_dwarf_getlocations
> > @@ -187,7 +187,7 @@ int main(int argc, char *argv[])
> > main_test_get_current_dir_name();
> > main_test_gettid();
> > main_test_glibc();
> > - main_test_dwarf();
> > + main_test_libdw();
> > main_test_dwarf_getlocations();
> > main_test_eventfd();
> > main_test_libelf_getphdrnum();
> > diff --git a/tools/build/feature/test-dwarf.c b/tools/build/feature/test-libdw.c
> > similarity index 100%
> > rename from tools/build/feature/test-dwarf.c
> > rename to tools/build/feature/test-libdw.c
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 182e14e39cd5..c8e157cc0c5e 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -159,8 +159,8 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> > DWARFLIBS += -lebl
> > endif
> > endif
> > -FEATURE_CHECK_CFLAGS-dwarf := $(LIBDW_CFLAGS)
> > -FEATURE_CHECK_LDFLAGS-dwarf := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> > +FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
> > +FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
>
> s/DWARFLIBS/DWLIBS/ ?
The patch is changing the name of a feature test. It is possible to
change this Makefile.config variable in the same patch but I think
they are distinct things and the variable rename is follow up work.
Thanks,
Ian
>
> > FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
> > FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
>
> Ditto.
>
> Thanks,
> Namhyung
>
>
> > FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
> > @@ -470,7 +470,7 @@ else
> > $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR)
> > endif
> > endif
> > - ifneq ($(feature-dwarf), 1)
> > + ifneq ($(feature-libdw), 1)
> > ifndef NO_LIBDW
> > $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> > NO_LIBDW := 1
> > --
> > 2.46.0.792.g87dc391469-goog
> >
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw
2024-09-26 15:37 ` Ian Rogers
@ 2024-09-26 18:23 ` Namhyung Kim
0 siblings, 0 replies; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 18:23 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 08:37:51AM -0700, Ian Rogers wrote:
> On Wed, Sep 25, 2024 at 5:28 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Tue, Sep 24, 2024 at 09:04:10AM -0700, Ian Rogers wrote:
> > > Be more intention revealing that the dwarf test is actually testing
> > > for libdw support.
> > >
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > > tools/build/Makefile.feature | 6 +++---
> > > tools/build/feature/Makefile | 16 ++++++++--------
> > > tools/build/feature/test-all.c | 6 +++---
> > > .../build/feature/{test-dwarf.c => test-libdw.c} | 0
> > > tools/perf/Makefile.config | 6 +++---
> > > 5 files changed, 17 insertions(+), 17 deletions(-)
> > > rename tools/build/feature/{test-dwarf.c => test-libdw.c} (100%)
> > >
> > > diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> > > index ffd117135094..6025810cc346 100644
> > > --- a/tools/build/Makefile.feature
> > > +++ b/tools/build/Makefile.feature
> > > @@ -30,7 +30,7 @@ endef
> > > #
> > > FEATURE_TESTS_BASIC := \
> > > backtrace \
> > > - dwarf \
> > > + libdw \
> > > dwarf_getlocations \
> > > dwarf_getcfi \
> > > eventfd \
> > > @@ -120,7 +120,7 @@ ifeq ($(FEATURE_TESTS),all)
> > > endif
> > >
> > > FEATURE_DISPLAY ?= \
> > > - dwarf \
> > > + libdw \
> > > dwarf_getlocations \
> > > glibc \
> > > libbfd \
> > > @@ -233,7 +233,7 @@ endef
> > >
> > > #
> > > # generates feature value assignment for name, like:
> > > -# $(call feature_assign,dwarf) == feature-dwarf=1
> > > +# $(call feature_assign,libdw) == feature-libdw=1
> > > #
> > > feature_assign = feature-$(1)=$(feature-$(1))
> > >
> > > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > > index 5938cf799dc6..bece326ac93b 100644
> > > --- a/tools/build/feature/Makefile
> > > +++ b/tools/build/feature/Makefile
> > > @@ -5,7 +5,7 @@ FILES= \
> > > test-all.bin \
> > > test-backtrace.bin \
> > > test-bionic.bin \
> > > - test-dwarf.bin \
> > > + test-libdw.bin \
> > > test-dwarf_getlocations.bin \
> > > test-dwarf_getcfi.bin \
> > > test-eventfd.bin \
> > > @@ -168,9 +168,9 @@ $(OUTPUT)test-libopencsd.bin:
> > > $(BUILD) # -lopencsd_c_api -lopencsd provided by
> > > # $(FEATURE_CHECK_LDFLAGS-libopencsd)
> > >
> > > -DWARFLIBS := -ldw
> > > +DWLIBS := -ldw
See here and the below changes.
> > > ifeq ($(findstring -static,${LDFLAGS}),-static)
> > > - DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
> > > + DWLIBS += -lelf -lz -llzma -lbz2 -lzstd
> > >
> > > LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
> > > LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
> > > @@ -179,18 +179,18 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> > > # Elfutils merged libebl.a into libdw.a starting from version 0.177,
> > > # Link libebl.a only if libdw is older than this version.
> > > ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
> > > - DWARFLIBS += -lebl
> > > + DWLIBS += -lebl
> > > endif
> > > endif
> > >
> > > -$(OUTPUT)test-dwarf.bin:
> > > - $(BUILD) $(DWARFLIBS)
> > > +$(OUTPUT)test-libdw.bin:
> > > + $(BUILD) $(DWLIBS)
> > >
> > > $(OUTPUT)test-dwarf_getlocations.bin:
> > > - $(BUILD) $(DWARFLIBS)
> > > + $(BUILD) $(DWLIBS)
> > >
> > > $(OUTPUT)test-dwarf_getcfi.bin:
> > > - $(BUILD) $(DWARFLIBS)
> > > + $(BUILD) $(DWLIBS)
> > >
> > > $(OUTPUT)test-libelf-getphdrnum.bin:
> > > $(BUILD) -lelf
> > > diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
> > > index 6f4bf386a3b5..d60e072b6eca 100644
> > > --- a/tools/build/feature/test-all.c
> > > +++ b/tools/build/feature/test-all.c
> > > @@ -38,8 +38,8 @@
> > > # include "test-glibc.c"
> > > #undef main
> > >
> > > -#define main main_test_dwarf
> > > -# include "test-dwarf.c"
> > > +#define main main_test_libdw
> > > +# include "test-libdw.c"
> > > #undef main
> > >
> > > #define main main_test_dwarf_getlocations
> > > @@ -187,7 +187,7 @@ int main(int argc, char *argv[])
> > > main_test_get_current_dir_name();
> > > main_test_gettid();
> > > main_test_glibc();
> > > - main_test_dwarf();
> > > + main_test_libdw();
> > > main_test_dwarf_getlocations();
> > > main_test_eventfd();
> > > main_test_libelf_getphdrnum();
> > > diff --git a/tools/build/feature/test-dwarf.c b/tools/build/feature/test-libdw.c
> > > similarity index 100%
> > > rename from tools/build/feature/test-dwarf.c
> > > rename to tools/build/feature/test-libdw.c
> > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > > index 182e14e39cd5..c8e157cc0c5e 100644
> > > --- a/tools/perf/Makefile.config
> > > +++ b/tools/perf/Makefile.config
> > > @@ -159,8 +159,8 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> > > DWARFLIBS += -lebl
> > > endif
> > > endif
> > > -FEATURE_CHECK_CFLAGS-dwarf := $(LIBDW_CFLAGS)
> > > -FEATURE_CHECK_LDFLAGS-dwarf := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> > > +FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
> > > +FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> >
> > s/DWARFLIBS/DWLIBS/ ?
>
> The patch is changing the name of a feature test. It is possible to
> change this Makefile.config variable in the same patch but I think
> they are distinct things and the variable rename is follow up work.
Oh.. you changed it in tools/build/feature/Makefile above but didn't in
tools/perf/Makefile.config. That confused me.. ;-)
Thanks,
Namhyung
> >
> > > FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
> > > FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> >
> > Ditto.
> >
> > Thanks,
> > Namhyung
> >
> >
> > > FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
> > > @@ -470,7 +470,7 @@ else
> > > $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR)
> > > endif
> > > endif
> > > - ifneq ($(feature-dwarf), 1)
> > > + ifneq ($(feature-libdw), 1)
> > > ifndef NO_LIBDW
> > > $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> > > NO_LIBDW := 1
> > > --
> > > 2.46.0.792.g87dc391469-goog
> > >
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw
2024-09-24 16:04 ` [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw Ian Rogers
2024-09-26 0:28 ` Namhyung Kim
@ 2024-09-29 2:06 ` Masami Hiramatsu
1 sibling, 0 replies; 51+ messages in thread
From: Masami Hiramatsu @ 2024-09-29 2:06 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, Kan Liang, John Garry, Will Deacon, James Clark,
Mike Leach, Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Nick Terrell, Guilherme Amadio, Changbin Du,
Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, 24 Sep 2024 09:04:10 -0700
Ian Rogers <irogers@google.com> wrote:
> Be more intention revealing that the dwarf test is actually testing
> for libdw support.
>
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/build/Makefile.feature | 6 +++---
> tools/build/feature/Makefile | 16 ++++++++--------
> tools/build/feature/test-all.c | 6 +++---
> .../build/feature/{test-dwarf.c => test-libdw.c} | 0
> tools/perf/Makefile.config | 6 +++---
> 5 files changed, 17 insertions(+), 17 deletions(-)
> rename tools/build/feature/{test-dwarf.c => test-libdw.c} (100%)
>
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index ffd117135094..6025810cc346 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -30,7 +30,7 @@ endef
> #
> FEATURE_TESTS_BASIC := \
> backtrace \
> - dwarf \
> + libdw \
> dwarf_getlocations \
> dwarf_getcfi \
> eventfd \
> @@ -120,7 +120,7 @@ ifeq ($(FEATURE_TESTS),all)
> endif
>
> FEATURE_DISPLAY ?= \
> - dwarf \
> + libdw \
> dwarf_getlocations \
> glibc \
> libbfd \
> @@ -233,7 +233,7 @@ endef
>
> #
> # generates feature value assignment for name, like:
> -# $(call feature_assign,dwarf) == feature-dwarf=1
> +# $(call feature_assign,libdw) == feature-libdw=1
> #
> feature_assign = feature-$(1)=$(feature-$(1))
>
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index 5938cf799dc6..bece326ac93b 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -5,7 +5,7 @@ FILES= \
> test-all.bin \
> test-backtrace.bin \
> test-bionic.bin \
> - test-dwarf.bin \
> + test-libdw.bin \
> test-dwarf_getlocations.bin \
> test-dwarf_getcfi.bin \
> test-eventfd.bin \
> @@ -168,9 +168,9 @@ $(OUTPUT)test-libopencsd.bin:
> $(BUILD) # -lopencsd_c_api -lopencsd provided by
> # $(FEATURE_CHECK_LDFLAGS-libopencsd)
>
> -DWARFLIBS := -ldw
> +DWLIBS := -ldw
> ifeq ($(findstring -static,${LDFLAGS}),-static)
> - DWARFLIBS += -lelf -lz -llzma -lbz2 -lzstd
> + DWLIBS += -lelf -lz -llzma -lbz2 -lzstd
>
> LIBDW_VERSION := $(shell $(PKG_CONFIG) --modversion libdw)
> LIBDW_VERSION_1 := $(word 1, $(subst ., ,$(LIBDW_VERSION)))
> @@ -179,18 +179,18 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> # Elfutils merged libebl.a into libdw.a starting from version 0.177,
> # Link libebl.a only if libdw is older than this version.
> ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0)
> - DWARFLIBS += -lebl
> + DWLIBS += -lebl
> endif
> endif
>
> -$(OUTPUT)test-dwarf.bin:
> - $(BUILD) $(DWARFLIBS)
> +$(OUTPUT)test-libdw.bin:
> + $(BUILD) $(DWLIBS)
>
> $(OUTPUT)test-dwarf_getlocations.bin:
> - $(BUILD) $(DWARFLIBS)
> + $(BUILD) $(DWLIBS)
>
> $(OUTPUT)test-dwarf_getcfi.bin:
> - $(BUILD) $(DWARFLIBS)
> + $(BUILD) $(DWLIBS)
>
> $(OUTPUT)test-libelf-getphdrnum.bin:
> $(BUILD) -lelf
> diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
> index 6f4bf386a3b5..d60e072b6eca 100644
> --- a/tools/build/feature/test-all.c
> +++ b/tools/build/feature/test-all.c
> @@ -38,8 +38,8 @@
> # include "test-glibc.c"
> #undef main
>
> -#define main main_test_dwarf
> -# include "test-dwarf.c"
> +#define main main_test_libdw
> +# include "test-libdw.c"
> #undef main
>
> #define main main_test_dwarf_getlocations
> @@ -187,7 +187,7 @@ int main(int argc, char *argv[])
> main_test_get_current_dir_name();
> main_test_gettid();
> main_test_glibc();
> - main_test_dwarf();
> + main_test_libdw();
> main_test_dwarf_getlocations();
> main_test_eventfd();
> main_test_libelf_getphdrnum();
> diff --git a/tools/build/feature/test-dwarf.c b/tools/build/feature/test-libdw.c
> similarity index 100%
> rename from tools/build/feature/test-dwarf.c
> rename to tools/build/feature/test-libdw.c
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 182e14e39cd5..c8e157cc0c5e 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -159,8 +159,8 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
> DWARFLIBS += -lebl
> endif
> endif
> -FEATURE_CHECK_CFLAGS-dwarf := $(LIBDW_CFLAGS)
> -FEATURE_CHECK_LDFLAGS-dwarf := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> +FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
> +FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
> FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
> FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
> @@ -470,7 +470,7 @@ else
> $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR)
> endif
> endif
> - ifneq ($(feature-dwarf), 1)
> + ifneq ($(feature-libdw), 1)
> ifndef NO_LIBDW
> $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> NO_LIBDW := 1
> --
> 2.46.0.792.g87dc391469-goog
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v1 04/11] perf build: Combine libdw-dwarf-unwind into libdw feature tests
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (2 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 03/11] perf build: Rename test-dwarf to test-libdw Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-24 16:04 ` [PATCH v1 05/11] perf build: Combine test-dwarf-getlocations into test-libdw Ian Rogers
` (7 subsequent siblings)
11 siblings, 0 replies; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
Support in libdw has been present for 10 years so let's simplify the
build logic with a single feature test.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/build/Makefile.feature | 2 --
tools/build/feature/Makefile | 4 ----
tools/build/feature/test-all.c | 5 -----
tools/build/feature/test-libdw-dwarf-unwind.c | 14 --------------
tools/build/feature/test-libdw.c | 19 ++++++++++++++++++-
tools/perf/Makefile.config | 8 --------
6 files changed, 18 insertions(+), 34 deletions(-)
delete mode 100644 tools/build/feature/test-libdw-dwarf-unwind.c
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 6025810cc346..db3695ec5f83 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -60,7 +60,6 @@ FEATURE_TESTS_BASIC := \
reallocarray \
stackprotector-all \
timerfd \
- libdw-dwarf-unwind \
zlib \
lzma \
get_cpuid \
@@ -133,7 +132,6 @@ FEATURE_DISPLAY ?= \
libpython \
libcrypto \
libunwind \
- libdw-dwarf-unwind \
libcapstone \
llvm-perf \
zlib \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index bece326ac93b..7bb409c1f7e6 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -52,7 +52,6 @@ FILES= \
test-pthread-barrier.bin \
test-stackprotector-all.bin \
test-timerfd.bin \
- test-libdw-dwarf-unwind.bin \
test-libbabeltrace.bin \
test-libcapstone.bin \
test-compile-32.bin \
@@ -314,9 +313,6 @@ $(OUTPUT)test-backtrace.bin:
$(OUTPUT)test-timerfd.bin:
$(BUILD)
-$(OUTPUT)test-libdw-dwarf-unwind.bin:
- $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
-
$(OUTPUT)test-libbabeltrace.bin:
$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index d60e072b6eca..863c82516433 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -98,10 +98,6 @@
# include "test-stackprotector-all.c"
#undef main
-#define main main_test_libdw_dwarf_unwind
-# include "test-libdw-dwarf-unwind.c"
-#undef main
-
#define main main_test_zlib
# include "test-zlib.c"
#undef main
@@ -202,7 +198,6 @@ int main(int argc, char *argv[])
main_test_numa_num_possible_cpus();
main_test_timerfd();
main_test_stackprotector_all();
- main_test_libdw_dwarf_unwind();
main_test_zlib();
main_test_pthread_attr_setaffinity_np();
main_test_pthread_barrier();
diff --git a/tools/build/feature/test-libdw-dwarf-unwind.c b/tools/build/feature/test-libdw-dwarf-unwind.c
deleted file mode 100644
index ed03d9505609..000000000000
--- a/tools/build/feature/test-libdw-dwarf-unwind.c
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <elfutils/libdwfl.h>
-
-int main(void)
-{
- /*
- * This function is guarded via: __nonnull_attribute__ (1, 2).
- * Passing '1' as arguments value. This code is never executed,
- * only compiled.
- */
- dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
- return 0;
-}
diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
index 8d474bd7371b..793f4ac49514 100644
--- a/tools/build/feature/test-libdw.c
+++ b/tools/build/feature/test-libdw.c
@@ -1,11 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
#include <dwarf.h>
#include <elfutils/libdw.h>
+#include <elfutils/libdwfl.h>
#include <elfutils/version.h>
-int main(void)
+int test_libdw(void)
{
Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
return (long)dbg;
}
+
+int test_libdw_unwind(void)
+{
+ /*
+ * This function is guarded via: __nonnull_attribute__ (1, 2).
+ * Passing '1' as arguments value. This code is never executed,
+ * only compiled.
+ */
+ dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
+ return 0;
+}
+
+int main(void)
+{
+ return test_libdw() + test_libdw_unwind();
+}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index c8e157cc0c5e..93fd6bd74d20 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
endif
FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
-FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
-FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) $(DWARFLIBS)
FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-dwarf_getlocations := $(LIBDW_LDFLAGS) $(DWARFLIBS)
FEATURE_CHECK_CFLAGS-dwarf_getcfi := $(LIBDW_CFLAGS)
@@ -464,12 +462,6 @@ else
endif
endif
else
- ifndef NO_LIBDW_DWARF_UNWIND
- ifneq ($(feature-libdw-dwarf-unwind),1)
- NO_LIBDW_DWARF_UNWIND := 1
- $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR)
- endif
- endif
ifneq ($(feature-libdw), 1)
ifndef NO_LIBDW
$(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v1 05/11] perf build: Combine test-dwarf-getlocations into test-libdw
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (3 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 04/11] perf build: Combine libdw-dwarf-unwind into libdw feature tests Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-24 16:04 ` [PATCH v1 06/11] perf build: Combine test-dwarf-getcfi " Ian Rogers
` (6 subsequent siblings)
11 siblings, 0 replies; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
dwarf_getlocations support in libdw is more than 10 years old. Make
libdw imply dwarf_getlocations support and simplify build logic.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/build/Makefile.feature | 2 --
tools/build/feature/Makefile | 4 ----
tools/build/feature/test-all.c | 5 -----
tools/build/feature/test-dwarf_getlocations.c | 13 -------------
tools/build/feature/test-libdw.c | 14 +++++++++++++-
tools/perf/Makefile.config | 10 ++--------
6 files changed, 15 insertions(+), 33 deletions(-)
delete mode 100644 tools/build/feature/test-dwarf_getlocations.c
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index db3695ec5f83..cf6a967575ea 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -31,7 +31,6 @@ endef
FEATURE_TESTS_BASIC := \
backtrace \
libdw \
- dwarf_getlocations \
dwarf_getcfi \
eventfd \
fortify-source \
@@ -120,7 +119,6 @@ endif
FEATURE_DISPLAY ?= \
libdw \
- dwarf_getlocations \
glibc \
libbfd \
libbfd-buildid \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 7bb409c1f7e6..7683d171f744 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -6,7 +6,6 @@ FILES= \
test-backtrace.bin \
test-bionic.bin \
test-libdw.bin \
- test-dwarf_getlocations.bin \
test-dwarf_getcfi.bin \
test-eventfd.bin \
test-fortify-source.bin \
@@ -185,9 +184,6 @@ endif
$(OUTPUT)test-libdw.bin:
$(BUILD) $(DWLIBS)
-$(OUTPUT)test-dwarf_getlocations.bin:
- $(BUILD) $(DWLIBS)
-
$(OUTPUT)test-dwarf_getcfi.bin:
$(BUILD) $(DWLIBS)
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 863c82516433..59ef3d7fe6a4 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -42,10 +42,6 @@
# include "test-libdw.c"
#undef main
-#define main main_test_dwarf_getlocations
-# include "test-dwarf_getlocations.c"
-#undef main
-
#define main main_test_eventfd
# include "test-eventfd.c"
#undef main
@@ -184,7 +180,6 @@ int main(int argc, char *argv[])
main_test_gettid();
main_test_glibc();
main_test_libdw();
- main_test_dwarf_getlocations();
main_test_eventfd();
main_test_libelf_getphdrnum();
main_test_libelf_gelf_getnote();
diff --git a/tools/build/feature/test-dwarf_getlocations.c b/tools/build/feature/test-dwarf_getlocations.c
deleted file mode 100644
index 78fb4a1fa68c..000000000000
--- a/tools/build/feature/test-dwarf_getlocations.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <stdlib.h>
-#include <elfutils/libdw.h>
-
-int main(void)
-{
- Dwarf_Addr base, start, end;
- Dwarf_Attribute attr;
- Dwarf_Op *op;
- size_t nops;
- ptrdiff_t offset = 0;
- return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &nops);
-}
diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
index 793f4ac49514..83ea5d5f235d 100644
--- a/tools/build/feature/test-libdw.c
+++ b/tools/build/feature/test-libdw.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+#include <stdlib.h>
#include <dwarf.h>
#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
@@ -22,7 +23,18 @@ int test_libdw_unwind(void)
return 0;
}
+int test_libdw_getlocations(void)
+{
+ Dwarf_Addr base, start, end;
+ Dwarf_Attribute attr;
+ Dwarf_Op *op;
+ size_t nops;
+ ptrdiff_t offset = 0;
+
+ return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &nops);
+}
+
int main(void)
{
- return test_libdw() + test_libdw_unwind();
+ return test_libdw() + test_libdw_unwind() + test_libdw_getlocations();
}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 93fd6bd74d20..903de48c140d 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
endif
FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
-FEATURE_CHECK_CFLAGS-dwarf_getlocations := $(LIBDW_CFLAGS)
-FEATURE_CHECK_LDFLAGS-dwarf_getlocations := $(LIBDW_LDFLAGS) $(DWARFLIBS)
FEATURE_CHECK_CFLAGS-dwarf_getcfi := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-dwarf_getcfi := $(LIBDW_LDFLAGS) $(DWARFLIBS)
@@ -464,15 +462,11 @@ else
else
ifneq ($(feature-libdw), 1)
ifndef NO_LIBDW
- $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev)
+ $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.157, disables dwarf support. Please install new elfutils-devel/libdw-dev)
NO_LIBDW := 1
endif
else
- ifneq ($(feature-dwarf_getlocations), 1)
- $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157)
- else
- CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
- endif # dwarf_getlocations
+ CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
ifneq ($(feature-dwarf_getcfi), 1)
$(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.142)
else
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v1 06/11] perf build: Combine test-dwarf-getcfi into test-libdw
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (4 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 05/11] perf build: Combine test-dwarf-getlocations into test-libdw Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-24 16:04 ` [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check Ian Rogers
` (5 subsequent siblings)
11 siblings, 0 replies; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
dwarf_getcfi support in libdw is 15 years old. Make libdw imply
dwarf_getcfi support and simplify build logic.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/build/Makefile.feature | 1 -
tools/build/feature/Makefile | 4 ----
tools/build/feature/test-dwarf_getcfi.c | 9 ---------
tools/build/feature/test-libdw.c | 10 +++++++++-
tools/perf/Makefile.config | 8 +-------
5 files changed, 10 insertions(+), 22 deletions(-)
delete mode 100644 tools/build/feature/test-dwarf_getcfi.c
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index cf6a967575ea..ef72aae3dd49 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -31,7 +31,6 @@ endef
FEATURE_TESTS_BASIC := \
backtrace \
libdw \
- dwarf_getcfi \
eventfd \
fortify-source \
get_current_dir_name \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 7683d171f744..f94afd522ebb 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -6,7 +6,6 @@ FILES= \
test-backtrace.bin \
test-bionic.bin \
test-libdw.bin \
- test-dwarf_getcfi.bin \
test-eventfd.bin \
test-fortify-source.bin \
test-get_current_dir_name.bin \
@@ -184,9 +183,6 @@ endif
$(OUTPUT)test-libdw.bin:
$(BUILD) $(DWLIBS)
-$(OUTPUT)test-dwarf_getcfi.bin:
- $(BUILD) $(DWLIBS)
-
$(OUTPUT)test-libelf-getphdrnum.bin:
$(BUILD) -lelf
diff --git a/tools/build/feature/test-dwarf_getcfi.c b/tools/build/feature/test-dwarf_getcfi.c
deleted file mode 100644
index 50e7d7cb7bdf..000000000000
--- a/tools/build/feature/test-dwarf_getcfi.c
+++ /dev/null
@@ -1,9 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <stdio.h>
-#include <elfutils/libdw.h>
-
-int main(void)
-{
- Dwarf *dwarf = NULL;
- return dwarf_getcfi(dwarf) == NULL;
-}
diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
index 83ea5d5f235d..71c6f8e3b0ee 100644
--- a/tools/build/feature/test-libdw.c
+++ b/tools/build/feature/test-libdw.c
@@ -34,7 +34,15 @@ int test_libdw_getlocations(void)
return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &nops);
}
+int test_libdw_getcfi(void)
+{
+ Dwarf *dwarf = NULL;
+
+ return dwarf_getcfi(dwarf) == NULL;
+}
+
int main(void)
{
- return test_libdw() + test_libdw_unwind() + test_libdw_getlocations();
+ return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() +
+ test_libdw_getcfi();
}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 903de48c140d..9da0dc001d98 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static)
endif
FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
-FEATURE_CHECK_CFLAGS-dwarf_getcfi := $(LIBDW_CFLAGS)
-FEATURE_CHECK_LDFLAGS-dwarf_getcfi := $(LIBDW_LDFLAGS) $(DWARFLIBS)
# for linking with debug library, run like:
# make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
@@ -467,11 +465,7 @@ else
endif
else
CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
- ifneq ($(feature-dwarf_getcfi), 1)
- $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.142)
- else
- CFLAGS += -DHAVE_DWARF_CFI_SUPPORT
- endif # dwarf_getcfi
+ CFLAGS += -DHAVE_DWARF_CFI_SUPPORT
endif # Dwarf support
endif # libelf support
endif # NO_LIBELF
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (5 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 06/11] perf build: Combine test-dwarf-getcfi " Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-26 0:29 ` Namhyung Kim
2024-09-24 16:04 ` [PATCH v1 08/11] perf libdw: Remove unnecessary defines Ian Rogers
` (4 subsequent siblings)
11 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before
2009-06-13, but that is 15 years ago and very unlikely. Add a test to
test-libdw.c and assume the libdw version is at least 0.142 to
simplify the build logic.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/build/feature/test-libdw.c | 10 +++++++++-
tools/perf/util/probe-finder.c | 2 --
tools/perf/util/probe-finder.h | 2 --
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
index 71c6f8e3b0ee..2fb59479ab77 100644
--- a/tools/build/feature/test-libdw.c
+++ b/tools/build/feature/test-libdw.c
@@ -41,8 +41,16 @@ int test_libdw_getcfi(void)
return dwarf_getcfi(dwarf) == NULL;
}
+int test_elfutils(void)
+{
+ Dwarf_CFI *cfi = NULL;
+
+ dwarf_cfi_end(cfi);
+ return 0;
+}
+
int main(void)
{
return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() +
- test_libdw_getcfi();
+ test_libdw_getcfi() + test_elfutils();
}
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 78f34fa0c391..7434b38596b9 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1379,10 +1379,8 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
if (ret >= 0 && tf.pf.skip_empty_arg)
ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
-#if _ELFUTILS_PREREQ(0, 142)
dwarf_cfi_end(tf.pf.cfi_eh);
dwarf_cfi_end(tf.pf.cfi_dbg);
-#endif
if (ret < 0 || tf.ntevs == 0) {
for (i = 0; i < tf.ntevs; i++)
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 3add5ff516e1..f0149d72310c 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -63,12 +63,10 @@ struct probe_finder {
struct intlist *lcache; /* Line cache for lazy match */
/* For variable searching */
-#if _ELFUTILS_PREREQ(0, 142)
/* Call Frame Information from .eh_frame */
Dwarf_CFI *cfi_eh;
/* Call Frame Information from .debug_frame */
Dwarf_CFI *cfi_dbg;
-#endif
Dwarf_Op *fb_ops; /* Frame base attribute */
unsigned int machine; /* Target machine arch */
struct perf_probe_arg *pvar; /* Current target variable */
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check
2024-09-24 16:04 ` [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check Ian Rogers
@ 2024-09-26 0:29 ` Namhyung Kim
2024-09-26 15:08 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 0:29 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Sep 24, 2024 at 09:04:14AM -0700, Ian Rogers wrote:
> The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before
> 2009-06-13, but that is 15 years ago and very unlikely. Add a test to
> test-libdw.c and assume the libdw version is at least 0.142 to
> simplify the build logic.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/build/feature/test-libdw.c | 10 +++++++++-
> tools/perf/util/probe-finder.c | 2 --
> tools/perf/util/probe-finder.h | 2 --
> 3 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
> index 71c6f8e3b0ee..2fb59479ab77 100644
> --- a/tools/build/feature/test-libdw.c
> +++ b/tools/build/feature/test-libdw.c
> @@ -41,8 +41,16 @@ int test_libdw_getcfi(void)
> return dwarf_getcfi(dwarf) == NULL;
> }
>
> +int test_elfutils(void)
> +{
> + Dwarf_CFI *cfi = NULL;
> +
> + dwarf_cfi_end(cfi);
> + return 0;
> +}
I think it's the same as test_libdw_getcfi() and let's get rid of it.
Thanks,
Namhyung
> +
> int main(void)
> {
> return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() +
> - test_libdw_getcfi();
> + test_libdw_getcfi() + test_elfutils();
> }
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 78f34fa0c391..7434b38596b9 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1379,10 +1379,8 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
> if (ret >= 0 && tf.pf.skip_empty_arg)
> ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
>
> -#if _ELFUTILS_PREREQ(0, 142)
> dwarf_cfi_end(tf.pf.cfi_eh);
> dwarf_cfi_end(tf.pf.cfi_dbg);
> -#endif
>
> if (ret < 0 || tf.ntevs == 0) {
> for (i = 0; i < tf.ntevs; i++)
> diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
> index 3add5ff516e1..f0149d72310c 100644
> --- a/tools/perf/util/probe-finder.h
> +++ b/tools/perf/util/probe-finder.h
> @@ -63,12 +63,10 @@ struct probe_finder {
> struct intlist *lcache; /* Line cache for lazy match */
>
> /* For variable searching */
> -#if _ELFUTILS_PREREQ(0, 142)
> /* Call Frame Information from .eh_frame */
> Dwarf_CFI *cfi_eh;
> /* Call Frame Information from .debug_frame */
> Dwarf_CFI *cfi_dbg;
> -#endif
> Dwarf_Op *fb_ops; /* Frame base attribute */
> unsigned int machine; /* Target machine arch */
> struct perf_probe_arg *pvar; /* Current target variable */
> --
> 2.46.0.792.g87dc391469-goog
>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check
2024-09-26 0:29 ` Namhyung Kim
@ 2024-09-26 15:08 ` Ian Rogers
2024-09-26 19:35 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-26 15:08 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Sep 25, 2024 at 5:30 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Tue, Sep 24, 2024 at 09:04:14AM -0700, Ian Rogers wrote:
> > The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before
> > 2009-06-13, but that is 15 years ago and very unlikely. Add a test to
> > test-libdw.c and assume the libdw version is at least 0.142 to
> > simplify the build logic.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> > tools/build/feature/test-libdw.c | 10 +++++++++-
> > tools/perf/util/probe-finder.c | 2 --
> > tools/perf/util/probe-finder.h | 2 --
> > 3 files changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
> > index 71c6f8e3b0ee..2fb59479ab77 100644
> > --- a/tools/build/feature/test-libdw.c
> > +++ b/tools/build/feature/test-libdw.c
> > @@ -41,8 +41,16 @@ int test_libdw_getcfi(void)
> > return dwarf_getcfi(dwarf) == NULL;
> > }
> >
> > +int test_elfutils(void)
> > +{
> > + Dwarf_CFI *cfi = NULL;
> > +
> > + dwarf_cfi_end(cfi);
> > + return 0;
> > +}
>
> I think it's the same as test_libdw_getcfi() and let's get rid of it.
The point of doing the change this way, and I think what's being
ignored, is that I am trying to simply replace an #if with a clearly
equivalent feature test - clearly equivalent as the #if guards use of
dwarf_cfi_end in the code. Merging test_elfutils with
test_libdw_getcfi is another cognitive step and I think it is fine as
follow up cleanup. Combining that step with the change here fails the
minimal meaningful change and tbh I think this is just bike shedding.
Thanks,
Ian
> Thanks,
> Namhyung
>
> > +
> > int main(void)
> > {
> > return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() +
> > - test_libdw_getcfi();
> > + test_libdw_getcfi() + test_elfutils();
> > }
> > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> > index 78f34fa0c391..7434b38596b9 100644
> > --- a/tools/perf/util/probe-finder.c
> > +++ b/tools/perf/util/probe-finder.c
> > @@ -1379,10 +1379,8 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
> > if (ret >= 0 && tf.pf.skip_empty_arg)
> > ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
> >
> > -#if _ELFUTILS_PREREQ(0, 142)
> > dwarf_cfi_end(tf.pf.cfi_eh);
> > dwarf_cfi_end(tf.pf.cfi_dbg);
> > -#endif
> >
> > if (ret < 0 || tf.ntevs == 0) {
> > for (i = 0; i < tf.ntevs; i++)
> > diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
> > index 3add5ff516e1..f0149d72310c 100644
> > --- a/tools/perf/util/probe-finder.h
> > +++ b/tools/perf/util/probe-finder.h
> > @@ -63,12 +63,10 @@ struct probe_finder {
> > struct intlist *lcache; /* Line cache for lazy match */
> >
> > /* For variable searching */
> > -#if _ELFUTILS_PREREQ(0, 142)
> > /* Call Frame Information from .eh_frame */
> > Dwarf_CFI *cfi_eh;
> > /* Call Frame Information from .debug_frame */
> > Dwarf_CFI *cfi_dbg;
> > -#endif
> > Dwarf_Op *fb_ops; /* Frame base attribute */
> > unsigned int machine; /* Target machine arch */
> > struct perf_probe_arg *pvar; /* Current target variable */
> > --
> > 2.46.0.792.g87dc391469-goog
> >
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check
2024-09-26 15:08 ` Ian Rogers
@ 2024-09-26 19:35 ` Namhyung Kim
0 siblings, 0 replies; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 19:35 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 08:08:22AM -0700, Ian Rogers wrote:
> On Wed, Sep 25, 2024 at 5:30 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Tue, Sep 24, 2024 at 09:04:14AM -0700, Ian Rogers wrote:
> > > The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before
> > > 2009-06-13, but that is 15 years ago and very unlikely. Add a test to
> > > test-libdw.c and assume the libdw version is at least 0.142 to
> > > simplify the build logic.
> > >
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > > tools/build/feature/test-libdw.c | 10 +++++++++-
> > > tools/perf/util/probe-finder.c | 2 --
> > > tools/perf/util/probe-finder.h | 2 --
> > > 3 files changed, 9 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-libdw.c
> > > index 71c6f8e3b0ee..2fb59479ab77 100644
> > > --- a/tools/build/feature/test-libdw.c
> > > +++ b/tools/build/feature/test-libdw.c
> > > @@ -41,8 +41,16 @@ int test_libdw_getcfi(void)
> > > return dwarf_getcfi(dwarf) == NULL;
> > > }
> > >
> > > +int test_elfutils(void)
> > > +{
> > > + Dwarf_CFI *cfi = NULL;
> > > +
> > > + dwarf_cfi_end(cfi);
> > > + return 0;
> > > +}
> >
> > I think it's the same as test_libdw_getcfi() and let's get rid of it.
>
> The point of doing the change this way, and I think what's being
> ignored, is that I am trying to simply replace an #if with a clearly
> equivalent feature test - clearly equivalent as the #if guards use of
> dwarf_cfi_end in the code. Merging test_elfutils with
> test_libdw_getcfi is another cognitive step and I think it is fine as
> follow up cleanup. Combining that step with the change here fails the
> minimal meaningful change and tbh I think this is just bike shedding.
Ok, I think it's ok to have a separate commit to combine equivalent
tests if you really want to. What I want in the end is not to have
unnecessary or duplicate code.
In order to have a clearly equivalent feature test, I think you can add
#if !_ELFUTILS_PREREQ(0, 142)
#error "elfutils version is too old"
#endif
Thanks,
Namhyung
> >
> > > +
> > > int main(void)
> > > {
> > > return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() +
> > > - test_libdw_getcfi();
> > > + test_libdw_getcfi() + test_elfutils();
> > > }
> > > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> > > index 78f34fa0c391..7434b38596b9 100644
> > > --- a/tools/perf/util/probe-finder.c
> > > +++ b/tools/perf/util/probe-finder.c
> > > @@ -1379,10 +1379,8 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
> > > if (ret >= 0 && tf.pf.skip_empty_arg)
> > > ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
> > >
> > > -#if _ELFUTILS_PREREQ(0, 142)
> > > dwarf_cfi_end(tf.pf.cfi_eh);
> > > dwarf_cfi_end(tf.pf.cfi_dbg);
> > > -#endif
> > >
> > > if (ret < 0 || tf.ntevs == 0) {
> > > for (i = 0; i < tf.ntevs; i++)
> > > diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
> > > index 3add5ff516e1..f0149d72310c 100644
> > > --- a/tools/perf/util/probe-finder.h
> > > +++ b/tools/perf/util/probe-finder.h
> > > @@ -63,12 +63,10 @@ struct probe_finder {
> > > struct intlist *lcache; /* Line cache for lazy match */
> > >
> > > /* For variable searching */
> > > -#if _ELFUTILS_PREREQ(0, 142)
> > > /* Call Frame Information from .eh_frame */
> > > Dwarf_CFI *cfi_eh;
> > > /* Call Frame Information from .debug_frame */
> > > Dwarf_CFI *cfi_dbg;
> > > -#endif
> > > Dwarf_Op *fb_ops; /* Frame base attribute */
> > > unsigned int machine; /* Target machine arch */
> > > struct perf_probe_arg *pvar; /* Current target variable */
> > > --
> > > 2.46.0.792.g87dc391469-goog
> > >
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v1 08/11] perf libdw: Remove unnecessary defines
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (6 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 07/11] perf probe: Move elfutils support check to libdw check Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-29 2:10 ` Masami Hiramatsu
2024-09-24 16:04 ` [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT Ian Rogers
` (3 subsequent siblings)
11 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
As HAVE_DWARF_GETLOCATIONS_SUPPORT and HAVE_DWARF_CFI_SUPPORT always
match HAVE_DWARF_SUPPORT remove the macros and use
HAVE_DWARF_SUPPORT. If building the file is guarded by CONFIG_DWARF
then remove all ifs.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Documentation/perf-check.txt | 2 +-
tools/perf/Makefile.config | 3 --
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-check.c | 2 +-
tools/perf/builtin-report.c | 2 +-
tools/perf/util/dwarf-aux.c | 6 ---
tools/perf/util/dwarf-aux.h | 54 -------------------------
tools/perf/util/probe-finder.c | 4 --
8 files changed, 4 insertions(+), 71 deletions(-)
diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documentation/perf-check.txt
index 10f69fb6850b..45101a8e4154 100644
--- a/tools/perf/Documentation/perf-check.txt
+++ b/tools/perf/Documentation/perf-check.txt
@@ -48,7 +48,7 @@ feature::
bpf_skeletons / HAVE_BPF_SKEL
debuginfod / HAVE_DEBUGINFOD_SUPPORT
dwarf / HAVE_DWARF_SUPPORT
- dwarf_getlocations / HAVE_DWARF_GETLOCATIONS_SUPPORT
+ dwarf_getlocations / HAVE_DWARF_SUPPORT
dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT
auxtrace / HAVE_AUXTRACE_SUPPORT
libaudit / HAVE_LIBAUDIT_SUPPORT
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 9da0dc001d98..db79b25ada6f 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -463,9 +463,6 @@ else
$(warning No libdw.h found or old libdw.h found or elfutils is older than 0.157, disables dwarf support. Please install new elfutils-devel/libdw-dev)
NO_LIBDW := 1
endif
- else
- CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
- CFLAGS += -DHAVE_DWARF_CFI_SUPPORT
endif # Dwarf support
endif # libelf support
endif # NO_LIBELF
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 3dc6197ef3fa..04af13eb4a4c 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -840,7 +840,7 @@ int cmd_annotate(int argc, const char **argv)
}
#endif
-#ifndef HAVE_DWARF_GETLOCATIONS_SUPPORT
+#ifndef HAVE_DWARF_SUPPORT
if (annotate.data_type) {
pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
return -ENOTSUP;
diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c
index 0b76b6e42b78..18c0a815243b 100644
--- a/tools/perf/builtin-check.c
+++ b/tools/perf/builtin-check.c
@@ -28,7 +28,7 @@ struct feature_status supported_features[] = {
FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL),
FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT),
FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT),
- FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_GETLOCATIONS_SUPPORT),
+ FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT),
FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT),
FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT),
FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT),
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 5dc17ffee27a..426cbc9110d1 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1701,7 +1701,7 @@ int cmd_report(int argc, const char **argv)
report.data_type = true;
annotate_opts.annotate_src = false;
-#ifndef HAVE_DWARF_GETLOCATIONS_SUPPORT
+#ifndef HAVE_DWARF_SUPPORT
pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
goto error;
#endif
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index 92eb9c8dc3e5..559c953ca172 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -1182,7 +1182,6 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf)
return ret < 0 ? ret : strbuf_addf(buf, "\t%s", dwarf_diename(vr_die));
}
-#if defined(HAVE_DWARF_GETLOCATIONS_SUPPORT) || defined(HAVE_DWARF_CFI_SUPPORT)
static int reg_from_dwarf_op(Dwarf_Op *op)
{
switch (op->atom) {
@@ -1245,9 +1244,7 @@ static bool check_allowed_ops(Dwarf_Op *ops, size_t nops)
}
return true;
}
-#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT || HAVE_DWARF_CFI_SUPPORT */
-#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
/**
* die_get_var_innermost_scope - Get innermost scope range of given variable DIE
* @sp_die: a subprogram DIE
@@ -1697,9 +1694,7 @@ void die_collect_global_vars(Dwarf_Die *cu_die, struct die_var_type **var_types)
die_find_child(cu_die, __die_collect_global_vars_cb, (void *)var_types, &die_mem);
}
-#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
-#ifdef HAVE_DWARF_CFI_SUPPORT
/**
* die_get_cfa - Get frame base information
* @dwarf: a Dwarf info
@@ -1732,7 +1727,6 @@ int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset)
}
return -1;
}
-#endif /* HAVE_DWARF_CFI_SUPPORT */
/*
* die_has_loclist - Check if DW_AT_location of @vr_die is a location list
diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h
index 925a9bb9fb15..892c8c5c23fc 100644
--- a/tools/perf/util/dwarf-aux.h
+++ b/tools/perf/util/dwarf-aux.h
@@ -156,8 +156,6 @@ Dwarf_Die *die_get_member_type(Dwarf_Die *type_die, int offset, Dwarf_Die *die_m
/* Return type info where the pointer and offset point to */
Dwarf_Die *die_deref_ptr_type(Dwarf_Die *ptr_die, int offset, Dwarf_Die *die_mem);
-#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
-
/* Get byte offset range of given variable DIE */
int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf);
@@ -176,59 +174,7 @@ void die_collect_vars(Dwarf_Die *sc_die, struct die_var_type **var_types);
/* Save all global variables in this CU */
void die_collect_global_vars(Dwarf_Die *cu_die, struct die_var_type **var_types);
-#else /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
-#include <errno.h>
-
-static inline int die_get_var_range(Dwarf_Die *sp_die __maybe_unused,
- Dwarf_Die *vr_die __maybe_unused,
- struct strbuf *buf __maybe_unused)
-{
- return -ENOTSUP;
-}
-
-static inline Dwarf_Die *die_find_variable_by_reg(Dwarf_Die *sc_die __maybe_unused,
- Dwarf_Addr pc __maybe_unused,
- int reg __maybe_unused,
- int *poffset __maybe_unused,
- bool is_fbreg __maybe_unused,
- Dwarf_Die *die_mem __maybe_unused)
-{
- return NULL;
-}
-
-static inline Dwarf_Die *die_find_variable_by_addr(Dwarf_Die *sc_die __maybe_unused,
- Dwarf_Addr addr __maybe_unused,
- Dwarf_Die *die_mem __maybe_unused,
- int *offset __maybe_unused)
-{
- return NULL;
-}
-
-static inline void die_collect_vars(Dwarf_Die *sc_die __maybe_unused,
- struct die_var_type **var_types __maybe_unused)
-{
-}
-
-static inline void die_collect_global_vars(Dwarf_Die *cu_die __maybe_unused,
- struct die_var_type **var_types __maybe_unused)
-{
-}
-
-#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
-
-#ifdef HAVE_DWARF_CFI_SUPPORT
-
/* Get the frame base information from CFA */
int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset);
-#else /* HAVE_DWARF_CFI_SUPPORT */
-
-static inline int die_get_cfa(Dwarf *dwarf __maybe_unused, u64 pc __maybe_unused,
- int *preg __maybe_unused, int *poffset __maybe_unused)
-{
- return -1;
-}
-
-#endif /* HAVE_DWARF_CFI_SUPPORT */
-
#endif /* _DWARF_AUX_H */
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 7434b38596b9..8019d232f515 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -602,7 +602,6 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
if (ret <= 0 || nops == 0) {
pf->fb_ops = NULL;
-#ifdef HAVE_DWARF_CFI_SUPPORT
} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
(pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) {
if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 &&
@@ -613,7 +612,6 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
free(frame);
return -ENOENT;
}
-#endif /* HAVE_DWARF_CFI_SUPPORT */
}
/* Call finder's callback handler */
@@ -1138,7 +1136,6 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
pf->machine = ehdr.e_machine;
-#ifdef HAVE_DWARF_CFI_SUPPORT
do {
GElf_Shdr shdr;
@@ -1148,7 +1145,6 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
pf->cfi_dbg = dwarf_getcfi(dbg->dbg);
} while (0);
-#endif /* HAVE_DWARF_CFI_SUPPORT */
ret = debuginfo__find_probe_location(dbg, pf);
return ret;
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 08/11] perf libdw: Remove unnecessary defines
2024-09-24 16:04 ` [PATCH v1 08/11] perf libdw: Remove unnecessary defines Ian Rogers
@ 2024-09-29 2:10 ` Masami Hiramatsu
0 siblings, 0 replies; 51+ messages in thread
From: Masami Hiramatsu @ 2024-09-29 2:10 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, Kan Liang, John Garry, Will Deacon, James Clark,
Mike Leach, Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Nick Terrell, Guilherme Amadio, Changbin Du,
Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, 24 Sep 2024 09:04:15 -0700
Ian Rogers <irogers@google.com> wrote:
> As HAVE_DWARF_GETLOCATIONS_SUPPORT and HAVE_DWARF_CFI_SUPPORT always
> match HAVE_DWARF_SUPPORT remove the macros and use
> HAVE_DWARF_SUPPORT. If building the file is guarded by CONFIG_DWARF
> then remove all ifs.
Thanks for the cleanups!
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/Documentation/perf-check.txt | 2 +-
> tools/perf/Makefile.config | 3 --
> tools/perf/builtin-annotate.c | 2 +-
> tools/perf/builtin-check.c | 2 +-
> tools/perf/builtin-report.c | 2 +-
> tools/perf/util/dwarf-aux.c | 6 ---
> tools/perf/util/dwarf-aux.h | 54 -------------------------
> tools/perf/util/probe-finder.c | 4 --
> 8 files changed, 4 insertions(+), 71 deletions(-)
>
> diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documentation/perf-check.txt
> index 10f69fb6850b..45101a8e4154 100644
> --- a/tools/perf/Documentation/perf-check.txt
> +++ b/tools/perf/Documentation/perf-check.txt
> @@ -48,7 +48,7 @@ feature::
> bpf_skeletons / HAVE_BPF_SKEL
> debuginfod / HAVE_DEBUGINFOD_SUPPORT
> dwarf / HAVE_DWARF_SUPPORT
> - dwarf_getlocations / HAVE_DWARF_GETLOCATIONS_SUPPORT
> + dwarf_getlocations / HAVE_DWARF_SUPPORT
nit: BTW, I think we can remove this feature itself now.
Thank you,
> dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT
> auxtrace / HAVE_AUXTRACE_SUPPORT
> libaudit / HAVE_LIBAUDIT_SUPPORT
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 9da0dc001d98..db79b25ada6f 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -463,9 +463,6 @@ else
> $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.157, disables dwarf support. Please install new elfutils-devel/libdw-dev)
> NO_LIBDW := 1
> endif
> - else
> - CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT
> - CFLAGS += -DHAVE_DWARF_CFI_SUPPORT
> endif # Dwarf support
> endif # libelf support
> endif # NO_LIBELF
> diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
> index 3dc6197ef3fa..04af13eb4a4c 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -840,7 +840,7 @@ int cmd_annotate(int argc, const char **argv)
> }
> #endif
>
> -#ifndef HAVE_DWARF_GETLOCATIONS_SUPPORT
> +#ifndef HAVE_DWARF_SUPPORT
> if (annotate.data_type) {
> pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
> return -ENOTSUP;
> diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c
> index 0b76b6e42b78..18c0a815243b 100644
> --- a/tools/perf/builtin-check.c
> +++ b/tools/perf/builtin-check.c
> @@ -28,7 +28,7 @@ struct feature_status supported_features[] = {
> FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL),
> FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT),
> FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT),
> - FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_GETLOCATIONS_SUPPORT),
> + FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT),
> FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT),
> FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT),
> FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT),
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 5dc17ffee27a..426cbc9110d1 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -1701,7 +1701,7 @@ int cmd_report(int argc, const char **argv)
> report.data_type = true;
> annotate_opts.annotate_src = false;
>
> -#ifndef HAVE_DWARF_GETLOCATIONS_SUPPORT
> +#ifndef HAVE_DWARF_SUPPORT
> pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
> goto error;
> #endif
> diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> index 92eb9c8dc3e5..559c953ca172 100644
> --- a/tools/perf/util/dwarf-aux.c
> +++ b/tools/perf/util/dwarf-aux.c
> @@ -1182,7 +1182,6 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf)
> return ret < 0 ? ret : strbuf_addf(buf, "\t%s", dwarf_diename(vr_die));
> }
>
> -#if defined(HAVE_DWARF_GETLOCATIONS_SUPPORT) || defined(HAVE_DWARF_CFI_SUPPORT)
> static int reg_from_dwarf_op(Dwarf_Op *op)
> {
> switch (op->atom) {
> @@ -1245,9 +1244,7 @@ static bool check_allowed_ops(Dwarf_Op *ops, size_t nops)
> }
> return true;
> }
> -#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT || HAVE_DWARF_CFI_SUPPORT */
>
> -#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
> /**
> * die_get_var_innermost_scope - Get innermost scope range of given variable DIE
> * @sp_die: a subprogram DIE
> @@ -1697,9 +1694,7 @@ void die_collect_global_vars(Dwarf_Die *cu_die, struct die_var_type **var_types)
>
> die_find_child(cu_die, __die_collect_global_vars_cb, (void *)var_types, &die_mem);
> }
> -#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
>
> -#ifdef HAVE_DWARF_CFI_SUPPORT
> /**
> * die_get_cfa - Get frame base information
> * @dwarf: a Dwarf info
> @@ -1732,7 +1727,6 @@ int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset)
> }
> return -1;
> }
> -#endif /* HAVE_DWARF_CFI_SUPPORT */
>
> /*
> * die_has_loclist - Check if DW_AT_location of @vr_die is a location list
> diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h
> index 925a9bb9fb15..892c8c5c23fc 100644
> --- a/tools/perf/util/dwarf-aux.h
> +++ b/tools/perf/util/dwarf-aux.h
> @@ -156,8 +156,6 @@ Dwarf_Die *die_get_member_type(Dwarf_Die *type_die, int offset, Dwarf_Die *die_m
> /* Return type info where the pointer and offset point to */
> Dwarf_Die *die_deref_ptr_type(Dwarf_Die *ptr_die, int offset, Dwarf_Die *die_mem);
>
> -#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
> -
> /* Get byte offset range of given variable DIE */
> int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf);
>
> @@ -176,59 +174,7 @@ void die_collect_vars(Dwarf_Die *sc_die, struct die_var_type **var_types);
> /* Save all global variables in this CU */
> void die_collect_global_vars(Dwarf_Die *cu_die, struct die_var_type **var_types);
>
> -#else /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
> -#include <errno.h>
> -
> -static inline int die_get_var_range(Dwarf_Die *sp_die __maybe_unused,
> - Dwarf_Die *vr_die __maybe_unused,
> - struct strbuf *buf __maybe_unused)
> -{
> - return -ENOTSUP;
> -}
> -
> -static inline Dwarf_Die *die_find_variable_by_reg(Dwarf_Die *sc_die __maybe_unused,
> - Dwarf_Addr pc __maybe_unused,
> - int reg __maybe_unused,
> - int *poffset __maybe_unused,
> - bool is_fbreg __maybe_unused,
> - Dwarf_Die *die_mem __maybe_unused)
> -{
> - return NULL;
> -}
> -
> -static inline Dwarf_Die *die_find_variable_by_addr(Dwarf_Die *sc_die __maybe_unused,
> - Dwarf_Addr addr __maybe_unused,
> - Dwarf_Die *die_mem __maybe_unused,
> - int *offset __maybe_unused)
> -{
> - return NULL;
> -}
> -
> -static inline void die_collect_vars(Dwarf_Die *sc_die __maybe_unused,
> - struct die_var_type **var_types __maybe_unused)
> -{
> -}
> -
> -static inline void die_collect_global_vars(Dwarf_Die *cu_die __maybe_unused,
> - struct die_var_type **var_types __maybe_unused)
> -{
> -}
> -
> -#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
> -
> -#ifdef HAVE_DWARF_CFI_SUPPORT
> -
> /* Get the frame base information from CFA */
> int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset);
>
> -#else /* HAVE_DWARF_CFI_SUPPORT */
> -
> -static inline int die_get_cfa(Dwarf *dwarf __maybe_unused, u64 pc __maybe_unused,
> - int *preg __maybe_unused, int *poffset __maybe_unused)
> -{
> - return -1;
> -}
> -
> -#endif /* HAVE_DWARF_CFI_SUPPORT */
> -
> #endif /* _DWARF_AUX_H */
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 7434b38596b9..8019d232f515 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -602,7 +602,6 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
> ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
> if (ret <= 0 || nops == 0) {
> pf->fb_ops = NULL;
> -#ifdef HAVE_DWARF_CFI_SUPPORT
> } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
> (pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) {
> if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 &&
> @@ -613,7 +612,6 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
> free(frame);
> return -ENOENT;
> }
> -#endif /* HAVE_DWARF_CFI_SUPPORT */
> }
>
> /* Call finder's callback handler */
> @@ -1138,7 +1136,6 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
>
> pf->machine = ehdr.e_machine;
>
> -#ifdef HAVE_DWARF_CFI_SUPPORT
> do {
> GElf_Shdr shdr;
>
> @@ -1148,7 +1145,6 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
>
> pf->cfi_dbg = dwarf_getcfi(dbg->dbg);
> } while (0);
> -#endif /* HAVE_DWARF_CFI_SUPPORT */
>
> ret = debuginfo__find_probe_location(dbg, pf);
> return ret;
> --
> 2.46.0.792.g87dc391469-goog
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (7 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 08/11] perf libdw: Remove unnecessary defines Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-26 0:34 ` Namhyung Kim
2024-09-24 16:04 ` [PATCH v1 10/11] perf build: Rename CONFIG_DWARF to CONFIG_LIBDW Ian Rogers
` (2 subsequent siblings)
11 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
In Makefile.config for unwinding the name dwarf implies either
libunwind or libdw. Make it clearer that HAVE_DWARF_SUPPORT is really
just defined when libdw is present by renaming to HAVE_LIBDW_SUPPORT.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Documentation/perf-check.txt | 6 +++---
tools/perf/Makefile.config | 2 +-
tools/perf/arch/powerpc/annotate/instructions.c | 4 ++--
tools/perf/arch/x86/annotate/instructions.c | 2 +-
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-check.c | 6 +++---
tools/perf/builtin-probe.c | 12 ++++++------
tools/perf/builtin-report.c | 4 ++--
tools/perf/util/annotate-data.h | 8 ++++----
tools/perf/util/debuginfo.h | 6 +++---
tools/perf/util/disasm.c | 4 ++--
tools/perf/util/disasm.h | 4 ++--
tools/perf/util/genelf.c | 4 ++--
tools/perf/util/genelf.h | 2 +-
tools/perf/util/include/dwarf-regs.h | 6 +++---
tools/perf/util/probe-event.c | 4 ++--
tools/perf/util/probe-finder.h | 4 ++--
17 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documentation/perf-check.txt
index 45101a8e4154..31741499e786 100644
--- a/tools/perf/Documentation/perf-check.txt
+++ b/tools/perf/Documentation/perf-check.txt
@@ -47,15 +47,15 @@ feature::
bpf / HAVE_LIBBPF_SUPPORT
bpf_skeletons / HAVE_BPF_SKEL
debuginfod / HAVE_DEBUGINFOD_SUPPORT
- dwarf / HAVE_DWARF_SUPPORT
- dwarf_getlocations / HAVE_DWARF_SUPPORT
+ dwarf / HAVE_LIBDW_SUPPORT
+ dwarf_getlocations / HAVE_LIBDW_SUPPORT
dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT
auxtrace / HAVE_AUXTRACE_SUPPORT
libaudit / HAVE_LIBAUDIT_SUPPORT
libbfd / HAVE_LIBBFD_SUPPORT
libcapstone / HAVE_LIBCAPSTONE_SUPPORT
libcrypto / HAVE_LIBCRYPTO_SUPPORT
- libdw-dwarf-unwind / HAVE_DWARF_SUPPORT
+ libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT
libelf / HAVE_LIBELF_SUPPORT
libnuma / HAVE_LIBNUMA_SUPPORT
libopencsd / HAVE_CSTRACE_SUPPORT
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index db79b25ada6f..9ed0909db170 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -556,7 +556,7 @@ ifndef NO_LIBELF
$(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
NO_LIBDW := 1
else
- CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
+ CFLAGS += -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += ${DWARFLIBS}
$(call detected,CONFIG_DWARF)
diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c
index ede9eeade0ab..54478cf5cccc 100644
--- a/tools/perf/arch/powerpc/annotate/instructions.c
+++ b/tools/perf/arch/powerpc/annotate/instructions.c
@@ -255,7 +255,7 @@ static struct ins_ops *check_ppc_insn(struct disasm_line *dl)
* is moved to r31. update_insn_state_powerpc tracks these state
* changes
*/
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
static void update_insn_state_powerpc(struct type_state *state,
struct data_loc_info *dloc, Dwarf_Die * cu_die __maybe_unused,
struct disasm_line *dl)
@@ -300,7 +300,7 @@ static void update_insn_state_powerpc(struct type_state *state,
insn_offset, src->reg1, dst->reg1);
pr_debug_type_name(&tsr->type, tsr->kind);
}
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
{
diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c
index 5caf5a17f03d..c869abe3c31d 100644
--- a/tools/perf/arch/x86/annotate/instructions.c
+++ b/tools/perf/arch/x86/annotate/instructions.c
@@ -207,7 +207,7 @@ static int x86__annotate_init(struct arch *arch, char *cpuid)
return err;
}
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
static void update_insn_state_x86(struct type_state *state,
struct data_loc_info *dloc, Dwarf_Die *cu_die,
struct disasm_line *dl)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 04af13eb4a4c..bb87e6e7687d 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -840,7 +840,7 @@ int cmd_annotate(int argc, const char **argv)
}
#endif
-#ifndef HAVE_DWARF_SUPPORT
+#ifndef HAVE_LIBDW_SUPPORT
if (annotate.data_type) {
pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
return -ENOTSUP;
diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c
index 18c0a815243b..2346536a5ee1 100644
--- a/tools/perf/builtin-check.c
+++ b/tools/perf/builtin-check.c
@@ -27,15 +27,15 @@ struct feature_status supported_features[] = {
FEATURE_STATUS("bpf", HAVE_LIBBPF_SUPPORT),
FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL),
FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT),
- FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT),
- FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT),
+ FEATURE_STATUS("dwarf", HAVE_LIBDW_SUPPORT),
+ FEATURE_STATUS("dwarf_getlocations", HAVE_LIBDW_SUPPORT),
FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT),
FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT),
FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT),
FEATURE_STATUS("libbfd", HAVE_LIBBFD_SUPPORT),
FEATURE_STATUS("libcapstone", HAVE_LIBCAPSTONE_SUPPORT),
FEATURE_STATUS("libcrypto", HAVE_LIBCRYPTO_SUPPORT),
- FEATURE_STATUS("libdw-dwarf-unwind", HAVE_DWARF_SUPPORT),
+ FEATURE_STATUS("libdw-dwarf-unwind", HAVE_LIBDW_SUPPORT),
FEATURE_STATUS("libelf", HAVE_LIBELF_SUPPORT),
FEATURE_STATUS("libnuma", HAVE_LIBNUMA_SUPPORT),
FEATURE_STATUS("libopencsd", HAVE_CSTRACE_SUPPORT),
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 91672bb3047c..69800e4d9530 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -229,7 +229,7 @@ static int opt_set_target_ns(const struct option *opt __maybe_unused,
/* Command option callbacks */
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
static int opt_show_lines(const struct option *opt,
const char *str, int unset __maybe_unused)
{
@@ -505,7 +505,7 @@ static int perf_del_probe_events(struct strfilter *filter)
return ret;
}
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
#define PROBEDEF_STR \
"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT [[NAME=]ARG ...]"
#else
@@ -521,7 +521,7 @@ __cmd_probe(int argc, const char **argv)
"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
"perf probe [<options>] --del '[GROUP:]EVENT' ...",
"perf probe --list [GROUP:]EVENT ...",
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
"perf probe [<options>] --line 'LINEDESC'",
"perf probe [<options>] --vars 'PROBEPOINT'",
#endif
@@ -545,7 +545,7 @@ __cmd_probe(int argc, const char **argv)
"\t\tFUNC:\tFunction name\n"
"\t\tOFF:\tOffset from function entry (in byte)\n"
"\t\t%return:\tPut the probe at function return\n"
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
"\t\tSRC:\tSource code path\n"
"\t\tRL:\tRelative line number from function entry.\n"
"\t\tAL:\tAbsolute line number in file.\n"
@@ -612,7 +612,7 @@ __cmd_probe(int argc, const char **argv)
set_option_flag(options, 'd', "del", PARSE_OPT_EXCLUSIVE);
set_option_flag(options, 'D', "definition", PARSE_OPT_EXCLUSIVE);
set_option_flag(options, 'l', "list", PARSE_OPT_EXCLUSIVE);
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE);
set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE);
#else
@@ -694,7 +694,7 @@ __cmd_probe(int argc, const char **argv)
if (ret < 0)
pr_err_with_code(" Error: Failed to show functions.", ret);
return ret;
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
case 'L':
ret = show_line_range(¶ms->line_range, params->target,
params->nsi, params->uprobes);
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 426cbc9110d1..13cc57e99d35 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -455,7 +455,7 @@ static int report__setup_sample_type(struct report *rep)
if (!(evlist__combined_branch_type(session->evlist) & PERF_SAMPLE_BRANCH_ANY))
rep->nonany_branch_mode = true;
-#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT)
+#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_LIBDW_SUPPORT)
if (dwarf_callchain_users) {
ui__warning("Please install libunwind or libdw "
"development packages during the perf build.\n");
@@ -1701,7 +1701,7 @@ int cmd_report(int argc, const char **argv)
report.data_type = true;
annotate_opts.annotate_src = false;
-#ifndef HAVE_DWARF_SUPPORT
+#ifndef HAVE_LIBDW_SUPPORT
pr_err("Error: Data type profiling is disabled due to missing DWARF support\n");
goto error;
#endif
diff --git a/tools/perf/util/annotate-data.h b/tools/perf/util/annotate-data.h
index 8ac0fd94a0ba..98c80b2268dd 100644
--- a/tools/perf/util/annotate-data.h
+++ b/tools/perf/util/annotate-data.h
@@ -9,7 +9,7 @@
#include "dwarf-regs.h"
#include "annotate.h"
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
#include "debuginfo.h"
#endif
@@ -165,7 +165,7 @@ struct annotated_data_stat {
};
extern struct annotated_data_stat ann_data_stat;
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
/*
* Type information in a register, valid when @ok is true.
* The @caller_saved registers are invalidated after a function call.
@@ -244,7 +244,7 @@ bool get_global_var_info(struct data_loc_info *dloc, u64 addr,
const char **var_name, int *var_offset);
void pr_debug_type_name(Dwarf_Die *die, enum type_state_kind kind);
-#else /* HAVE_DWARF_SUPPORT */
+#else /* HAVE_LIBDW_SUPPORT */
static inline struct annotated_data_type *
find_data_type(struct data_loc_info *dloc __maybe_unused)
@@ -276,7 +276,7 @@ static inline int hist_entry__annotate_data_tty(struct hist_entry *he __maybe_un
return -1;
}
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
#ifdef HAVE_SLANG_SUPPORT
int hist_entry__annotate_data_tui(struct hist_entry *he, struct evsel *evsel,
diff --git a/tools/perf/util/debuginfo.h b/tools/perf/util/debuginfo.h
index ad6422c3f8ca..a52d69932815 100644
--- a/tools/perf/util/debuginfo.h
+++ b/tools/perf/util/debuginfo.h
@@ -5,7 +5,7 @@
#include <errno.h>
#include <linux/compiler.h>
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
#include "dwarf-aux.h"
@@ -25,7 +25,7 @@ void debuginfo__delete(struct debuginfo *dbg);
int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs,
bool adjust_offset);
-#else /* HAVE_DWARF_SUPPORT */
+#else /* HAVE_LIBDW_SUPPORT */
/* dummy debug information structure */
struct debuginfo {
@@ -49,7 +49,7 @@ static inline int debuginfo__get_text_offset(struct debuginfo *dbg __maybe_unuse
return -EINVAL;
}
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
#ifdef HAVE_DEBUGINFOD_SUPPORT
int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id,
diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
index 2c8063660f2e..aef06a36bf40 100644
--- a/tools/perf/util/disasm.c
+++ b/tools/perf/util/disasm.c
@@ -151,14 +151,14 @@ static struct arch architectures[] = {
.memory_ref_char = '(',
.imm_char = '$',
},
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
.update_insn_state = update_insn_state_x86,
#endif
},
{
.name = "powerpc",
.init = powerpc__annotate_init,
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
.update_insn_state = update_insn_state_powerpc,
#endif
},
diff --git a/tools/perf/util/disasm.h b/tools/perf/util/disasm.h
index f56beedeb9da..486c269b29ba 100644
--- a/tools/perf/util/disasm.h
+++ b/tools/perf/util/disasm.h
@@ -4,7 +4,7 @@
#include "map_symbol.h"
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
#include "dwarf-aux.h"
#endif
@@ -39,7 +39,7 @@ struct arch {
char memory_ref_char;
char imm_char;
} objdump;
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
void (*update_insn_state)(struct type_state *state,
struct data_loc_info *dloc, Dwarf_Die *cu_die,
struct disasm_line *dl);
diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c
index c8f6bee1fa61..cdce7f173d00 100644
--- a/tools/perf/util/genelf.c
+++ b/tools/perf/util/genelf.c
@@ -16,7 +16,7 @@
#include <inttypes.h>
#include <fcntl.h>
#include <err.h>
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
#include <dwarf.h>
#endif
@@ -499,7 +499,7 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym,
shdr->sh_size = sizeof(bnote);
shdr->sh_entsize = 0;
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
if (debug && nr_debug_entries) {
retval = jit_add_debug_info(e, load_addr, debug, nr_debug_entries);
if (retval)
diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h
index 4e2e4f40e134..9f0b875d6548 100644
--- a/tools/perf/util/genelf.h
+++ b/tools/perf/util/genelf.h
@@ -8,7 +8,7 @@
int jit_write_elf(int fd, uint64_t code_addr, const char *sym,
const void *code, int csize, void *debug, int nr_debug_entries,
void *unwinding, uint64_t unwinding_header_size, uint64_t unwinding_size);
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
/* genelf_debug.c */
int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_entries);
#endif
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index 75b28dcc8317..29a7d0546b82 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -6,7 +6,7 @@
#define DWARF_REG_PC 0xd3af9c /* random number */
#define DWARF_REG_FB 0xd3affb /* random number */
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
const char *get_arch_regstr(unsigned int n);
/*
* get_dwarf_regstr - Returns ftrace register string from DWARF regnum
@@ -23,7 +23,7 @@ int get_arch_regnum(const char *name);
*/
int get_dwarf_regnum(const char *name, unsigned int machine);
-#else /* HAVE_DWARF_SUPPORT */
+#else /* HAVE_LIBDW_SUPPORT */
static inline int get_dwarf_regnum(const char *name __maybe_unused,
unsigned int machine __maybe_unused)
@@ -32,7 +32,7 @@ static inline int get_dwarf_regnum(const char *name __maybe_unused,
}
#endif
-#if !defined(__powerpc__) || !defined(HAVE_DWARF_SUPPORT)
+#if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT)
static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_source __maybe_unused,
struct annotated_op_loc *op_loc __maybe_unused)
{
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index a17c9b8a7a79..fd94614a4022 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -342,7 +342,7 @@ static char *find_module_name(const char *module)
return mod_name;
}
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
static int kernel_get_module_dso(const char *module, struct dso **pdso)
{
@@ -1250,7 +1250,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
return ret;
}
-#else /* !HAVE_DWARF_SUPPORT */
+#else /* !HAVE_LIBDW_SUPPORT */
static void debuginfo_cache__exit(void)
{
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index f0149d72310c..b9a5afca4cc1 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -21,7 +21,7 @@ static inline int is_c_varname(const char *name)
return isalpha(name[0]) || name[0] == '_';
}
-#ifdef HAVE_DWARF_SUPPORT
+#ifdef HAVE_LIBDW_SUPPORT
#include "dwarf-aux.h"
#include "debuginfo.h"
@@ -102,6 +102,6 @@ struct line_finder {
int found;
};
-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* HAVE_LIBDW_SUPPORT */
#endif /*_PROBE_FINDER_H */
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT
2024-09-24 16:04 ` [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT Ian Rogers
@ 2024-09-26 0:34 ` Namhyung Kim
2024-09-26 15:10 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 0:34 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Sep 24, 2024 at 09:04:16AM -0700, Ian Rogers wrote:
> In Makefile.config for unwinding the name dwarf implies either
> libunwind or libdw. Make it clearer that HAVE_DWARF_SUPPORT is really
> just defined when libdw is present by renaming to HAVE_LIBDW_SUPPORT.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/Documentation/perf-check.txt | 6 +++---
> tools/perf/Makefile.config | 2 +-
> tools/perf/arch/powerpc/annotate/instructions.c | 4 ++--
> tools/perf/arch/x86/annotate/instructions.c | 2 +-
> tools/perf/builtin-annotate.c | 2 +-
> tools/perf/builtin-check.c | 6 +++---
> tools/perf/builtin-probe.c | 12 ++++++------
> tools/perf/builtin-report.c | 4 ++--
> tools/perf/util/annotate-data.h | 8 ++++----
> tools/perf/util/debuginfo.h | 6 +++---
> tools/perf/util/disasm.c | 4 ++--
> tools/perf/util/disasm.h | 4 ++--
> tools/perf/util/genelf.c | 4 ++--
> tools/perf/util/genelf.h | 2 +-
> tools/perf/util/include/dwarf-regs.h | 6 +++---
> tools/perf/util/probe-event.c | 4 ++--
> tools/perf/util/probe-finder.h | 4 ++--
> 17 files changed, 40 insertions(+), 40 deletions(-)
>
> diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documentation/perf-check.txt
> index 45101a8e4154..31741499e786 100644
> --- a/tools/perf/Documentation/perf-check.txt
> +++ b/tools/perf/Documentation/perf-check.txt
> @@ -47,15 +47,15 @@ feature::
> bpf / HAVE_LIBBPF_SUPPORT
> bpf_skeletons / HAVE_BPF_SKEL
> debuginfod / HAVE_DEBUGINFOD_SUPPORT
> - dwarf / HAVE_DWARF_SUPPORT
> - dwarf_getlocations / HAVE_DWARF_SUPPORT
> + dwarf / HAVE_LIBDW_SUPPORT
> + dwarf_getlocations / HAVE_LIBDW_SUPPORT
I'm not sure if we really want to display dwarf_getlocatiosn as it's too
implementation detail IMHO. Maybe just 'dwarf' or 'libdw' is enough.
Thanks,
Namhyung
> dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT
> auxtrace / HAVE_AUXTRACE_SUPPORT
> libaudit / HAVE_LIBAUDIT_SUPPORT
> libbfd / HAVE_LIBBFD_SUPPORT
> libcapstone / HAVE_LIBCAPSTONE_SUPPORT
> libcrypto / HAVE_LIBCRYPTO_SUPPORT
> - libdw-dwarf-unwind / HAVE_DWARF_SUPPORT
> + libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT
> libelf / HAVE_LIBELF_SUPPORT
> libnuma / HAVE_LIBNUMA_SUPPORT
> libopencsd / HAVE_CSTRACE_SUPPORT
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT
2024-09-26 0:34 ` Namhyung Kim
@ 2024-09-26 15:10 ` Ian Rogers
2024-09-26 19:36 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-26 15:10 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Sep 25, 2024 at 5:34 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Tue, Sep 24, 2024 at 09:04:16AM -0700, Ian Rogers wrote:
> > In Makefile.config for unwinding the name dwarf implies either
> > libunwind or libdw. Make it clearer that HAVE_DWARF_SUPPORT is really
> > just defined when libdw is present by renaming to HAVE_LIBDW_SUPPORT.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> > tools/perf/Documentation/perf-check.txt | 6 +++---
> > tools/perf/Makefile.config | 2 +-
> > tools/perf/arch/powerpc/annotate/instructions.c | 4 ++--
> > tools/perf/arch/x86/annotate/instructions.c | 2 +-
> > tools/perf/builtin-annotate.c | 2 +-
> > tools/perf/builtin-check.c | 6 +++---
> > tools/perf/builtin-probe.c | 12 ++++++------
> > tools/perf/builtin-report.c | 4 ++--
> > tools/perf/util/annotate-data.h | 8 ++++----
> > tools/perf/util/debuginfo.h | 6 +++---
> > tools/perf/util/disasm.c | 4 ++--
> > tools/perf/util/disasm.h | 4 ++--
> > tools/perf/util/genelf.c | 4 ++--
> > tools/perf/util/genelf.h | 2 +-
> > tools/perf/util/include/dwarf-regs.h | 6 +++---
> > tools/perf/util/probe-event.c | 4 ++--
> > tools/perf/util/probe-finder.h | 4 ++--
> > 17 files changed, 40 insertions(+), 40 deletions(-)
> >
> > diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documentation/perf-check.txt
> > index 45101a8e4154..31741499e786 100644
> > --- a/tools/perf/Documentation/perf-check.txt
> > +++ b/tools/perf/Documentation/perf-check.txt
> > @@ -47,15 +47,15 @@ feature::
> > bpf / HAVE_LIBBPF_SUPPORT
> > bpf_skeletons / HAVE_BPF_SKEL
> > debuginfod / HAVE_DEBUGINFOD_SUPPORT
> > - dwarf / HAVE_DWARF_SUPPORT
> > - dwarf_getlocations / HAVE_DWARF_SUPPORT
> > + dwarf / HAVE_LIBDW_SUPPORT
> > + dwarf_getlocations / HAVE_LIBDW_SUPPORT
>
> I'm not sure if we really want to display dwarf_getlocatiosn as it's too
> implementation detail IMHO. Maybe just 'dwarf' or 'libdw' is enough.
I think that's follow up work. I think we should rename dwarf to libdw
given the confusion using dwarf here can create.
Thanks,
Ian
> Thanks,
> Namhyung
>
>
> > dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT
> > auxtrace / HAVE_AUXTRACE_SUPPORT
> > libaudit / HAVE_LIBAUDIT_SUPPORT
> > libbfd / HAVE_LIBBFD_SUPPORT
> > libcapstone / HAVE_LIBCAPSTONE_SUPPORT
> > libcrypto / HAVE_LIBCRYPTO_SUPPORT
> > - libdw-dwarf-unwind / HAVE_DWARF_SUPPORT
> > + libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT
> > libelf / HAVE_LIBELF_SUPPORT
> > libnuma / HAVE_LIBNUMA_SUPPORT
> > libopencsd / HAVE_CSTRACE_SUPPORT
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT
2024-09-26 15:10 ` Ian Rogers
@ 2024-09-26 19:36 ` Namhyung Kim
0 siblings, 0 replies; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 19:36 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 08:10:04AM -0700, Ian Rogers wrote:
> On Wed, Sep 25, 2024 at 5:34 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Tue, Sep 24, 2024 at 09:04:16AM -0700, Ian Rogers wrote:
> > > In Makefile.config for unwinding the name dwarf implies either
> > > libunwind or libdw. Make it clearer that HAVE_DWARF_SUPPORT is really
> > > just defined when libdw is present by renaming to HAVE_LIBDW_SUPPORT.
> > >
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > > tools/perf/Documentation/perf-check.txt | 6 +++---
> > > tools/perf/Makefile.config | 2 +-
> > > tools/perf/arch/powerpc/annotate/instructions.c | 4 ++--
> > > tools/perf/arch/x86/annotate/instructions.c | 2 +-
> > > tools/perf/builtin-annotate.c | 2 +-
> > > tools/perf/builtin-check.c | 6 +++---
> > > tools/perf/builtin-probe.c | 12 ++++++------
> > > tools/perf/builtin-report.c | 4 ++--
> > > tools/perf/util/annotate-data.h | 8 ++++----
> > > tools/perf/util/debuginfo.h | 6 +++---
> > > tools/perf/util/disasm.c | 4 ++--
> > > tools/perf/util/disasm.h | 4 ++--
> > > tools/perf/util/genelf.c | 4 ++--
> > > tools/perf/util/genelf.h | 2 +-
> > > tools/perf/util/include/dwarf-regs.h | 6 +++---
> > > tools/perf/util/probe-event.c | 4 ++--
> > > tools/perf/util/probe-finder.h | 4 ++--
> > > 17 files changed, 40 insertions(+), 40 deletions(-)
> > >
> > > diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documentation/perf-check.txt
> > > index 45101a8e4154..31741499e786 100644
> > > --- a/tools/perf/Documentation/perf-check.txt
> > > +++ b/tools/perf/Documentation/perf-check.txt
> > > @@ -47,15 +47,15 @@ feature::
> > > bpf / HAVE_LIBBPF_SUPPORT
> > > bpf_skeletons / HAVE_BPF_SKEL
> > > debuginfod / HAVE_DEBUGINFOD_SUPPORT
> > > - dwarf / HAVE_DWARF_SUPPORT
> > > - dwarf_getlocations / HAVE_DWARF_SUPPORT
> > > + dwarf / HAVE_LIBDW_SUPPORT
> > > + dwarf_getlocations / HAVE_LIBDW_SUPPORT
> >
> > I'm not sure if we really want to display dwarf_getlocatiosn as it's too
> > implementation detail IMHO. Maybe just 'dwarf' or 'libdw' is enough.
>
> I think that's follow up work. I think we should rename dwarf to libdw
> given the confusion using dwarf here can create.
Ok, agreed.
Thanks,
Namhyung
> >
> > > dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT
> > > auxtrace / HAVE_AUXTRACE_SUPPORT
> > > libaudit / HAVE_LIBAUDIT_SUPPORT
> > > libbfd / HAVE_LIBBFD_SUPPORT
> > > libcapstone / HAVE_LIBCAPSTONE_SUPPORT
> > > libcrypto / HAVE_LIBCRYPTO_SUPPORT
> > > - libdw-dwarf-unwind / HAVE_DWARF_SUPPORT
> > > + libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT
> > > libelf / HAVE_LIBELF_SUPPORT
> > > libnuma / HAVE_LIBNUMA_SUPPORT
> > > libopencsd / HAVE_CSTRACE_SUPPORT
^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v1 10/11] perf build: Rename CONFIG_DWARF to CONFIG_LIBDW
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (8 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 09/11] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-24 16:04 ` [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS Ian Rogers
2024-09-24 19:44 ` [PATCH v1 00/11] Libdw/dwarf build clean up Leo Yan
11 siblings, 0 replies; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
In Makefile.config for unwinding the name dwarf implies either
libunwind or libdw. Make it clearer that CONFIG_DWARF is really just
defined when libdw is present by renaming to CONFIG_LIBDW.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Makefile.config | 2 +-
tools/perf/arch/arm/util/Build | 2 +-
tools/perf/arch/arm64/util/Build | 2 +-
tools/perf/arch/csky/util/Build | 2 +-
tools/perf/arch/loongarch/util/Build | 2 +-
tools/perf/arch/mips/util/Build | 2 +-
tools/perf/arch/powerpc/util/Build | 4 ++--
tools/perf/arch/riscv/util/Build | 2 +-
tools/perf/arch/s390/util/Build | 2 +-
tools/perf/arch/sh/util/Build | 2 +-
tools/perf/arch/sparc/util/Build | 2 +-
tools/perf/arch/x86/util/Build | 2 +-
tools/perf/arch/xtensa/util/Build | 2 +-
tools/perf/util/Build | 12 ++++++------
14 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 9ed0909db170..b14430ab2898 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -559,7 +559,7 @@ ifndef NO_LIBELF
CFLAGS += -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += ${DWARFLIBS}
- $(call detected,CONFIG_DWARF)
+ $(call detected,CONFIG_LIBDW)
endif # PERF_HAVE_DWARF_REGS
endif # NO_LIBDW
diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build
index e6dd7cd79ebd..e06fea1ea8ff 100644
--- a/tools/perf/arch/arm/util/Build
+++ b/tools/perf/arch/arm/util/Build
@@ -1,6 +1,6 @@
perf-util-y += perf_regs.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build
index 343ef7589a77..4387a6d6a6c3 100644
--- a/tools/perf/arch/arm64/util/Build
+++ b/tools/perf/arch/arm64/util/Build
@@ -4,7 +4,7 @@ perf-util-y += perf_regs.o
perf-util-y += tsc.o
perf-util-y += pmu.o
perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Build
index 99d83f41bf43..1325310cab6a 100644
--- a/tools/perf/arch/csky/util/Build
+++ b/tools/perf/arch/csky/util/Build
@@ -1,4 +1,4 @@
perf-util-y += perf_regs.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/loongarch/util/Build b/tools/perf/arch/loongarch/util/Build
index b6b97de48233..06ff95394921 100644
--- a/tools/perf/arch/loongarch/util/Build
+++ b/tools/perf/arch/loongarch/util/Build
@@ -1,7 +1,7 @@
perf-util-y += header.o
perf-util-y += perf_regs.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Build
index e4644f1e68a0..b328109fc16c 100644
--- a/tools/perf/arch/mips/util/Build
+++ b/tools/perf/arch/mips/util/Build
@@ -1,3 +1,3 @@
perf-util-y += perf_regs.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build
index 6c588ecdf3bd..3d979480a188 100644
--- a/tools/perf/arch/powerpc/util/Build
+++ b/tools/perf/arch/powerpc/util/Build
@@ -7,8 +7,8 @@ perf-util-y += sym-handling.o
perf-util-y += evsel.o
perf-util-y += event.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
-perf-util-$(CONFIG_DWARF) += skip-callchain-idx.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += skip-callchain-idx.o
perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/riscv/util/Build b/tools/perf/arch/riscv/util/Build
index f865cb0489ec..8f93091b8345 100644
--- a/tools/perf/arch/riscv/util/Build
+++ b/tools/perf/arch/riscv/util/Build
@@ -2,5 +2,5 @@ perf-util-y += perf_regs.o
perf-util-y += header.o
perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build
index 1ac830030ff3..787410f99bb3 100644
--- a/tools/perf/arch/s390/util/Build
+++ b/tools/perf/arch/s390/util/Build
@@ -2,7 +2,7 @@ perf-util-y += header.o
perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o
perf-util-y += perf_regs.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
perf-util-y += machine.o
diff --git a/tools/perf/arch/sh/util/Build b/tools/perf/arch/sh/util/Build
index 32f44fc4ab98..2337a0b710a2 100644
--- a/tools/perf/arch/sh/util/Build
+++ b/tools/perf/arch/sh/util/Build
@@ -1 +1 @@
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/util/Build b/tools/perf/arch/sparc/util/Build
index 32f44fc4ab98..2337a0b710a2 100644
--- a/tools/perf/arch/sparc/util/Build
+++ b/tools/perf/arch/sparc/util/Build
@@ -1 +1 @@
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build
index 2607ed5c4296..9705cda4f240 100644
--- a/tools/perf/arch/x86/util/Build
+++ b/tools/perf/arch/x86/util/Build
@@ -12,7 +12,7 @@ perf-util-y += evsel.o
perf-util-y += iostat.o
perf-util-y += env.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
perf-util-$(CONFIG_BPF_PROLOGUE) += dwarf-regs.o
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/xtensa/util/Build b/tools/perf/arch/xtensa/util/Build
index e813e618954b..2d1a48696ad9 100644
--- a/tools/perf/arch/xtensa/util/Build
+++ b/tools/perf/arch/xtensa/util/Build
@@ -1 +1 @@
-perf-$(CONFIG_DWARF) += dwarf-regs.o
+perf-$(CONFIG_LIBDW) += dwarf-regs.o
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index dc616292b2dd..1d08608b7e1b 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -199,11 +199,11 @@ ifndef CONFIG_SETNS
perf-util-y += setns.o
endif
-perf-util-$(CONFIG_DWARF) += probe-finder.o
-perf-util-$(CONFIG_DWARF) += dwarf-aux.o
-perf-util-$(CONFIG_DWARF) += dwarf-regs.o
-perf-util-$(CONFIG_DWARF) += debuginfo.o
-perf-util-$(CONFIG_DWARF) += annotate-data.o
+perf-util-$(CONFIG_LIBDW) += probe-finder.o
+perf-util-$(CONFIG_LIBDW) += dwarf-aux.o
+perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
+perf-util-$(CONFIG_LIBDW) += debuginfo.o
+perf-util-$(CONFIG_LIBDW) += annotate-data.o
perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o
@@ -234,7 +234,7 @@ perf-util-$(CONFIG_LIBLLVM) += llvm-c-helpers.o
ifdef CONFIG_JITDUMP
perf-util-$(CONFIG_LIBELF) += jitdump.o
perf-util-$(CONFIG_LIBELF) += genelf.o
-perf-util-$(CONFIG_DWARF) += genelf_debug.o
+perf-util-$(CONFIG_LIBDW) += genelf_debug.o
endif
perf-util-y += perf-hooks.o
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (9 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 10/11] perf build: Rename CONFIG_DWARF to CONFIG_LIBDW Ian Rogers
@ 2024-09-24 16:04 ` Ian Rogers
2024-09-26 3:27 ` Namhyung Kim
2024-09-24 19:44 ` [PATCH v1 00/11] Libdw/dwarf build clean up Leo Yan
11 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-24 16:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
The name dwarf can imply libunwind support, whereas
PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
make it clearer there is a libdw connection.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/Makefile.config | 4 ++--
tools/perf/arch/arm/Makefile | 2 +-
tools/perf/arch/arm64/Makefile | 2 +-
tools/perf/arch/csky/Makefile | 2 +-
tools/perf/arch/loongarch/Makefile | 2 +-
tools/perf/arch/mips/Makefile | 2 +-
tools/perf/arch/powerpc/Makefile | 2 +-
tools/perf/arch/riscv/Makefile | 2 +-
tools/perf/arch/s390/Makefile | 2 +-
tools/perf/arch/sh/Makefile | 2 +-
tools/perf/arch/sparc/Makefile | 2 +-
tools/perf/arch/x86/Makefile | 2 +-
tools/perf/arch/xtensa/Makefile | 2 +-
13 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index b14430ab2898..ea9b2b315064 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -552,7 +552,7 @@ ifndef NO_LIBELF
endif
ifndef NO_LIBDW
- ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
+ ifeq ($(origin PERF_HAVE_LIBDW_REGS), undefined)
$(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
NO_LIBDW := 1
else
@@ -560,7 +560,7 @@ ifndef NO_LIBELF
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += ${DWARFLIBS}
$(call detected,CONFIG_LIBDW)
- endif # PERF_HAVE_DWARF_REGS
+ endif # PERF_HAVE_LIBDW_REGS
endif # NO_LIBDW
ifndef NO_LIBBPF
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
index 9b164d379548..5c712fa2347b 100644
--- a/tools/perf/arch/arm/Makefile
+++ b/tools/perf/arch/arm/Makefile
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
index 8a5ffbfe809f..66456aef91bc 100644
--- a/tools/perf/arch/arm64/Makefile
+++ b/tools/perf/arch/arm64/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
PERF_HAVE_JITDUMP := 1
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile
index 119b06a64bed..f9e270940919 100644
--- a/tools/perf/arch/csky/Makefile
+++ b/tools/perf/arch/csky/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile
index 1cc5eb01f32b..fb0c55bf59f8 100644
--- a/tools/perf/arch/loongarch/Makefile
+++ b/tools/perf/arch/loongarch/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile
index 733f7b76f52d..5892bc310127 100644
--- a/tools/perf/arch/mips/Makefile
+++ b/tools/perf/arch/mips/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
# Syscall table generation for perf
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index 7672d555f6cd..86911b7505ca 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile
index 4664a78a1afd..d97fd00e43f2 100644
--- a/tools/perf/arch/riscv/Makefile
+++ b/tools/perf/arch/riscv/Makefile
@@ -1,5 +1,5 @@
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 3f66e2ede3f7..4b83e66c2dfb 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
index 119b06a64bed..f9e270940919 100644
--- a/tools/perf/arch/sh/Makefile
+++ b/tools/perf/arch/sh/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
index 7741184894c8..39108adc18f1 100644
--- a/tools/perf/arch/sparc/Makefile
+++ b/tools/perf/arch/sparc/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 9aa58acb5564..901d74e85470 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makefile
index 119b06a64bed..f9e270940919 100644
--- a/tools/perf/arch/xtensa/Makefile
+++ b/tools/perf/arch/xtensa/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
-PERF_HAVE_DWARF_REGS := 1
+PERF_HAVE_LIBDW_REGS := 1
endif
--
2.46.0.792.g87dc391469-goog
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-24 16:04 ` [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS Ian Rogers
@ 2024-09-26 3:27 ` Namhyung Kim
2024-09-26 12:47 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 3:27 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> The name dwarf can imply libunwind support, whereas
> PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> make it clearer there is a libdw connection.
While it only covers libdw, I think the idea of this macro is whether
the arch has register mappings defined in DWARF standard. So I think
it's better to keep the name for this case.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-26 3:27 ` Namhyung Kim
@ 2024-09-26 12:47 ` Ian Rogers
2024-09-26 19:39 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-26 12:47 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > The name dwarf can imply libunwind support, whereas
> > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > make it clearer there is a libdw connection.
>
> While it only covers libdw, I think the idea of this macro is whether
> the arch has register mappings defined in DWARF standard. So I think
> it's better to keep the name for this case.
How can the dwarf standard exist for an arch but not define registers?
Thanks,
Ian
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-26 12:47 ` Ian Rogers
@ 2024-09-26 19:39 ` Namhyung Kim
2024-09-26 19:55 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-26 19:39 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > The name dwarf can imply libunwind support, whereas
> > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > make it clearer there is a libdw connection.
> >
> > While it only covers libdw, I think the idea of this macro is whether
> > the arch has register mappings defined in DWARF standard. So I think
> > it's better to keep the name for this case.
>
> How can the dwarf standard exist for an arch but not define registers?
I meant it's about the arch code in the perf tools to have the mapping,
not the DWARF standard itself.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-26 19:39 ` Namhyung Kim
@ 2024-09-26 19:55 ` Ian Rogers
2024-09-27 17:16 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-26 19:55 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > The name dwarf can imply libunwind support, whereas
> > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > make it clearer there is a libdw connection.
> > >
> > > While it only covers libdw, I think the idea of this macro is whether
> > > the arch has register mappings defined in DWARF standard. So I think
> > > it's better to keep the name for this case.
> >
> > How can the dwarf standard exist for an arch but not define registers?
>
> I meant it's about the arch code in the perf tools to have the mapping,
> not the DWARF standard itself.
But we guard those definitions behind having libdw:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
So we only have the regs if libdw is present, not if dwarf is in use
for libunwind/libdw. Hence wanting to be specific that they are just a
libdw and not a dwarf thing. Trying to use the regs in libunwind code
would be broken. That could change but I wanted to make the code clear
for the way things are at the moment.
Thanks,
Ian
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-26 19:55 ` Ian Rogers
@ 2024-09-27 17:16 ` Namhyung Kim
2024-09-27 18:15 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-09-27 17:16 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > >
> > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > The name dwarf can imply libunwind support, whereas
> > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > make it clearer there is a libdw connection.
> > > >
> > > > While it only covers libdw, I think the idea of this macro is whether
> > > > the arch has register mappings defined in DWARF standard. So I think
> > > > it's better to keep the name for this case.
> > >
> > > How can the dwarf standard exist for an arch but not define registers?
> >
> > I meant it's about the arch code in the perf tools to have the mapping,
> > not the DWARF standard itself.
>
> But we guard those definitions behind having libdw:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> So we only have the regs if libdw is present, not if dwarf is in use
> for libunwind/libdw. Hence wanting to be specific that they are just a
> libdw and not a dwarf thing. Trying to use the regs in libunwind code
> would be broken. That could change but I wanted to make the code clear
> for the way things are at the moment.
I understand your point but calling it LIBDW_REGS looks unnatural to me.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-27 17:16 ` Namhyung Kim
@ 2024-09-27 18:15 ` Ian Rogers
2024-09-29 2:35 ` Masami Hiramatsu
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-09-27 18:15 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
Kan Liang, John Garry, Will Deacon, James Clark, Mike Leach,
Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Nick Terrell, Guilherme Amadio, Changbin Du, Steinar H. Gunderson,
Masami Hiramatsu (Google), Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > >
> > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > make it clearer there is a libdw connection.
> > > > >
> > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > it's better to keep the name for this case.
> > > >
> > > > How can the dwarf standard exist for an arch but not define registers?
> > >
> > > I meant it's about the arch code in the perf tools to have the mapping,
> > > not the DWARF standard itself.
> >
> > But we guard those definitions behind having libdw:
> > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > So we only have the regs if libdw is present, not if dwarf is in use
> > for libunwind/libdw. Hence wanting to be specific that they are just a
> > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > would be broken. That could change but I wanted to make the code clear
> > for the way things are at the moment.
>
> I understand your point but calling it LIBDW_REGS looks unnatural to me.
I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
in libunwind code but you are to some how know that the code only had
meaning if libdw was present? I don't like the implication that DWARF
means LIBDW as throughout the code it doesn't. I think the name
PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
more intention revealing and so readable, etc.
Thanks,
Ian
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-27 18:15 ` Ian Rogers
@ 2024-09-29 2:35 ` Masami Hiramatsu
2024-10-01 4:02 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Masami Hiramatsu @ 2024-09-29 2:35 UTC (permalink / raw)
To: Ian Rogers
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Masami Hiramatsu (Google),
Aditya Gupta, Athira Rajeev, Masahiro Yamada, Huacai Chen,
Bibo Mao, Kajol Jain, Anup Patel, Shenlin Liang, Atish Patra,
Oliver Upton, Chen Pei, Dima Kogan, Alexander Lobakin,
David S. Miller, Przemek Kitszel, linux-kernel, linux-perf-users,
Yang Jihong
On Fri, 27 Sep 2024 11:15:21 -0700
Ian Rogers <irogers@google.com> wrote:
> On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > >
> > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > >
> > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > make it clearer there is a libdw connection.
> > > > > >
> > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > it's better to keep the name for this case.
> > > > >
> > > > > How can the dwarf standard exist for an arch but not define registers?
> > > >
> > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > not the DWARF standard itself.
> > >
> > > But we guard those definitions behind having libdw:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > So we only have the regs if libdw is present, not if dwarf is in use
> > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > would be broken. That could change but I wanted to make the code clear
> > > for the way things are at the moment.
> >
> > I understand your point but calling it LIBDW_REGS looks unnatural to me.
>
> I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> in libunwind code but you are to some how know that the code only had
> meaning if libdw was present? I don't like the implication that DWARF
> means LIBDW as throughout the code it doesn't. I think the name
> PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> more intention revealing and so readable, etc.
I agree with Namhyung this point. dwarf-regs is defined only by the
DWARF standard, not libdw only. The standard encode registers by a digit
number and the dwarf-regs decode the number to actual register name.
Actually, there is a histrical reason I had called it is DWARF. I used to
use "libdwarf", and switched to "libdw" for required features. So I know
there are more than 1 implementation of DWARF library, and the libdwarf
also uses the same operation number because it depends on the same standard.
https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
So I think we'd better keep it call as DWARF_REGS.
Thank you,
>
> Thanks,
> Ian
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-09-29 2:35 ` Masami Hiramatsu
@ 2024-10-01 4:02 ` Ian Rogers
2024-10-01 23:09 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-10-01 4:02 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> On Fri, 27 Sep 2024 11:15:21 -0700
> Ian Rogers <irogers@google.com> wrote:
>
> > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > >
> > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > >
> > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > make it clearer there is a libdw connection.
> > > > > > >
> > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > it's better to keep the name for this case.
> > > > > >
> > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > >
> > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > not the DWARF standard itself.
> > > >
> > > > But we guard those definitions behind having libdw:
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > would be broken. That could change but I wanted to make the code clear
> > > > for the way things are at the moment.
> > >
> > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> >
> > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > in libunwind code but you are to some how know that the code only had
> > meaning if libdw was present? I don't like the implication that DWARF
> > means LIBDW as throughout the code it doesn't. I think the name
> > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > more intention revealing and so readable, etc.
>
> I agree with Namhyung this point. dwarf-regs is defined only by the
> DWARF standard, not libdw only. The standard encode registers by a digit
> number and the dwarf-regs decode the number to actual register name.
The code is not making a statement about the DWARF standard, take arch/csky:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
```
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
endif
```
in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
```
# SPDX-License-Identifier: GPL-2.0-only
ifndef NO_LIBDW
PERF_HAVE_DWARF_REGS := 1
endif
```
So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
for csky.
Dwarf in the code base implies libdw, libunwind and potentially other
dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
general dwarf thing will not be set because of missing libdw. This
goes contrary to wanting this to be true whenever a dwarf thing is
present - something that reflecting what the standard says would
achieve.
In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
dependent thing, it is a libdw dependent thing, this is why
PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
the connection explicit.
We could change the code so that in Makefile.config we set something like:
```
...
ifndef NO_LIBDW
PERF_HAVE_DWARF := 1
...
```
and in the arch/.../Makefiles change them to be:
```
if PERF_HAVE_DWARF
PERF_HAVE_DWARF_REGS := 1
endif
```
but this is going beyond the clean up this patch series was trying to
achieve. I also don't know of an architecture where dwarf is present
but registers are not, so having a definition for this case feels
redundant.
Thanks,
Ian
> Actually, there is a histrical reason I had called it is DWARF. I used to
> use "libdwarf", and switched to "libdw" for required features. So I know
> there are more than 1 implementation of DWARF library, and the libdwarf
> also uses the same operation number because it depends on the same standard.
>
> https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
>
> So I think we'd better keep it call as DWARF_REGS.
>
> Thank you,
>
> >
> > Thanks,
> > Ian
> >
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-01 4:02 ` Ian Rogers
@ 2024-10-01 23:09 ` Namhyung Kim
2024-10-01 23:17 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-10-01 23:09 UTC (permalink / raw)
To: Ian Rogers
Cc: Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > On Fri, 27 Sep 2024 11:15:21 -0700
> > Ian Rogers <irogers@google.com> wrote:
> >
> > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > >
> > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > >
> > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > >
> > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > >
> > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > it's better to keep the name for this case.
> > > > > > >
> > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > >
> > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > not the DWARF standard itself.
> > > > >
> > > > > But we guard those definitions behind having libdw:
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > would be broken. That could change but I wanted to make the code clear
> > > > > for the way things are at the moment.
> > > >
> > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > >
> > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > in libunwind code but you are to some how know that the code only had
> > > meaning if libdw was present? I don't like the implication that DWARF
> > > means LIBDW as throughout the code it doesn't. I think the name
> > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > more intention revealing and so readable, etc.
> >
> > I agree with Namhyung this point. dwarf-regs is defined only by the
> > DWARF standard, not libdw only. The standard encode registers by a digit
> > number and the dwarf-regs decode the number to actual register name.
>
> The code is not making a statement about the DWARF standard, take arch/csky:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> ```
> # SPDX-License-Identifier: GPL-2.0-only
> ifndef NO_DWARF
> PERF_HAVE_DWARF_REGS := 1
> endif
> ```
> in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> ```
> # SPDX-License-Identifier: GPL-2.0-only
> ifndef NO_LIBDW
> PERF_HAVE_DWARF_REGS := 1
> endif
> ```
> So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> for csky.
I think this is totally fine and we can change the condition later if
needed.
After all, I don't think it's a big deal. Let's just call DWARF
registers DWARF_REGS. :)
Thanks,
Namhyung
>
> Dwarf in the code base implies libdw, libunwind and potentially other
> dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
> will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
> general dwarf thing will not be set because of missing libdw. This
> goes contrary to wanting this to be true whenever a dwarf thing is
> present - something that reflecting what the standard says would
> achieve.
>
> In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
> dependent thing, it is a libdw dependent thing, this is why
> PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
> the connection explicit.
>
> We could change the code so that in Makefile.config we set something like:
> ```
> ...
> ifndef NO_LIBDW
> PERF_HAVE_DWARF := 1
> ...
> ```
> and in the arch/.../Makefiles change them to be:
> ```
> if PERF_HAVE_DWARF
> PERF_HAVE_DWARF_REGS := 1
> endif
> ```
> but this is going beyond the clean up this patch series was trying to
> achieve. I also don't know of an architecture where dwarf is present
> but registers are not, so having a definition for this case feels
> redundant.
>
> Thanks,
> Ian
>
> > Actually, there is a histrical reason I had called it is DWARF. I used to
> > use "libdwarf", and switched to "libdw" for required features. So I know
> > there are more than 1 implementation of DWARF library, and the libdwarf
> > also uses the same operation number because it depends on the same standard.
> >
> > https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
> >
> > So I think we'd better keep it call as DWARF_REGS.
> >
> > Thank you,
> >
> > >
> > > Thanks,
> > > Ian
> > >
> >
> >
> > --
> > Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-01 23:09 ` Namhyung Kim
@ 2024-10-01 23:17 ` Ian Rogers
2024-10-01 23:28 ` Masami Hiramatsu
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-10-01 23:17 UTC (permalink / raw)
To: Namhyung Kim
Cc: Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > >
> > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > Ian Rogers <irogers@google.com> wrote:
> > >
> > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > >
> > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > >
> > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > >
> > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > >
> > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > it's better to keep the name for this case.
> > > > > > > >
> > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > >
> > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > not the DWARF standard itself.
> > > > > >
> > > > > > But we guard those definitions behind having libdw:
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > for the way things are at the moment.
> > > > >
> > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > >
> > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > in libunwind code but you are to some how know that the code only had
> > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > more intention revealing and so readable, etc.
> > >
> > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > number and the dwarf-regs decode the number to actual register name.
> >
> > The code is not making a statement about the DWARF standard, take arch/csky:
> > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > ```
> > # SPDX-License-Identifier: GPL-2.0-only
> > ifndef NO_DWARF
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > ```
> > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > ```
> > # SPDX-License-Identifier: GPL-2.0-only
> > ifndef NO_LIBDW
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > ```
> > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > for csky.
>
> I think this is totally fine and we can change the condition later if
> needed.
>
> After all, I don't think it's a big deal. Let's just call DWARF
> registers DWARF_REGS. :)
The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
not setting it while supporting call-graph dwarf with libunwind. It is
actively confusing.
Thanks,
Ian
> Thanks,
> Namhyung
>
> >
> > Dwarf in the code base implies libdw, libunwind and potentially other
> > dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
> > will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
> > general dwarf thing will not be set because of missing libdw. This
> > goes contrary to wanting this to be true whenever a dwarf thing is
> > present - something that reflecting what the standard says would
> > achieve.
> >
> > In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
> > dependent thing, it is a libdw dependent thing, this is why
> > PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
> > the connection explicit.
> >
> > We could change the code so that in Makefile.config we set something like:
> > ```
> > ...
> > ifndef NO_LIBDW
> > PERF_HAVE_DWARF := 1
> > ...
> > ```
> > and in the arch/.../Makefiles change them to be:
> > ```
> > if PERF_HAVE_DWARF
> > PERF_HAVE_DWARF_REGS := 1
> > endif
> > ```
> > but this is going beyond the clean up this patch series was trying to
> > achieve. I also don't know of an architecture where dwarf is present
> > but registers are not, so having a definition for this case feels
> > redundant.
> >
> > Thanks,
> > Ian
> >
> > > Actually, there is a histrical reason I had called it is DWARF. I used to
> > > use "libdwarf", and switched to "libdw" for required features. So I know
> > > there are more than 1 implementation of DWARF library, and the libdwarf
> > > also uses the same operation number because it depends on the same standard.
> > >
> > > https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
> > >
> > > So I think we'd better keep it call as DWARF_REGS.
> > >
> > > Thank you,
> > >
> > > >
> > > > Thanks,
> > > > Ian
> > > >
> > >
> > >
> > > --
> > > Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-01 23:17 ` Ian Rogers
@ 2024-10-01 23:28 ` Masami Hiramatsu
2024-10-02 1:31 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Masami Hiramatsu @ 2024-10-01 23:28 UTC (permalink / raw)
To: Ian Rogers
Cc: Namhyung Kim, Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, 1 Oct 2024 16:17:34 -0700
Ian Rogers <irogers@google.com> wrote:
> On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > >
> > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > Ian Rogers <irogers@google.com> wrote:
> > > >
> > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > >
> > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > >
> > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > >
> > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > >
> > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > >
> > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > >
> > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > not the DWARF standard itself.
> > > > > > >
> > > > > > > But we guard those definitions behind having libdw:
> > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > for the way things are at the moment.
> > > > > >
> > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > >
> > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > in libunwind code but you are to some how know that the code only had
> > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > more intention revealing and so readable, etc.
> > > >
> > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > number and the dwarf-regs decode the number to actual register name.
> > >
> > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > ```
> > > # SPDX-License-Identifier: GPL-2.0-only
> > > ifndef NO_DWARF
> > > PERF_HAVE_DWARF_REGS := 1
> > > endif
> > > ```
> > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > ```
> > > # SPDX-License-Identifier: GPL-2.0-only
> > > ifndef NO_LIBDW
> > > PERF_HAVE_DWARF_REGS := 1
> > > endif
> > > ```
> > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > for csky.
> >
> > I think this is totally fine and we can change the condition later if
> > needed.
> >
> > After all, I don't think it's a big deal. Let's just call DWARF
> > registers DWARF_REGS. :)
>
> The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> not setting it while supporting call-graph dwarf with libunwind. It is
> actively confusing.
Does libunwind requires the dwarf regs? I think the dwarf regs information
is only needed for analyzing dwarf register assignment, not stack unwinding.
Thank you,
>
> Thanks,
> Ian
>
> > Thanks,
> > Namhyung
> >
> > >
> > > Dwarf in the code base implies libdw, libunwind and potentially other
> > > dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
> > > will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
> > > general dwarf thing will not be set because of missing libdw. This
> > > goes contrary to wanting this to be true whenever a dwarf thing is
> > > present - something that reflecting what the standard says would
> > > achieve.
> > >
> > > In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
> > > dependent thing, it is a libdw dependent thing, this is why
> > > PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
> > > the connection explicit.
> > >
> > > We could change the code so that in Makefile.config we set something like:
> > > ```
> > > ...
> > > ifndef NO_LIBDW
> > > PERF_HAVE_DWARF := 1
> > > ...
> > > ```
> > > and in the arch/.../Makefiles change them to be:
> > > ```
> > > if PERF_HAVE_DWARF
> > > PERF_HAVE_DWARF_REGS := 1
> > > endif
> > > ```
> > > but this is going beyond the clean up this patch series was trying to
> > > achieve. I also don't know of an architecture where dwarf is present
> > > but registers are not, so having a definition for this case feels
> > > redundant.
> > >
> > > Thanks,
> > > Ian
> > >
> > > > Actually, there is a histrical reason I had called it is DWARF. I used to
> > > > use "libdwarf", and switched to "libdw" for required features. So I know
> > > > there are more than 1 implementation of DWARF library, and the libdwarf
> > > > also uses the same operation number because it depends on the same standard.
> > > >
> > > > https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
> > > >
> > > > So I think we'd better keep it call as DWARF_REGS.
> > > >
> > > > Thank you,
> > > >
> > > > >
> > > > > Thanks,
> > > > > Ian
> > > > >
> > > >
> > > >
> > > > --
> > > > Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-01 23:28 ` Masami Hiramatsu
@ 2024-10-02 1:31 ` Ian Rogers
2024-10-02 13:56 ` Masami Hiramatsu
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-10-02 1:31 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, Oct 1, 2024 at 4:29 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> On Tue, 1 Oct 2024 16:17:34 -0700
> Ian Rogers <irogers@google.com> wrote:
>
> > On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > >
> > > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > > Ian Rogers <irogers@google.com> wrote:
> > > > >
> > > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > >
> > > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > >
> > > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > > >
> > > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > > >
> > > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > > >
> > > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > > not the DWARF standard itself.
> > > > > > > >
> > > > > > > > But we guard those definitions behind having libdw:
> > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > > for the way things are at the moment.
> > > > > > >
> > > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > > >
> > > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > > in libunwind code but you are to some how know that the code only had
> > > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > > more intention revealing and so readable, etc.
> > > > >
> > > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > > number and the dwarf-regs decode the number to actual register name.
> > > >
> > > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > > ```
> > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > ifndef NO_DWARF
> > > > PERF_HAVE_DWARF_REGS := 1
> > > > endif
> > > > ```
> > > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > > ```
> > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > ifndef NO_LIBDW
> > > > PERF_HAVE_DWARF_REGS := 1
> > > > endif
> > > > ```
> > > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > > for csky.
> > >
> > > I think this is totally fine and we can change the condition later if
> > > needed.
> > >
> > > After all, I don't think it's a big deal. Let's just call DWARF
> > > registers DWARF_REGS. :)
> >
> > The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> > not setting it while supporting call-graph dwarf with libunwind. It is
> > actively confusing.
>
> Does libunwind requires the dwarf regs? I think the dwarf regs information
> is only needed for analyzing dwarf register assignment, not stack unwinding.
So you are saying the #define is guarding a libdw feature?
perf record/report --call-graph=dwarf is supported with either libdw
or libunwind. The dwarf support in the tool may come from more sources
hence wanting in this patch set to be clear what variable is guarding
what. PERF_HAVE_DWARF_REGS is set to 1 for a specific set of
architectures and only when libdw is present. The variable is saying
that libdw supports the notion of registers needed for the #define
HAVE_DWARF_SUPPORT that patch 9 in the series renamed to
HAVE_LIBDW_SUPPORT. So I want the makefile variable
PERF_HAVE_LIBDW_REGS to guard the #define HAVE_LIBDW_SUPPORT, rather
than what is being argued by yourself and Namhyung that the #define
HAVE_LIBDW_SUPPORT be guarded by a variable called
PERF_HAVE_DWARF_REGS and that is only set when NO_LIBDW isn't set.
We've made a digression into the name dwarf for a reason I can't
fathom, at best it is inconsistent. Having dwarf registers is like
having a bright sun or numeric numbers, it is a truism (playing devils
advocate maybe if there were an ELF file format for postscript we
could have a dwarf specification without registers). Anyway, I'm
trying to connect the dots that libdw support controls the libdw type
variables and defines hence not wanting 10 out of 11 patches applied.
Thanks,
Ian
> Thank you,
>
> >
> > Thanks,
> > Ian
> >
> > > Thanks,
> > > Namhyung
> > >
> > > >
> > > > Dwarf in the code base implies libdw, libunwind and potentially other
> > > > dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
> > > > will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
> > > > general dwarf thing will not be set because of missing libdw. This
> > > > goes contrary to wanting this to be true whenever a dwarf thing is
> > > > present - something that reflecting what the standard says would
> > > > achieve.
> > > >
> > > > In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
> > > > dependent thing, it is a libdw dependent thing, this is why
> > > > PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
> > > > the connection explicit.
> > > >
> > > > We could change the code so that in Makefile.config we set something like:
> > > > ```
> > > > ...
> > > > ifndef NO_LIBDW
> > > > PERF_HAVE_DWARF := 1
> > > > ...
> > > > ```
> > > > and in the arch/.../Makefiles change them to be:
> > > > ```
> > > > if PERF_HAVE_DWARF
> > > > PERF_HAVE_DWARF_REGS := 1
> > > > endif
> > > > ```
> > > > but this is going beyond the clean up this patch series was trying to
> > > > achieve. I also don't know of an architecture where dwarf is present
> > > > but registers are not, so having a definition for this case feels
> > > > redundant.
> > > >
> > > > Thanks,
> > > > Ian
> > > >
> > > > > Actually, there is a histrical reason I had called it is DWARF. I used to
> > > > > use "libdwarf", and switched to "libdw" for required features. So I know
> > > > > there are more than 1 implementation of DWARF library, and the libdwarf
> > > > > also uses the same operation number because it depends on the same standard.
> > > > >
> > > > > https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
> > > > >
> > > > > So I think we'd better keep it call as DWARF_REGS.
> > > > >
> > > > > Thank you,
> > > > >
> > > > > >
> > > > > > Thanks,
> > > > > > Ian
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-02 1:31 ` Ian Rogers
@ 2024-10-02 13:56 ` Masami Hiramatsu
2024-10-02 14:27 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Masami Hiramatsu @ 2024-10-02 13:56 UTC (permalink / raw)
To: Ian Rogers
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Tue, 1 Oct 2024 18:31:43 -0700
Ian Rogers <irogers@google.com> wrote:
> On Tue, Oct 1, 2024 at 4:29 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > On Tue, 1 Oct 2024 16:17:34 -0700
> > Ian Rogers <irogers@google.com> wrote:
> >
> > > On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > >
> > > > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > > >
> > > > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > > > Ian Rogers <irogers@google.com> wrote:
> > > > > >
> > > > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > >
> > > > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > >
> > > > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > > > >
> > > > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > > > >
> > > > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > > > >
> > > > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > > > not the DWARF standard itself.
> > > > > > > > >
> > > > > > > > > But we guard those definitions behind having libdw:
> > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > > > for the way things are at the moment.
> > > > > > > >
> > > > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > > > >
> > > > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > > > in libunwind code but you are to some how know that the code only had
> > > > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > > > more intention revealing and so readable, etc.
> > > > > >
> > > > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > > > number and the dwarf-regs decode the number to actual register name.
> > > > >
> > > > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > > > ```
> > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > ifndef NO_DWARF
> > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > endif
> > > > > ```
> > > > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > > > ```
> > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > ifndef NO_LIBDW
> > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > endif
> > > > > ```
> > > > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > > > for csky.
> > > >
> > > > I think this is totally fine and we can change the condition later if
> > > > needed.
> > > >
> > > > After all, I don't think it's a big deal. Let's just call DWARF
> > > > registers DWARF_REGS. :)
> > >
> > > The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> > > not setting it while supporting call-graph dwarf with libunwind. It is
> > > actively confusing.
> >
> > Does libunwind requires the dwarf regs? I think the dwarf regs information
> > is only needed for analyzing dwarf register assignment, not stack unwinding.
>
> So you are saying the #define is guarding a libdw feature?
> perf record/report --call-graph=dwarf is supported with either libdw
> or libunwind. The dwarf support in the tool may come from more sources
> hence wanting in this patch set to be clear what variable is guarding
> what. PERF_HAVE_DWARF_REGS is set to 1 for a specific set of
> architectures and only when libdw is present. The variable is saying
> that libdw supports the notion of registers needed for the #define
> HAVE_DWARF_SUPPORT that patch 9 in the series renamed to
> HAVE_LIBDW_SUPPORT. So I want the makefile variable
> PERF_HAVE_LIBDW_REGS to guard the #define HAVE_LIBDW_SUPPORT, rather
> than what is being argued by yourself and Namhyung that the #define
> HAVE_LIBDW_SUPPORT be guarded by a variable called
> PERF_HAVE_DWARF_REGS and that is only set when NO_LIBDW isn't set.
It will be only used with the libdw, but I don't care.
"HAVE_DWARF_REG" (internal config, just indicates the arch implemented
feature) simply means there is `arch/XXX/util/dwarf-regs.c`.
Also the APIs provided by the dwarf-regs.c are still based on DWARF
standard, which defines registers by number like DW_OP_reg[0-31].
So the mapping of these suffix number and actual register must be
defined for each architecture.
That is why I had introduced dwarf-regs.c and call it "dwarf"-regs.
Even if the implementation depends on libdw, this dwarf-regs.c is
still based on DWARF standard.
> We've made a digression into the name dwarf for a reason I can't
> fathom, at best it is inconsistent. Having dwarf registers is like
> having a bright sun or numeric numbers, it is a truism (playing devils
> advocate maybe if there were an ELF file format for postscript we
> could have a dwarf specification without registers). Anyway, I'm
> trying to connect the dots that libdw support controls the libdw type
> variables and defines hence not wanting 10 out of 11 patches applied.
Oh, wait, I think we can apply other patches. I just don't like this
patch. I think the other patches are good. But this is
Thank you,
>
> Thanks,
> Ian
>
> > Thank you,
> >
> > >
> > > Thanks,
> > > Ian
> > >
> > > > Thanks,
> > > > Namhyung
> > > >
> > > > >
> > > > > Dwarf in the code base implies libdw, libunwind and potentially other
> > > > > dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
> > > > > will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
> > > > > general dwarf thing will not be set because of missing libdw. This
> > > > > goes contrary to wanting this to be true whenever a dwarf thing is
> > > > > present - something that reflecting what the standard says would
> > > > > achieve.
> > > > >
> > > > > In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
> > > > > dependent thing, it is a libdw dependent thing, this is why
> > > > > PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
> > > > > the connection explicit.
> > > > >
> > > > > We could change the code so that in Makefile.config we set something like:
> > > > > ```
> > > > > ...
> > > > > ifndef NO_LIBDW
> > > > > PERF_HAVE_DWARF := 1
> > > > > ...
> > > > > ```
> > > > > and in the arch/.../Makefiles change them to be:
> > > > > ```
> > > > > if PERF_HAVE_DWARF
> > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > endif
> > > > > ```
> > > > > but this is going beyond the clean up this patch series was trying to
> > > > > achieve. I also don't know of an architecture where dwarf is present
> > > > > but registers are not, so having a definition for this case feels
> > > > > redundant.
> > > > >
> > > > > Thanks,
> > > > > Ian
> > > > >
> > > > > > Actually, there is a histrical reason I had called it is DWARF. I used to
> > > > > > use "libdwarf", and switched to "libdw" for required features. So I know
> > > > > > there are more than 1 implementation of DWARF library, and the libdwarf
> > > > > > also uses the same operation number because it depends on the same standard.
> > > > > >
> > > > > > https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
> > > > > >
> > > > > > So I think we'd better keep it call as DWARF_REGS.
> > > > > >
> > > > > > Thank you,
> > > > > >
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Ian
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > >
> >
> >
> > --
> > Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-02 13:56 ` Masami Hiramatsu
@ 2024-10-02 14:27 ` Ian Rogers
2024-10-03 22:48 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-10-02 14:27 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Oct 2, 2024 at 6:56 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> On Tue, 1 Oct 2024 18:31:43 -0700
> Ian Rogers <irogers@google.com> wrote:
>
> > On Tue, Oct 1, 2024 at 4:29 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > >
> > > On Tue, 1 Oct 2024 16:17:34 -0700
> > > Ian Rogers <irogers@google.com> wrote:
> > >
> > > > On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > >
> > > > > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > > > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > > > >
> > > > > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > > > > Ian Rogers <irogers@google.com> wrote:
> > > > > > >
> > > > > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > >
> > > > > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > > > > >
> > > > > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > > > > >
> > > > > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > > > > >
> > > > > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > > > > not the DWARF standard itself.
> > > > > > > > > >
> > > > > > > > > > But we guard those definitions behind having libdw:
> > > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > > > > for the way things are at the moment.
> > > > > > > > >
> > > > > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > > > > >
> > > > > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > > > > in libunwind code but you are to some how know that the code only had
> > > > > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > > > > more intention revealing and so readable, etc.
> > > > > > >
> > > > > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > > > > number and the dwarf-regs decode the number to actual register name.
> > > > > >
> > > > > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > > > > ```
> > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > ifndef NO_DWARF
> > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > endif
> > > > > > ```
> > > > > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > > > > ```
> > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > ifndef NO_LIBDW
> > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > endif
> > > > > > ```
> > > > > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > > > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > > > > for csky.
> > > > >
> > > > > I think this is totally fine and we can change the condition later if
> > > > > needed.
> > > > >
> > > > > After all, I don't think it's a big deal. Let's just call DWARF
> > > > > registers DWARF_REGS. :)
> > > >
> > > > The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> > > > not setting it while supporting call-graph dwarf with libunwind. It is
> > > > actively confusing.
> > >
> > > Does libunwind requires the dwarf regs? I think the dwarf regs information
> > > is only needed for analyzing dwarf register assignment, not stack unwinding.
> >
> > So you are saying the #define is guarding a libdw feature?
> > perf record/report --call-graph=dwarf is supported with either libdw
> > or libunwind. The dwarf support in the tool may come from more sources
> > hence wanting in this patch set to be clear what variable is guarding
> > what. PERF_HAVE_DWARF_REGS is set to 1 for a specific set of
> > architectures and only when libdw is present. The variable is saying
> > that libdw supports the notion of registers needed for the #define
> > HAVE_DWARF_SUPPORT that patch 9 in the series renamed to
> > HAVE_LIBDW_SUPPORT. So I want the makefile variable
> > PERF_HAVE_LIBDW_REGS to guard the #define HAVE_LIBDW_SUPPORT, rather
> > than what is being argued by yourself and Namhyung that the #define
> > HAVE_LIBDW_SUPPORT be guarded by a variable called
> > PERF_HAVE_DWARF_REGS and that is only set when NO_LIBDW isn't set.
>
> It will be only used with the libdw, but I don't care.
> "HAVE_DWARF_REG" (internal config, just indicates the arch implemented
> feature) simply means there is `arch/XXX/util/dwarf-regs.c`.
> Also the APIs provided by the dwarf-regs.c are still based on DWARF
> standard, which defines registers by number like DW_OP_reg[0-31].
> So the mapping of these suffix number and actual register must be
> defined for each architecture.
>
> That is why I had introduced dwarf-regs.c and call it "dwarf"-regs.
> Even if the implementation depends on libdw, this dwarf-regs.c is
> still based on DWARF standard.
You seem to be missing the point of the series which is to clean up
inconsistencies where dwarf is used to mean libdw. Here we have libdw
guarding a #define with DWARF in the name, it should have libdw in the
name as the patch cleans up. This is a coding thing and not a dwarf
specificatin thing.
> > We've made a digression into the name dwarf for a reason I can't
> > fathom, at best it is inconsistent. Having dwarf registers is like
> > having a bright sun or numeric numbers, it is a truism (playing devils
> > advocate maybe if there were an ELF file format for postscript we
> > could have a dwarf specification without registers). Anyway, I'm
> > trying to connect the dots that libdw support controls the libdw type
> > variables and defines hence not wanting 10 out of 11 patches applied.
>
> Oh, wait, I think we can apply other patches. I just don't like this
> patch. I think the other patches are good. But this is
Then we are intentionally aiming to be inconsistent, with libdw
meaning dwarf with a #define that just states a truism. Arguably the
code is better with none of the series applied.
Thanks,
Ian
> Thank you,
>
> >
> > Thanks,
> > Ian
> >
> > > Thank you,
> > >
> > > >
> > > > Thanks,
> > > > Ian
> > > >
> > > > > Thanks,
> > > > > Namhyung
> > > > >
> > > > > >
> > > > > > Dwarf in the code base implies libdw, libunwind and potentially other
> > > > > > dwarf capable things like llvm. If we don't have libdw then NO_LIBDW
> > > > > > will be set and PERF_HAVE_DWARF_REGS won't be set. That is the more
> > > > > > general dwarf thing will not be set because of missing libdw. This
> > > > > > goes contrary to wanting this to be true whenever a dwarf thing is
> > > > > > present - something that reflecting what the standard says would
> > > > > > achieve.
> > > > > >
> > > > > > In the code base right now PERF_HAVE_DWARF_REGS isn't a dwarf
> > > > > > dependent thing, it is a libdw dependent thing, this is why
> > > > > > PERF_HAVE_LIBDW_REGS is a more intention revealing name as it makes
> > > > > > the connection explicit.
> > > > > >
> > > > > > We could change the code so that in Makefile.config we set something like:
> > > > > > ```
> > > > > > ...
> > > > > > ifndef NO_LIBDW
> > > > > > PERF_HAVE_DWARF := 1
> > > > > > ...
> > > > > > ```
> > > > > > and in the arch/.../Makefiles change them to be:
> > > > > > ```
> > > > > > if PERF_HAVE_DWARF
> > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > endif
> > > > > > ```
> > > > > > but this is going beyond the clean up this patch series was trying to
> > > > > > achieve. I also don't know of an architecture where dwarf is present
> > > > > > but registers are not, so having a definition for this case feels
> > > > > > redundant.
> > > > > >
> > > > > > Thanks,
> > > > > > Ian
> > > > > >
> > > > > > > Actually, there is a histrical reason I had called it is DWARF. I used to
> > > > > > > use "libdwarf", and switched to "libdw" for required features. So I know
> > > > > > > there are more than 1 implementation of DWARF library, and the libdwarf
> > > > > > > also uses the same operation number because it depends on the same standard.
> > > > > > >
> > > > > > > https://github.com/davea42/libdwarf-code/blob/main/src/lib/libdwarf/dwarf.h#L809
> > > > > > >
> > > > > > > So I think we'd better keep it call as DWARF_REGS.
> > > > > > >
> > > > > > > Thank you,
> > > > > > >
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > Ian
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > > >
> > >
> > >
> > > --
> > > Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
>
>
> --
> Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-02 14:27 ` Ian Rogers
@ 2024-10-03 22:48 ` Namhyung Kim
2024-10-04 0:58 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-10-03 22:48 UTC (permalink / raw)
To: Ian Rogers
Cc: Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Wed, Oct 02, 2024 at 07:27:16AM -0700, Ian Rogers wrote:
> On Wed, Oct 2, 2024 at 6:56 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > On Tue, 1 Oct 2024 18:31:43 -0700
> > Ian Rogers <irogers@google.com> wrote:
> >
> > > On Tue, Oct 1, 2024 at 4:29 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > >
> > > > On Tue, 1 Oct 2024 16:17:34 -0700
> > > > Ian Rogers <irogers@google.com> wrote:
> > > >
> > > > > On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > >
> > > > > > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > > > > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > > > > >
> > > > > > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > > > > > Ian Rogers <irogers@google.com> wrote:
> > > > > > > >
> > > > > > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > >
> > > > > > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > > > > > >
> > > > > > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > > > > > >
> > > > > > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > > > > > not the DWARF standard itself.
> > > > > > > > > > >
> > > > > > > > > > > But we guard those definitions behind having libdw:
> > > > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > > > > > for the way things are at the moment.
> > > > > > > > > >
> > > > > > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > > > > > >
> > > > > > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > > > > > in libunwind code but you are to some how know that the code only had
> > > > > > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > > > > > more intention revealing and so readable, etc.
> > > > > > > >
> > > > > > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > > > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > > > > > number and the dwarf-regs decode the number to actual register name.
> > > > > > >
> > > > > > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > > > > > ```
> > > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > > ifndef NO_DWARF
> > > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > > endif
> > > > > > > ```
> > > > > > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > > > > > ```
> > > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > > ifndef NO_LIBDW
> > > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > > endif
> > > > > > > ```
> > > > > > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > > > > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > > > > > for csky.
> > > > > >
> > > > > > I think this is totally fine and we can change the condition later if
> > > > > > needed.
> > > > > >
> > > > > > After all, I don't think it's a big deal. Let's just call DWARF
> > > > > > registers DWARF_REGS. :)
> > > > >
> > > > > The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> > > > > not setting it while supporting call-graph dwarf with libunwind. It is
> > > > > actively confusing.
> > > >
> > > > Does libunwind requires the dwarf regs? I think the dwarf regs information
> > > > is only needed for analyzing dwarf register assignment, not stack unwinding.
> > >
> > > So you are saying the #define is guarding a libdw feature?
> > > perf record/report --call-graph=dwarf is supported with either libdw
> > > or libunwind. The dwarf support in the tool may come from more sources
> > > hence wanting in this patch set to be clear what variable is guarding
> > > what. PERF_HAVE_DWARF_REGS is set to 1 for a specific set of
> > > architectures and only when libdw is present. The variable is saying
> > > that libdw supports the notion of registers needed for the #define
> > > HAVE_DWARF_SUPPORT that patch 9 in the series renamed to
> > > HAVE_LIBDW_SUPPORT. So I want the makefile variable
> > > PERF_HAVE_LIBDW_REGS to guard the #define HAVE_LIBDW_SUPPORT, rather
> > > than what is being argued by yourself and Namhyung that the #define
> > > HAVE_LIBDW_SUPPORT be guarded by a variable called
> > > PERF_HAVE_DWARF_REGS and that is only set when NO_LIBDW isn't set.
> >
> > It will be only used with the libdw, but I don't care.
> > "HAVE_DWARF_REG" (internal config, just indicates the arch implemented
> > feature) simply means there is `arch/XXX/util/dwarf-regs.c`.
> > Also the APIs provided by the dwarf-regs.c are still based on DWARF
> > standard, which defines registers by number like DW_OP_reg[0-31].
> > So the mapping of these suffix number and actual register must be
> > defined for each architecture.
> >
> > That is why I had introduced dwarf-regs.c and call it "dwarf"-regs.
> > Even if the implementation depends on libdw, this dwarf-regs.c is
> > still based on DWARF standard.
>
> You seem to be missing the point of the series which is to clean up
> inconsistencies where dwarf is used to mean libdw. Here we have libdw
> guarding a #define with DWARF in the name, it should have libdw in the
> name as the patch cleans up. This is a coding thing and not a dwarf
> specificatin thing.
>
> > > We've made a digression into the name dwarf for a reason I can't
> > > fathom, at best it is inconsistent. Having dwarf registers is like
> > > having a bright sun or numeric numbers, it is a truism (playing devils
> > > advocate maybe if there were an ELF file format for postscript we
> > > could have a dwarf specification without registers). Anyway, I'm
> > > trying to connect the dots that libdw support controls the libdw type
> > > variables and defines hence not wanting 10 out of 11 patches applied.
> >
> > Oh, wait, I think we can apply other patches. I just don't like this
> > patch. I think the other patches are good. But this is
>
> Then we are intentionally aiming to be inconsistent, with libdw
> meaning dwarf with a #define that just states a truism. Arguably the
> code is better with none of the series applied.
I agree renaming libdw-specific parts. But the register is for DWARF,
not libdw even if it's currently used by libdw only. So I don't want
to rename it.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-03 22:48 ` Namhyung Kim
@ 2024-10-04 0:58 ` Ian Rogers
2024-10-04 5:12 ` Namhyung Kim
2024-10-04 14:32 ` Masami Hiramatsu
0 siblings, 2 replies; 51+ messages in thread
From: Ian Rogers @ 2024-10-04 0:58 UTC (permalink / raw)
To: Namhyung Kim
Cc: Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Oct 3, 2024 at 3:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Wed, Oct 02, 2024 at 07:27:16AM -0700, Ian Rogers wrote:
> > On Wed, Oct 2, 2024 at 6:56 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > >
> > > On Tue, 1 Oct 2024 18:31:43 -0700
> > > Ian Rogers <irogers@google.com> wrote:
> > >
> > > > On Tue, Oct 1, 2024 at 4:29 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > >
> > > > > On Tue, 1 Oct 2024 16:17:34 -0700
> > > > > Ian Rogers <irogers@google.com> wrote:
> > > > >
> > > > > > On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > >
> > > > > > > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > > > > > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > > > > > >
> > > > > > > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > > > > > > Ian Rogers <irogers@google.com> wrote:
> > > > > > > > >
> > > > > > > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > > >
> > > > > > > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > > > > > > >
> > > > > > > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > > > > > > not the DWARF standard itself.
> > > > > > > > > > > >
> > > > > > > > > > > > But we guard those definitions behind having libdw:
> > > > > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > > > > > > for the way things are at the moment.
> > > > > > > > > > >
> > > > > > > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > > > > > > >
> > > > > > > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > > > > > > in libunwind code but you are to some how know that the code only had
> > > > > > > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > > > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > > > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > > > > > > more intention revealing and so readable, etc.
> > > > > > > > >
> > > > > > > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > > > > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > > > > > > number and the dwarf-regs decode the number to actual register name.
> > > > > > > >
> > > > > > > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > > > > > > ```
> > > > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > > > ifndef NO_DWARF
> > > > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > > > endif
> > > > > > > > ```
> > > > > > > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > > > > > > ```
> > > > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > > > ifndef NO_LIBDW
> > > > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > > > endif
> > > > > > > > ```
> > > > > > > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > > > > > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > > > > > > for csky.
> > > > > > >
> > > > > > > I think this is totally fine and we can change the condition later if
> > > > > > > needed.
> > > > > > >
> > > > > > > After all, I don't think it's a big deal. Let's just call DWARF
> > > > > > > registers DWARF_REGS. :)
> > > > > >
> > > > > > The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> > > > > > not setting it while supporting call-graph dwarf with libunwind. It is
> > > > > > actively confusing.
> > > > >
> > > > > Does libunwind requires the dwarf regs? I think the dwarf regs information
> > > > > is only needed for analyzing dwarf register assignment, not stack unwinding.
> > > >
> > > > So you are saying the #define is guarding a libdw feature?
> > > > perf record/report --call-graph=dwarf is supported with either libdw
> > > > or libunwind. The dwarf support in the tool may come from more sources
> > > > hence wanting in this patch set to be clear what variable is guarding
> > > > what. PERF_HAVE_DWARF_REGS is set to 1 for a specific set of
> > > > architectures and only when libdw is present. The variable is saying
> > > > that libdw supports the notion of registers needed for the #define
> > > > HAVE_DWARF_SUPPORT that patch 9 in the series renamed to
> > > > HAVE_LIBDW_SUPPORT. So I want the makefile variable
> > > > PERF_HAVE_LIBDW_REGS to guard the #define HAVE_LIBDW_SUPPORT, rather
> > > > than what is being argued by yourself and Namhyung that the #define
> > > > HAVE_LIBDW_SUPPORT be guarded by a variable called
> > > > PERF_HAVE_DWARF_REGS and that is only set when NO_LIBDW isn't set.
> > >
> > > It will be only used with the libdw, but I don't care.
> > > "HAVE_DWARF_REG" (internal config, just indicates the arch implemented
> > > feature) simply means there is `arch/XXX/util/dwarf-regs.c`.
> > > Also the APIs provided by the dwarf-regs.c are still based on DWARF
> > > standard, which defines registers by number like DW_OP_reg[0-31].
> > > So the mapping of these suffix number and actual register must be
> > > defined for each architecture.
> > >
> > > That is why I had introduced dwarf-regs.c and call it "dwarf"-regs.
> > > Even if the implementation depends on libdw, this dwarf-regs.c is
> > > still based on DWARF standard.
> >
> > You seem to be missing the point of the series which is to clean up
> > inconsistencies where dwarf is used to mean libdw. Here we have libdw
> > guarding a #define with DWARF in the name, it should have libdw in the
> > name as the patch cleans up. This is a coding thing and not a dwarf
> > specificatin thing.
> >
> > > > We've made a digression into the name dwarf for a reason I can't
> > > > fathom, at best it is inconsistent. Having dwarf registers is like
> > > > having a bright sun or numeric numbers, it is a truism (playing devils
> > > > advocate maybe if there were an ELF file format for postscript we
> > > > could have a dwarf specification without registers). Anyway, I'm
> > > > trying to connect the dots that libdw support controls the libdw type
> > > > variables and defines hence not wanting 10 out of 11 patches applied.
> > >
> > > Oh, wait, I think we can apply other patches. I just don't like this
> > > patch. I think the other patches are good. But this is
> >
> > Then we are intentionally aiming to be inconsistent, with libdw
> > meaning dwarf with a #define that just states a truism. Arguably the
> > code is better with none of the series applied.
>
> I agree renaming libdw-specific parts. But the register is for DWARF,
> not libdw even if it's currently used by libdw only. So I don't want
> to rename it.
So your objection is that we have files called:
tools/perf/arch/*/util/dwarf-regs.c
and PERF_HAVE_DRWARF_REGS is an indication that this file exists. This
file declares a single get_arch_regnum function. The building of the
file after this series is:
perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
My objection is that PERF_HAVE_DWARF_REGS is controlling the #define
HAVE_LIBDW_SUPPORT, so dwarf (that can mean libunwind, libdw, etc.) is
guarding having libdw which is backward and part of what this series
has been trying to clean up.
If we rename tools/perf/arch/*/util/dwarf-regs.c to
tools/perf/arch/*/util/libdw-helpers.c the PERF_HAVE_DWARF_REGS can be
renamed to PERF_HAVE_LIBDW_HELPERS to align. Then
PERF_HAVE_LIBDW_HELPERS guarding the #define PERF_HAVE_LIBDW makes
sense to me and I think we achieve the filename alignment you are
looking for.
Yes get_arch_regnum could make sense out of libdw and needn't just be
a helper for it, but let's worry about that when there's a need.
What's confusing at the moment is does libdw provide dwarf support,
which I'd say is expected, or does dwarf provide libdw support?
Thanks,
Ian
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-04 0:58 ` Ian Rogers
@ 2024-10-04 5:12 ` Namhyung Kim
2024-10-04 14:45 ` Masami Hiramatsu
2024-10-04 14:32 ` Masami Hiramatsu
1 sibling, 1 reply; 51+ messages in thread
From: Namhyung Kim @ 2024-10-04 5:12 UTC (permalink / raw)
To: Ian Rogers
Cc: Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, Oct 03, 2024 at 05:58:13PM -0700, Ian Rogers wrote:
> On Thu, Oct 3, 2024 at 3:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > I agree renaming libdw-specific parts. But the register is for DWARF,
> > not libdw even if it's currently used by libdw only. So I don't want
> > to rename it.
>
> So your objection is that we have files called:
> tools/perf/arch/*/util/dwarf-regs.c
> and PERF_HAVE_DRWARF_REGS is an indication that this file exists. This
> file declares a single get_arch_regnum function. The building of the
> file after this series is:
> perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
Well.. I think we can even make it
perf-util-y += dwarf-regs.o
since it doesn't have any dependency on libdw. But it'd be inefficent
to ship the dead code and data. Anyway we may remove the condition to
define the PERF_HAVE_DWARF_REGS like below.
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 67b4969a673836eb..f1eb1ee1ea25ca53 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifndef NO_DWARF
PERF_HAVE_DWARF_REGS := 1
-endif
HAVE_KVM_STAT_SUPPORT := 1
PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
PERF_HAVE_JITDUMP := 1
>
> My objection is that PERF_HAVE_DWARF_REGS is controlling the #define
> HAVE_LIBDW_SUPPORT, so dwarf (that can mean libunwind, libdw, etc.) is
> guarding having libdw which is backward and part of what this series
> has been trying to clean up.
Why not? If the arch doesn't define DWARF registers, it can refuse
libdw support because it won't work well.
>
> If we rename tools/perf/arch/*/util/dwarf-regs.c to
> tools/perf/arch/*/util/libdw-helpers.c the PERF_HAVE_DWARF_REGS can be
> renamed to PERF_HAVE_LIBDW_HELPERS to align. Then
> PERF_HAVE_LIBDW_HELPERS guarding the #define PERF_HAVE_LIBDW makes
> sense to me and I think we achieve the filename alignment you are
> looking for.
I don't think it's a good idea. The logic is not specific to libdw.
>
> Yes get_arch_regnum could make sense out of libdw and needn't just be
> a helper for it, but let's worry about that when there's a need.
> What's confusing at the moment is does libdw provide dwarf support,
> which I'd say is expected, or does dwarf provide libdw support?
As I said, it's about refusing libdw.
ifndef NO_LIBDW
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
$(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
NO_LIBDW := 1
else
CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += ${DWARFLIBS}
$(call detected,CONFIG_DWARF)
endif # PERF_HAVE_DWARF_REGS
endif # NO_LIBDW
Thanks,
Namhyung
^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-04 5:12 ` Namhyung Kim
@ 2024-10-04 14:45 ` Masami Hiramatsu
2024-10-04 15:15 ` Ian Rogers
0 siblings, 1 reply; 51+ messages in thread
From: Masami Hiramatsu @ 2024-10-04 14:45 UTC (permalink / raw)
To: Namhyung Kim
Cc: Ian Rogers, Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, 3 Oct 2024 22:12:25 -0700
Namhyung Kim <namhyung@kernel.org> wrote:
> On Thu, Oct 03, 2024 at 05:58:13PM -0700, Ian Rogers wrote:
> > On Thu, Oct 3, 2024 at 3:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > I agree renaming libdw-specific parts. But the register is for DWARF,
> > > not libdw even if it's currently used by libdw only. So I don't want
> > > to rename it.
> >
> > So your objection is that we have files called:
> > tools/perf/arch/*/util/dwarf-regs.c
> > and PERF_HAVE_DRWARF_REGS is an indication that this file exists. This
> > file declares a single get_arch_regnum function. The building of the
> > file after this series is:
> > perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
>
> Well.. I think we can even make it
>
> perf-util-y += dwarf-regs.o
>
> since it doesn't have any dependency on libdw. But it'd be inefficent
> to ship the dead code and data. Anyway we may remove the condition to
> define the PERF_HAVE_DWARF_REGS like below.
>
> diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
> index 67b4969a673836eb..f1eb1ee1ea25ca53 100644
> --- a/tools/perf/arch/x86/Makefile
> +++ b/tools/perf/arch/x86/Makefile
> @@ -1,7 +1,5 @@
> # SPDX-License-Identifier: GPL-2.0
> -ifndef NO_DWARF
> PERF_HAVE_DWARF_REGS := 1
> -endif
> HAVE_KVM_STAT_SUPPORT := 1
> PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> PERF_HAVE_JITDUMP := 1
>
> >
> > My objection is that PERF_HAVE_DWARF_REGS is controlling the #define
> > HAVE_LIBDW_SUPPORT, so dwarf (that can mean libunwind, libdw, etc.) is
> > guarding having libdw which is backward and part of what this series
> > has been trying to clean up.
>
> Why not? If the arch doesn't define DWARF registers, it can refuse
> libdw support because it won't work well.
It actually does not DWARF registers, but just "dwarf-regs.c" file
since arch should define DWARF registers if the compiler generates
the DWARF.
Here the flag means only "we implemented dwarf-regs.c file for this
arch." So if it is called as "libdw-helper.c" then we can rename the
flag as PERF_HAVE_ARCH_LIBDW_HELPER simply.
> > If we rename tools/perf/arch/*/util/dwarf-regs.c to
> > tools/perf/arch/*/util/libdw-helpers.c the PERF_HAVE_DWARF_REGS can be
> > renamed to PERF_HAVE_LIBDW_HELPERS to align. Then
> > PERF_HAVE_LIBDW_HELPERS guarding the #define PERF_HAVE_LIBDW makes
> > sense to me and I think we achieve the filename alignment you are
> > looking for.
>
> I don't think it's a good idea. The logic is not specific to libdw.
Yes, the logic (DWARF register mapping to the ISA register name) is
not libdw. But I think we can also implement it in "libdw-helper.c".
(In fact, this implementation does not depend only on Dwarf, but
rather on the convenience of ftrace.)
> >
> > Yes get_arch_regnum could make sense out of libdw and needn't just be
> > a helper for it, but let's worry about that when there's a need.
> > What's confusing at the moment is does libdw provide dwarf support,
> > which I'd say is expected, or does dwarf provide libdw support?
>
> As I said, it's about refusing libdw.
I think Ian pointed this part, even if libdw is available, dwarf-regs.c
controls its usage, but libunwind is not.
>
> ifndef NO_LIBDW
> ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
I think *this message* is the root cause of this discussion. It should be
changed to
"DWARF register mappings have not been defined for architecture $(SRCARCH), libdw support disabled."
or (if changed to libdw-helper)
"libdw-helper.c is not implemented for architecture $(SRCARCH), libdw support disabled."
Thank you,
> NO_LIBDW := 1
> else
> CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
> LDFLAGS += $(LIBDW_LDFLAGS)
> EXTLIBS += ${DWARFLIBS}
> $(call detected,CONFIG_DWARF)
> endif # PERF_HAVE_DWARF_REGS
> endif # NO_LIBDW
>
> Thanks,
> Namhyung
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-04 14:45 ` Masami Hiramatsu
@ 2024-10-04 15:15 ` Ian Rogers
2024-10-04 19:23 ` Namhyung Kim
0 siblings, 1 reply; 51+ messages in thread
From: Ian Rogers @ 2024-10-04 15:15 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Fri, Oct 4, 2024 at 7:45 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> On Thu, 3 Oct 2024 22:12:25 -0700
> Namhyung Kim <namhyung@kernel.org> wrote:
>
> > On Thu, Oct 03, 2024 at 05:58:13PM -0700, Ian Rogers wrote:
> > > On Thu, Oct 3, 2024 at 3:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > I agree renaming libdw-specific parts. But the register is for DWARF,
> > > > not libdw even if it's currently used by libdw only. So I don't want
> > > > to rename it.
> > >
> > > So your objection is that we have files called:
> > > tools/perf/arch/*/util/dwarf-regs.c
> > > and PERF_HAVE_DRWARF_REGS is an indication that this file exists. This
> > > file declares a single get_arch_regnum function. The building of the
> > > file after this series is:
> > > perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
> >
> > Well.. I think we can even make it
> >
> > perf-util-y += dwarf-regs.o
> >
> > since it doesn't have any dependency on libdw. But it'd be inefficent
> > to ship the dead code and data. Anyway we may remove the condition to
> > define the PERF_HAVE_DWARF_REGS like below.
> >
> > diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
> > index 67b4969a673836eb..f1eb1ee1ea25ca53 100644
> > --- a/tools/perf/arch/x86/Makefile
> > +++ b/tools/perf/arch/x86/Makefile
> > @@ -1,7 +1,5 @@
> > # SPDX-License-Identifier: GPL-2.0
> > -ifndef NO_DWARF
> > PERF_HAVE_DWARF_REGS := 1
> > -endif
> > HAVE_KVM_STAT_SUPPORT := 1
> > PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> > PERF_HAVE_JITDUMP := 1
> >
> > >
> > > My objection is that PERF_HAVE_DWARF_REGS is controlling the #define
> > > HAVE_LIBDW_SUPPORT, so dwarf (that can mean libunwind, libdw, etc.) is
> > > guarding having libdw which is backward and part of what this series
> > > has been trying to clean up.
> >
> > Why not? If the arch doesn't define DWARF registers, it can refuse
> > libdw support because it won't work well.
>
> It actually does not DWARF registers, but just "dwarf-regs.c" file
> since arch should define DWARF registers if the compiler generates
> the DWARF.
> Here the flag means only "we implemented dwarf-regs.c file for this
> arch." So if it is called as "libdw-helper.c" then we can rename the
> flag as PERF_HAVE_ARCH_LIBDW_HELPER simply.
>
> > > If we rename tools/perf/arch/*/util/dwarf-regs.c to
> > > tools/perf/arch/*/util/libdw-helpers.c the PERF_HAVE_DWARF_REGS can be
> > > renamed to PERF_HAVE_LIBDW_HELPERS to align. Then
> > > PERF_HAVE_LIBDW_HELPERS guarding the #define PERF_HAVE_LIBDW makes
> > > sense to me and I think we achieve the filename alignment you are
> > > looking for.
> >
> > I don't think it's a good idea. The logic is not specific to libdw.
>
> Yes, the logic (DWARF register mapping to the ISA register name) is
> not libdw. But I think we can also implement it in "libdw-helper.c".
> (In fact, this implementation does not depend only on Dwarf, but
> rather on the convenience of ftrace.)
>
> > >
> > > Yes get_arch_regnum could make sense out of libdw and needn't just be
> > > a helper for it, but let's worry about that when there's a need.
> > > What's confusing at the moment is does libdw provide dwarf support,
> > > which I'd say is expected, or does dwarf provide libdw support?
> >
> > As I said, it's about refusing libdw.
>
> I think Ian pointed this part, even if libdw is available, dwarf-regs.c
> controls its usage, but libunwind is not.
>
> >
> > ifndef NO_LIBDW
> > ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> > $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
>
> I think *this message* is the root cause of this discussion. It should be
> changed to
>
> "DWARF register mappings have not been defined for architecture $(SRCARCH), libdw support disabled."
>
> or (if changed to libdw-helper)
>
> "libdw-helper.c is not implemented for architecture $(SRCARCH), libdw support disabled."
So looking at the code I think the whole thing looks wrong. The
get_arch_regnum function is used by get_dwarf_regnum which is used in
2 places in annotate.c:
```
static int extract_reg_offset(struct arch *arch, const char *str,
struct annotated_op_loc *op_loc)
...
int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl,
struct annotated_insn_loc *loc)
```
So these functions are passing in an architecture. In get_dwarf_regnum:
```
/* Return DWARF register number from architecture register name */
int get_dwarf_regnum(const char *name, unsigned int machine)
{
char *regname = strdup(name);
int reg = -1;
char *p;
if (regname == NULL)
return -EINVAL;
/* For convenience, remove trailing characters */
p = strpbrk(regname, " ,)");
if (p)
*p = '\0';
switch (machine) {
case EM_NONE: /* Generic arch - use host arch */
reg = get_arch_regnum(regname);
break;
default:
pr_err("ELF MACHINE %x is not supported.\n", machine);
}
free(regname);
return reg;
}
```
But why, if the machine is EM_X86_64 and I'm on an x86-64, can't I
call get_arch_regnum? The code should be something like:
```
if (machine == EM_NONE) {
#ifdef __x86_64__
machine = EM_X86_64;
#elf...
```
Once we have an architecture specific machine then instead of
get_arch_regnum it should call get_x86_64_regnum or
get_aarch64_regnum.
```
switch(machine) }
case EM_X86_64:
reg = get_x86_64_regnum(regname);
break;
...
```
Is this better? Yes, it means that the annotate logic can work if,
say, annotating/disassembling an ARM binary on an x86-64.
So we need to pull all the tools/perf/arch/<arch>/util/dwarf-regs.c
files into tools/perf/util/dwarf-regs-<arch>.c files. We need to
rename the get_arch_regnum to reflect the <arch> in the file name. The
Makefile logic can include all of this unconditionally and
PERF_HAVE_DWARF_REGS can just be removed. In the process the ability
to annotate binaries from one architecture on another is improved. It
needn't be the case that we have dwarf regs for the architecture perf
is being run on as we may be annotating an x86-64 binary where there
is support.
What's strange is that get_dwarf_regstr in the common code already
does things pretty much this way. This whole Makefile, arch, weak
function, PERF_HAVE... logic just looks like a mistake that is making
the tool worse than it needs to be. I think this is frequently the
case with code in arch/, a lot of the functionality there can be moved
into pmu.c and doing things conditional on the pmu, which is
inherently architecture dependent. This can fix unusual cases of say
running the perf tool on user land qemu, where we may have an ARM perf
binary but see the PMUs of an x86.
I can work to put this into a v2 so please scream if my reasoning
doesn't make sense.
Thanks,
Ian
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-04 15:15 ` Ian Rogers
@ 2024-10-04 19:23 ` Namhyung Kim
0 siblings, 0 replies; 51+ messages in thread
From: Namhyung Kim @ 2024-10-04 19:23 UTC (permalink / raw)
To: Ian Rogers
Cc: Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Fri, Oct 04, 2024 at 08:15:22AM -0700, Ian Rogers wrote:
> On Fri, Oct 4, 2024 at 7:45 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > On Thu, 3 Oct 2024 22:12:25 -0700
> > Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > > On Thu, Oct 03, 2024 at 05:58:13PM -0700, Ian Rogers wrote:
> > > > On Thu, Oct 3, 2024 at 3:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > I agree renaming libdw-specific parts. But the register is for DWARF,
> > > > > not libdw even if it's currently used by libdw only. So I don't want
> > > > > to rename it.
> > > >
> > > > So your objection is that we have files called:
> > > > tools/perf/arch/*/util/dwarf-regs.c
> > > > and PERF_HAVE_DRWARF_REGS is an indication that this file exists. This
> > > > file declares a single get_arch_regnum function. The building of the
> > > > file after this series is:
> > > > perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
> > >
> > > Well.. I think we can even make it
> > >
> > > perf-util-y += dwarf-regs.o
> > >
> > > since it doesn't have any dependency on libdw. But it'd be inefficent
> > > to ship the dead code and data. Anyway we may remove the condition to
> > > define the PERF_HAVE_DWARF_REGS like below.
> > >
> > > diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
> > > index 67b4969a673836eb..f1eb1ee1ea25ca53 100644
> > > --- a/tools/perf/arch/x86/Makefile
> > > +++ b/tools/perf/arch/x86/Makefile
> > > @@ -1,7 +1,5 @@
> > > # SPDX-License-Identifier: GPL-2.0
> > > -ifndef NO_DWARF
> > > PERF_HAVE_DWARF_REGS := 1
> > > -endif
> > > HAVE_KVM_STAT_SUPPORT := 1
> > > PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
> > > PERF_HAVE_JITDUMP := 1
> > >
> > > >
> > > > My objection is that PERF_HAVE_DWARF_REGS is controlling the #define
> > > > HAVE_LIBDW_SUPPORT, so dwarf (that can mean libunwind, libdw, etc.) is
> > > > guarding having libdw which is backward and part of what this series
> > > > has been trying to clean up.
> > >
> > > Why not? If the arch doesn't define DWARF registers, it can refuse
> > > libdw support because it won't work well.
> >
> > It actually does not DWARF registers, but just "dwarf-regs.c" file
> > since arch should define DWARF registers if the compiler generates
> > the DWARF.
> > Here the flag means only "we implemented dwarf-regs.c file for this
> > arch." So if it is called as "libdw-helper.c" then we can rename the
> > flag as PERF_HAVE_ARCH_LIBDW_HELPER simply.
> >
> > > > If we rename tools/perf/arch/*/util/dwarf-regs.c to
> > > > tools/perf/arch/*/util/libdw-helpers.c the PERF_HAVE_DWARF_REGS can be
> > > > renamed to PERF_HAVE_LIBDW_HELPERS to align. Then
> > > > PERF_HAVE_LIBDW_HELPERS guarding the #define PERF_HAVE_LIBDW makes
> > > > sense to me and I think we achieve the filename alignment you are
> > > > looking for.
> > >
> > > I don't think it's a good idea. The logic is not specific to libdw.
> >
> > Yes, the logic (DWARF register mapping to the ISA register name) is
> > not libdw. But I think we can also implement it in "libdw-helper.c".
> > (In fact, this implementation does not depend only on Dwarf, but
> > rather on the convenience of ftrace.)
> >
> > > >
> > > > Yes get_arch_regnum could make sense out of libdw and needn't just be
> > > > a helper for it, but let's worry about that when there's a need.
> > > > What's confusing at the moment is does libdw provide dwarf support,
> > > > which I'd say is expected, or does dwarf provide libdw support?
> > >
> > > As I said, it's about refusing libdw.
> >
> > I think Ian pointed this part, even if libdw is available, dwarf-regs.c
> > controls its usage, but libunwind is not.
> >
> > >
> > > ifndef NO_LIBDW
> > > ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
> > > $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled)
> >
> > I think *this message* is the root cause of this discussion. It should be
> > changed to
> >
> > "DWARF register mappings have not been defined for architecture $(SRCARCH), libdw support disabled."
> >
> > or (if changed to libdw-helper)
> >
> > "libdw-helper.c is not implemented for architecture $(SRCARCH), libdw support disabled."
>
> So looking at the code I think the whole thing looks wrong. The
> get_arch_regnum function is used by get_dwarf_regnum which is used in
> 2 places in annotate.c:
> ```
> static int extract_reg_offset(struct arch *arch, const char *str,
> struct annotated_op_loc *op_loc)
> ...
> int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl,
> struct annotated_insn_loc *loc)
> ```
> So these functions are passing in an architecture. In get_dwarf_regnum:
> ```
> /* Return DWARF register number from architecture register name */
> int get_dwarf_regnum(const char *name, unsigned int machine)
> {
> char *regname = strdup(name);
> int reg = -1;
> char *p;
>
> if (regname == NULL)
> return -EINVAL;
>
> /* For convenience, remove trailing characters */
> p = strpbrk(regname, " ,)");
> if (p)
> *p = '\0';
>
> switch (machine) {
> case EM_NONE: /* Generic arch - use host arch */
> reg = get_arch_regnum(regname);
> break;
> default:
> pr_err("ELF MACHINE %x is not supported.\n", machine);
> }
> free(regname);
> return reg;
> }
> ```
> But why, if the machine is EM_X86_64 and I'm on an x86-64, can't I
> call get_arch_regnum? The code should be something like:
> ```
> if (machine == EM_NONE) {
> #ifdef __x86_64__
> machine = EM_X86_64;
> #elf...
> ```
> Once we have an architecture specific machine then instead of
> get_arch_regnum it should call get_x86_64_regnum or
> get_aarch64_regnum.
> ```
> switch(machine) }
> case EM_X86_64:
> reg = get_x86_64_regnum(regname);
> break;
> ...
> ```
> Is this better? Yes, it means that the annotate logic can work if,
> say, annotating/disassembling an ARM binary on an x86-64.
>
> So we need to pull all the tools/perf/arch/<arch>/util/dwarf-regs.c
> files into tools/perf/util/dwarf-regs-<arch>.c files. We need to
> rename the get_arch_regnum to reflect the <arch> in the file name. The
> Makefile logic can include all of this unconditionally and
> PERF_HAVE_DWARF_REGS can just be removed. In the process the ability
> to annotate binaries from one architecture on another is improved. It
> needn't be the case that we have dwarf regs for the architecture perf
> is being run on as we may be annotating an x86-64 binary where there
> is support.
>
> What's strange is that get_dwarf_regstr in the common code already
> does things pretty much this way. This whole Makefile, arch, weak
> function, PERF_HAVE... logic just looks like a mistake that is making
> the tool worse than it needs to be. I think this is frequently the
> case with code in arch/, a lot of the functionality there can be moved
> into pmu.c and doing things conditional on the pmu, which is
> inherently architecture dependent. This can fix unusual cases of say
> running the perf tool on user land qemu, where we may have an ARM perf
> binary but see the PMUs of an x86.
>
> I can work to put this into a v2 so please scream if my reasoning
> doesn't make sense.
Sounds good, it'd be easier if we merge patch 1-10 first and you would
work on the register thing separately.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS
2024-10-04 0:58 ` Ian Rogers
2024-10-04 5:12 ` Namhyung Kim
@ 2024-10-04 14:32 ` Masami Hiramatsu
1 sibling, 0 replies; 51+ messages in thread
From: Masami Hiramatsu @ 2024-10-04 14:32 UTC (permalink / raw)
To: Ian Rogers
Cc: Namhyung Kim, Masami Hiramatsu, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, Kan Liang, John Garry, Will Deacon,
James Clark, Mike Leach, Leo Yan, Guo Ren, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Nick Terrell, Guilherme Amadio,
Changbin Du, Steinar H. Gunderson, Aditya Gupta, Athira Rajeev,
Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain, Anup Patel,
Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei, Dima Kogan,
Alexander Lobakin, David S. Miller, Przemek Kitszel, linux-kernel,
linux-perf-users, Yang Jihong
On Thu, 3 Oct 2024 17:58:13 -0700
Ian Rogers <irogers@google.com> wrote:
> On Thu, Oct 3, 2024 at 3:48 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Wed, Oct 02, 2024 at 07:27:16AM -0700, Ian Rogers wrote:
> > > On Wed, Oct 2, 2024 at 6:56 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > >
> > > > On Tue, 1 Oct 2024 18:31:43 -0700
> > > > Ian Rogers <irogers@google.com> wrote:
> > > >
> > > > > On Tue, Oct 1, 2024 at 4:29 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > > >
> > > > > > On Tue, 1 Oct 2024 16:17:34 -0700
> > > > > > Ian Rogers <irogers@google.com> wrote:
> > > > > >
> > > > > > > On Tue, Oct 1, 2024 at 4:10 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > >
> > > > > > > > On Mon, Sep 30, 2024 at 09:02:36PM -0700, Ian Rogers wrote:
> > > > > > > > > On Sat, Sep 28, 2024 at 7:35 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> > > > > > > > > >
> > > > > > > > > > On Fri, 27 Sep 2024 11:15:21 -0700
> > > > > > > > > > Ian Rogers <irogers@google.com> wrote:
> > > > > > > > > >
> > > > > > > > > > > On Fri, Sep 27, 2024 at 10:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > On Thu, Sep 26, 2024 at 12:55:18PM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > On Thu, Sep 26, 2024 at 12:40 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > On Thu, Sep 26, 2024 at 05:47:16AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > > > On Wed, Sep 25, 2024 at 8:27 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > On Tue, Sep 24, 2024 at 09:04:18AM -0700, Ian Rogers wrote:
> > > > > > > > > > > > > > > > > The name dwarf can imply libunwind support, whereas
> > > > > > > > > > > > > > > > > PERF_HAVE_DWARF_REGS is only enabled with libdw support. Rename to
> > > > > > > > > > > > > > > > > make it clearer there is a libdw connection.
> > > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > > While it only covers libdw, I think the idea of this macro is whether
> > > > > > > > > > > > > > > > the arch has register mappings defined in DWARF standard. So I think
> > > > > > > > > > > > > > > > it's better to keep the name for this case.
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > How can the dwarf standard exist for an arch but not define registers?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I meant it's about the arch code in the perf tools to have the mapping,
> > > > > > > > > > > > > > not the DWARF standard itself.
> > > > > > > > > > > > >
> > > > > > > > > > > > > But we guard those definitions behind having libdw:
> > > > > > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/x86/Makefile?h=perf-tools-next#n3
> > > > > > > > > > > > > So we only have the regs if libdw is present, not if dwarf is in use
> > > > > > > > > > > > > for libunwind/libdw. Hence wanting to be specific that they are just a
> > > > > > > > > > > > > libdw and not a dwarf thing. Trying to use the regs in libunwind code
> > > > > > > > > > > > > would be broken. That could change but I wanted to make the code clear
> > > > > > > > > > > > > for the way things are at the moment.
> > > > > > > > > > > >
> > > > > > > > > > > > I understand your point but calling it LIBDW_REGS looks unnatural to me.
> > > > > > > > > > >
> > > > > > > > > > > I don't follow. Wouldn't it be unnatural to see PERF_HAVE_DWARF_REGS
> > > > > > > > > > > in libunwind code but you are to some how know that the code only had
> > > > > > > > > > > meaning if libdw was present? I don't like the implication that DWARF
> > > > > > > > > > > means LIBDW as throughout the code it doesn't. I think the name
> > > > > > > > > > > PERF_HAVE_LIBDW_REGS better captures how the code is, makes the code
> > > > > > > > > > > more intention revealing and so readable, etc.
> > > > > > > > > >
> > > > > > > > > > I agree with Namhyung this point. dwarf-regs is defined only by the
> > > > > > > > > > DWARF standard, not libdw only. The standard encode registers by a digit
> > > > > > > > > > number and the dwarf-regs decode the number to actual register name.
> > > > > > > > >
> > > > > > > > > The code is not making a statement about the DWARF standard, take arch/csky:
> > > > > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/csky/Makefile?h=perf-tools-next
> > > > > > > > > ```
> > > > > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > > > > ifndef NO_DWARF
> > > > > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > > > > endif
> > > > > > > > > ```
> > > > > > > > > in the patch series NO_DWARF becomes NO_LIBDW, so it is now:
> > > > > > > > > ```
> > > > > > > > > # SPDX-License-Identifier: GPL-2.0-only
> > > > > > > > > ifndef NO_LIBDW
> > > > > > > > > PERF_HAVE_DWARF_REGS := 1
> > > > > > > > > endif
> > > > > > > > > ```
> > > > > > > > > So the Makefile says that PERF_HAVE_DWARF_REGS is dependent on having
> > > > > > > > > NO_LIBDW, that is having libdw implies PERF_HAVE_DWARF_REGS is defined
> > > > > > > > > for csky.
> > > > > > > >
> > > > > > > > I think this is totally fine and we can change the condition later if
> > > > > > > > needed.
> > > > > > > >
> > > > > > > > After all, I don't think it's a big deal. Let's just call DWARF
> > > > > > > > registers DWARF_REGS. :)
> > > > > > >
> > > > > > > The define is called PERF_HAVE_DWARF_REGS, notice the HAVE, but we're
> > > > > > > not setting it while supporting call-graph dwarf with libunwind. It is
> > > > > > > actively confusing.
> > > > > >
> > > > > > Does libunwind requires the dwarf regs? I think the dwarf regs information
> > > > > > is only needed for analyzing dwarf register assignment, not stack unwinding.
> > > > >
> > > > > So you are saying the #define is guarding a libdw feature?
> > > > > perf record/report --call-graph=dwarf is supported with either libdw
> > > > > or libunwind. The dwarf support in the tool may come from more sources
> > > > > hence wanting in this patch set to be clear what variable is guarding
> > > > > what. PERF_HAVE_DWARF_REGS is set to 1 for a specific set of
> > > > > architectures and only when libdw is present. The variable is saying
> > > > > that libdw supports the notion of registers needed for the #define
> > > > > HAVE_DWARF_SUPPORT that patch 9 in the series renamed to
> > > > > HAVE_LIBDW_SUPPORT. So I want the makefile variable
> > > > > PERF_HAVE_LIBDW_REGS to guard the #define HAVE_LIBDW_SUPPORT, rather
> > > > > than what is being argued by yourself and Namhyung that the #define
> > > > > HAVE_LIBDW_SUPPORT be guarded by a variable called
> > > > > PERF_HAVE_DWARF_REGS and that is only set when NO_LIBDW isn't set.
> > > >
> > > > It will be only used with the libdw, but I don't care.
> > > > "HAVE_DWARF_REG" (internal config, just indicates the arch implemented
> > > > feature) simply means there is `arch/XXX/util/dwarf-regs.c`.
> > > > Also the APIs provided by the dwarf-regs.c are still based on DWARF
> > > > standard, which defines registers by number like DW_OP_reg[0-31].
> > > > So the mapping of these suffix number and actual register must be
> > > > defined for each architecture.
> > > >
> > > > That is why I had introduced dwarf-regs.c and call it "dwarf"-regs.
> > > > Even if the implementation depends on libdw, this dwarf-regs.c is
> > > > still based on DWARF standard.
> > >
> > > You seem to be missing the point of the series which is to clean up
> > > inconsistencies where dwarf is used to mean libdw. Here we have libdw
> > > guarding a #define with DWARF in the name, it should have libdw in the
> > > name as the patch cleans up. This is a coding thing and not a dwarf
> > > specificatin thing.
> > >
> > > > > We've made a digression into the name dwarf for a reason I can't
> > > > > fathom, at best it is inconsistent. Having dwarf registers is like
> > > > > having a bright sun or numeric numbers, it is a truism (playing devils
> > > > > advocate maybe if there were an ELF file format for postscript we
> > > > > could have a dwarf specification without registers). Anyway, I'm
> > > > > trying to connect the dots that libdw support controls the libdw type
> > > > > variables and defines hence not wanting 10 out of 11 patches applied.
> > > >
> > > > Oh, wait, I think we can apply other patches. I just don't like this
> > > > patch. I think the other patches are good. But this is
> > >
> > > Then we are intentionally aiming to be inconsistent, with libdw
> > > meaning dwarf with a #define that just states a truism. Arguably the
> > > code is better with none of the series applied.
> >
> > I agree renaming libdw-specific parts. But the register is for DWARF,
> > not libdw even if it's currently used by libdw only. So I don't want
> > to rename it.
>
> So your objection is that we have files called:
> tools/perf/arch/*/util/dwarf-regs.c
> and PERF_HAVE_DRWARF_REGS is an indication that this file exists. This
> file declares a single get_arch_regnum function. The building of the
> file after this series is:
> perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
>
> My objection is that PERF_HAVE_DWARF_REGS is controlling the #define
> HAVE_LIBDW_SUPPORT, so dwarf (that can mean libunwind, libdw, etc.) is
> guarding having libdw which is backward and part of what this series
> has been trying to clean up.
OK.
>
> If we rename tools/perf/arch/*/util/dwarf-regs.c to
> tools/perf/arch/*/util/libdw-helpers.c the PERF_HAVE_DWARF_REGS can be
> renamed to PERF_HAVE_LIBDW_HELPERS to align. Then
> PERF_HAVE_LIBDW_HELPERS guarding the #define PERF_HAVE_LIBDW makes
> sense to me and I think we achieve the filename alignment you are
> looking for.
Yeah, I think that is OK to me.
> Yes get_arch_regnum could make sense out of libdw and needn't just be
> a helper for it, but let's worry about that when there's a need.
> What's confusing at the moment is does libdw provide dwarf support,
> which I'd say is expected, or does dwarf provide libdw support?
You missed to cut the word, PERF_HAVE_DWARF_REGS means "perf have
'dwarf-regs.c'". If dwarf-regs.c is not there, we can not enable
libdw support because it causes linker error.
So, if the file name simply changed to libdw-helper.c, I think we can
change it.
Thank you,
>
> Thanks,
> Ian
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH v1 00/11] Libdw/dwarf build clean up
2024-09-24 16:04 [PATCH v1 00/11] Libdw/dwarf build clean up Ian Rogers
` (10 preceding siblings ...)
2024-09-24 16:04 ` [PATCH v1 11/11] perf build: Rename PERF_HAVE_DWARF_REGS to PERF_HAVE_LIBDW_REGS Ian Rogers
@ 2024-09-24 19:44 ` Leo Yan
11 siblings, 0 replies; 51+ messages in thread
From: Leo Yan @ 2024-09-24 19:44 UTC (permalink / raw)
To: Ian Rogers, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, Kan Liang, John Garry, Will Deacon, James Clark,
Mike Leach, Leo Yan, Guo Ren, Paul Walmsley, Palmer Dabbelt,
Albert Ou, Nick Terrell, Guilherme Amadio, Changbin Du,
Steinar H. Gunderson, Masami Hiramatsu (Google), Aditya Gupta,
Athira Rajeev, Masahiro Yamada, Huacai Chen, Bibo Mao, Kajol Jain,
Anup Patel, Shenlin Liang, Atish Patra, Oliver Upton, Chen Pei,
Dima Kogan, Alexander Lobakin, David S. Miller, Przemek Kitszel,
linux-kernel, linux-perf-users, Yang Jihong
On 9/24/2024 5:04 PM, Ian Rogers wrote:
> The patches remove the conditional compilation assuming the
> features are in libdw where the feature test is expanded to check
> there pressence.
>
> In the Makefile code dwarf tends to mean unwind or libdw support for
> dwarf things. To make it clearer when dwarf really just means libdw
> numerous build variables and defines are renamed.
>
> There is some tech debt in the changes as perf check still reports the
> values using the old name and for features that are no longer tested.
I built for Arm64 target with static and dynamic linkage, both can build
successfully in Ubuntu 24.04 and Debian bookworm. FWIW:
Tested-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 51+ messages in thread