subsys/profiling: relocate stack unwind backends

Relocate stack unwind backends from `arch/` to perf's
`backends/` folder, just like logging/shell/..

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
Yong Cong Sin 2024-08-16 15:59:09 +08:00 committed by Henrik Brix Andersen
parent 74537fc87a
commit 42362c6fcc
10 changed files with 58 additions and 8 deletions

View file

@ -27,4 +27,3 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S)
zephyr_library_sources_ifdef(CONFIG_SEMIHOST semihost.c)
zephyr_library_sources_ifdef(CONFIG_EXCEPTION_STACK_TRACE stacktrace.c)
zephyr_linker_sources(ROM_START SORT_KEY 0x0vectors vector_table.ld)
zephyr_library_sources_ifdef(CONFIG_PROFILING_PERF perf.c)

View file

@ -25,8 +25,6 @@ zephyr_library_sources_ifdef(CONFIG_GDBSTUB ia32/gdbstub.c)
zephyr_library_sources_ifdef(CONFIG_DEBUG_COREDUMP ia32/coredump.c)
zephyr_library_sources_ifdef(CONFIG_PROFILING_PERF ia32/perf.c)
zephyr_library_sources_ifdef(
CONFIG_X86_USE_THREAD_LOCAL_STORAGE
ia32/tls.c

View file

@ -20,4 +20,3 @@ zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD intel64/irq_offload.c)
zephyr_library_sources_ifdef(CONFIG_USERSPACE intel64/userspace.S)
zephyr_library_sources_ifdef(CONFIG_THREAD_LOCAL_STORAGE intel64/tls.c)
zephyr_library_sources_ifdef(CONFIG_DEBUG_COREDUMP intel64/coredump.c)
zephyr_library_sources_ifdef(CONFIG_PROFILING_PERF intel64/perf.c)

View file

@ -2,4 +2,10 @@
#
# SPDX-License-Identifier: Apache-2.0
zephyr_sources(perf.c)
add_subdirectory(backends)
zephyr_library()
zephyr_library_sources(
perf.c
)

View file

@ -4,11 +4,9 @@
config PROFILING_PERF
bool "Perf support"
depends on THREAD_STACK_INFO
depends on !SMP
depends on FRAME_POINTER
depends on SHELL
depends on RISCV || X86
depends on PROFILING_PERF_HAS_BACKEND
help
Enable perf shell command.
@ -21,3 +19,5 @@ config PROFILING_PERF_BUFFER_SIZE
Size of buffer used by perf to save stack trace samples.
endif
rsource "backends/Kconfig"

View file

@ -0,0 +1,15 @@
# Copyright (c) 2024 Meta Platforms
#
# SPDX-License-Identifier: Apache-2.0
zephyr_sources_ifdef(CONFIG_PROFILING_PERF_BACKEND_RISCV
perf_riscv.c
)
zephyr_sources_ifdef(CONFIG_PROFILING_PERF_BACKEND_X86
perf_x86.c
)
zephyr_sources_ifdef(CONFIG_PROFILING_PERF_BACKEND_X86_64
perf_x86_64.c
)

View file

@ -0,0 +1,33 @@
# Copyright (c) 2024 Meta Platforms
#
# SPDX-License-Identifier: Apache-2.0
config PROFILING_PERF_HAS_BACKEND
bool
help
Selected when there's an implementation for
`arch_perf_current_stack_trace()`
config PROFILING_PERF_BACKEND_RISCV
bool
default y
depends on RISCV
depends on THREAD_STACK_INFO
depends on FRAME_POINTER
select PROFILING_PERF_HAS_BACKEND
config PROFILING_PERF_BACKEND_X86
bool
default y
depends on X86 && !X86_64
depends on THREAD_STACK_INFO
depends on FRAME_POINTER
select PROFILING_PERF_HAS_BACKEND
config PROFILING_PERF_BACKEND_X86_64
bool
default y
depends on X86_64
depends on THREAD_STACK_INFO
depends on FRAME_POINTER
select PROFILING_PERF_HAS_BACKEND