KVM: arm64: fix include path for ring buffer implementation
PATCH 1/3 KVM: arm64: fix include path for ring buffer implementation
From: Arnd Bergmann <[email protected]>
The simple_ring_buffer.c file is in the source tree rather than generated at build time, so the include path is wrong when using separate object trees:
arch/arm64/kvm/hyp/nvhe/trace.c:16:10: fatal error: simple_ring_buffer.c: No such file or directory
16 | #include "simple_ring_buffer.c"
Include it from the source tree instead.
--- arch/arm64/kvm/hyp/nvhe/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/hyp/nvhe/Makefile +1 -1
@@ -33,7 +33,7 @@ hyp-obj-$(CONFIG_NVHE_EL2_TRACING) += clock.o trace.o events.o hyp-obj-y += $(lib-objs) # Path to simple_ring_buffer.c -CFLAGS_trace.nvhe.o += -I$(objtree)/kernel/trace/ +CFLAGS_trace.nvhe.o += -I$(srctree)/kernel/trace/ ## ## Build rules for compiling nVHE hyp code
Signature · 1 line
2.39.5
PATCH 2/3 tracing: add more symbols to whitelist
From: Arnd Bergmann <[email protected]>
Randconfig builds show a number of cryptic build errors from hitting undefined symbols in simple_ring_buffer.o:
make[7]: *** [/home/arnd/arm-soc/kernel/trace/Makefile:147: kernel/trace/simple_ring_buffer.o.checked] Error 1
These happen with CONFIG_TRACE_BRANCH_PROFILING, CONFIG_KASAN_HW_TAGS, CONFIG_STACKPROTECTOR, CONFIG_DEBUG_IRQFLAGS and indirectly from WARN_ON().
Add exceptions for each one that I have hit so far on arm64, x86_64 and arm randconfig builds.
Other architectures likely hit additional ones, so it would be nice to produce a little more verbose output that include the name of the missing symbols directly.
--- kernel/trace/Makefile | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/Makefile +2 -0
@@ -138,6 +138,8 @@ obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o # UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov __aeabi_unwind UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer +UNDEFINED_ALLOWLIST += ftrace_likely_update __hwasan_load __hwasan_store __hwasan_tag_memory +UNDEFINED_ALLOWLIST += warn_bogus_irq_restore warn_slowpath_fmt __stack_chk_guard UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) quiet_cmd_check_undefined = NM $<
Signature · 1 line
2.39.5
PATCH 3/3 KVM: arm64: tracing: add ftrace dependency
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
Selecting CONFIG_TRACE_REMOTE causes a build time warning when FTRACE is disabled:
WARNING: unmet direct dependencies detected for TRACE_REMOTE
Depends on [n]: FTRACE [=n]
Selected by [y]:
- NVHE_EL2_TRACING [=y] && VIRTUALIZATION [=y] && KVM [=y] && NVHE_EL2_DEBUG [=y] && TRACING [=y]
Add this as another dependency to ensure a clean build.
--- arch/arm64/kvm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/Kconfig +1 -1
@@ -78,7 +78,7 @@ if NVHE_EL2_DEBUG config NVHE_EL2_TRACING bool - depends on TRACING + depends on TRACING && FTRACE select TRACE_REMOTE default y
Signature · 1 line
2.39.5
Quoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The
simple_ring_buffer.cfile is in the source tree rather than generated at build time, so the include path is wrong when using separate object trees:
Quoted 7 lines
arch/arm64/kvm/hyp/nvhe/trace.c:16:10: fatal error:simple_ring_buffer.c: No such file or directory
16 | #include "simple_ring_buffer.c"Include it from the source tree instead.
Fixes 680a04c333fa ("KVM: arm64: Add tracing capability for the nVHE/pKVM hyp")Signed-off-by Arnd Bergmann <[email protected]>
I believe Marc has taken a fix already for that one
https://lore.kernel.org/all/[email protected]/
Quoted 20 lines
--- arch/arm64/kvm/hyp/nvhe/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kvm/hyp/nvhe/Makefile +1
-1@@ -33,7 +33,7 @@ hyp-obj-$(CONFIG_NVHE_EL2_TRACING) += clock.o trace.o events.o hyp-obj-y += $(lib-objs) # Path to simple_ring_buffer.c -CFLAGS_trace.nvhe.o += -I$(objtree)/kernel/trace/ +CFLAGS_trace.nvhe.o += -I$(srctree)/kernel/trace/ ## ## Build rules for compiling nVHE hyp codeSignature · 1 line
2.39.5
Re: [PATCH 2/3] tracing: add more symbols to whitelist
In reply to Arnd BergmannQuoted 39 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Randconfig builds show a number of cryptic build errors from hitting undefined symbols in simple_ring_buffer.o:
make[7]: *** [
/home/arnd/arm-soc/kernel/trace/Makefile:147:kernel/trace/simple_ring_buffer.o.checked] Error 1These happen with
CONFIG_TRACE_BRANCH_PROFILING,CONFIG_KASAN_HW_TAGS,CONFIG_STACKPROTECTOR,CONFIG_DEBUG_IRQFLAGSand indirectly fromWARN_ON().Add exceptions for each one that I have hit so far on arm64,
x86_64and arm randconfig builds.Other architectures likely hit additional ones, so it would be nice to produce a little more verbose output that include the name of the missing symbols directly.
Fixes a717943d8ecc ("tracing: Check for undefined symbols in simple_ring_buffer")Signed-off-by Arnd Bergmann <[email protected]>--- kernel/trace/Makefile | 2 ++ 1 file changed, 2 insertions(+)kernel/trace/Makefile +2
-0@@ -138,6 +138,8 @@ obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o # UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __gcov __aeabi_unwind UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer +UNDEFINED_ALLOWLIST += ftrace_likely_update __hwasan_load __hwasan_store __hwasan_tag_memory +UNDEFINED_ALLOWLIST += warn_bogus_irq_restore warn_slowpath_fmt __stack_chk_guard UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) quiet_cmd_check_undefined = NM $<Signature · 1 line
2.39.5
Thanks for the patch.
Most of those ones are covered here
https://lore.kernel.org/all/[email protected]/.
This should fix allmodconfig.
For the ones not covered, I'm working on a follow-up patch using a different approach which should fix them. I'll be able to share it today or tomorrow. Not sure if we want to take this temporarily?
Re: [PATCH 3/3] KVM: arm64: tracing: add ftrace dependency
In reply to Arnd BergmannQuoted 23 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Selecting
CONFIG_TRACE_REMOTEcauses a build time warning when FTRACE is disabled:WARNING: unmet direct dependencies detected for
TRACE_REMOTE
Depends on [n]: FTRACE [=n]
Selected by [y]:
-NVHE_EL2_TRACING[=y] && VIRTUALIZATION [=y] && KVM [=y] &&NVHE_EL2_DEBUG[=y] && TRACING [=y]Add this as another dependency to ensure a clean build.
Fixes 3aed038aac8d ("KVM: arm64: Add trace remote for the nVHE/pKVM hyp")Signed-off-by Arnd Bergmann <[email protected]>--- arch/arm64/kvm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kvm/Kconfig +0
-0
arch/arm64/kvm/Kconfig if NVHE_EL2_DEBUG · line 83
Quoted 7 lines
arch/arm64/kvm/Kconfig +1
-1@@ -78,7 +78,7 @@ if NVHE_EL2_DEBUG config NVHE_EL2_TRACING bool - depends on TRACING + depends on TRACING && FTRACE select TRACE_REMOTE default y
Quoted 4 lines
Signature · 2 lines
-- 2.39.5
Re: [PATCH 2/3] tracing: add more symbols to whitelist
In reply to Vincent DonnefortQuoted 9 lines · Vincent Donnefort
kernel/trace/Makefile obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o · line 142
Quoted 4 lines · Arnd Bergmann
kernel/trace/Makefile +2
-0+UNDEFINED_ALLOWLIST += ftrace_likely_update __hwasan_load __hwasan_store __hwasan_tag_memory +UNDEFINED_ALLOWLIST += warn_bogus_irq_restore warn_slowpath_fmt __stack_chk_guardThanks for the patch.
Quoted 4 lines
Most of those ones are covered here
https://lore.kernel.org/all/[email protected]/.This should fix allmodconfig.
The ones I see in that patch look entirely different from the ones I found.
Quoted 3 lines
For the ones not covered, I'm working on a follow-up patch using a different approach which should fix them. I'll be able to share it today or tomorrow. Not sure if we want to take this temporarily?
I can wait, my randconfig setup has my patch applied locally for now, but I've only fixed the ones I saw on three architectures with gcc-16.0.1, while Nathan's list seems to be mostly for clang specific symbols.
A lot of them also don't show up in allmodconfig builds, only after a larger number of randconfig configurations.
Arnd
Marc Zyngier
maintainerRe: [PATCH 2/3] tracing: add more symbols to whitelist
Quoted 23 lines · Arnd Bergmann
Quoted 9 lines · Vincent Donnefort
kernel/trace/Makefile obj-$(CONFIG_TRACE_REMOTE_TEST) += remote_test.o · line 142
Quoted 4 lines · Arnd Bergmann
kernel/trace/Makefile +2
-0+UNDEFINED_ALLOWLIST += ftrace_likely_update __hwasan_load __hwasan_store __hwasan_tag_memory +UNDEFINED_ALLOWLIST += warn_bogus_irq_restore warn_slowpath_fmt __stack_chk_guardThanks for the patch.
Quoted 4 lines
Most of those ones are covered here
https://lore.kernel.org/all/[email protected]/.This should fix allmodconfig.
The ones I see in that patch look entirely different from the ones I found.
Quoted 3 lines
For the ones not covered, I'm working on a follow-up patch using a different approach which should fix them. I'll be able to share it today or tomorrow. Not sure if we want to take this temporarily?
Quoted 6 lines
I can wait, my randconfig setup has my patch applied locally for now, but I've only fixed the ones I saw on three architectures with gcc-16.0.1, while Nathan's list seems to be mostly for clang specific symbols.
A lot of them also don't show up in allmodconfig builds, only after a larger number of randconfig configurations.
I've decided to take this patch anyway, on top of Vincent's. Should a more generic solution arise, I can always drop both.
Thanks,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Re: [PATCH 2/3] tracing: add more symbols to whitelist
Quoted 4 lines · Marc Zyngier
I've decided to take this patch anyway, on top of Vincent's. Should a more generic solution arise, I can always drop both.
Ok, thanks!
FWIW, I came across two additional ones by now, and will keep running more tests to see what else comes up:
kernel/trace/Makefile +1 -0
@@ -140,6 +140,7 @@ UNDEFINED_ALLOWLIST := memset alt_cb_patch_nops __x86 __ubsan __asan __kasan __g UNDEFINED_ALLOWLIST += __stack_chk_fail stackleak_track_stack __ref_stack __sanitizer UNDEFINED_ALLOWLIST += ftrace_likely_update __hwasan_load __hwasan_store __hwasan_tag_memory UNDEFINED_ALLOWLIST += warn_bogus_irq_restore warn_slowpath_fmt __stack_chk_guard +UNDEFINED_ALLOWLIST += __kcsan __tsan UNDEFINED_ALLOWLIST := $(addprefix -e , $(UNDEFINED_ALLOWLIST)) quiet_cmd_check_undefined = NM $<
Arnd
Re: (subset) [PATCH 1/3] KVM: arm64: fix include path for ring buffer implementation
In reply to Arnd BergmannQuoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The
simple_ring_buffer.cfile is in the source tree rather than generated at build time, so the include path is wrong when using separate object trees:
arch/arm64/kvm/hyp/nvhe/trace.c:16:10: fatal error:simple_ring_buffer.c: No such file or directory
16 | #include "simple_ring_buffer.c"[...]
Applied to next, thanks!
[2/3] tracing: add more symbols to whitelist
commit: 7e4b6c94300e355a72670c5b896ccc26ac312c63
[3/3] KVM: arm64: tracing: add ftrace dependency
commit: 9e5dd49de5d82401e92098c03e0a0e978ddd515aCheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Re: (subset) [PATCH 1/3] KVM: arm64: fix include path for ring buffer implementation
Quoted 4 lines · Marc Zyngier
Applied to next, thanks!
[2/3] tracing: add more symbols to whitelist
commit: 7e4b6c94300e355a72670c5b896ccc26ac312c63
This dropped the SPDX indentifier line in kernel/trace/Makefile.
Cheers,
Nathan