Browse Source

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>
pull/77288/head
Yong Cong Sin 11 months ago committed by Henrik Brix Andersen
parent
commit
42362c6fcc
  1. 1
      arch/riscv/core/CMakeLists.txt
  2. 2
      arch/x86/core/ia32.cmake
  3. 1
      arch/x86/core/intel64.cmake
  4. 8
      subsys/profiling/perf/CMakeLists.txt
  5. 6
      subsys/profiling/perf/Kconfig
  6. 15
      subsys/profiling/perf/backends/CMakeLists.txt
  7. 33
      subsys/profiling/perf/backends/Kconfig
  8. 0
      subsys/profiling/perf/backends/perf_riscv.c
  9. 0
      subsys/profiling/perf/backends/perf_x86.c
  10. 0
      subsys/profiling/perf/backends/perf_x86_64.c

1
arch/riscv/core/CMakeLists.txt

@ -27,4 +27,3 @@ zephyr_library_sources_ifdef(CONFIG_USERSPACE userspace.S) @@ -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)

2
arch/x86/core/ia32.cmake

@ -25,8 +25,6 @@ zephyr_library_sources_ifdef(CONFIG_GDBSTUB ia32/gdbstub.c) @@ -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

1
arch/x86/core/intel64.cmake

@ -20,4 +20,3 @@ zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD intel64/irq_offload.c) @@ -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)

8
subsys/profiling/perf/CMakeLists.txt

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

6
subsys/profiling/perf/Kconfig

@ -4,11 +4,9 @@ @@ -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 @@ -21,3 +19,5 @@ config PROFILING_PERF_BUFFER_SIZE
Size of buffer used by perf to save stack trace samples.
endif
rsource "backends/Kconfig"

15
subsys/profiling/perf/backends/CMakeLists.txt

@ -0,0 +1,15 @@ @@ -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
)

33
subsys/profiling/perf/backends/Kconfig

@ -0,0 +1,33 @@ @@ -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

0
arch/riscv/core/perf.c → subsys/profiling/perf/backends/perf_riscv.c

0
arch/x86/core/ia32/perf.c → subsys/profiling/perf/backends/perf_x86.c

0
arch/x86/core/intel64/perf.c → subsys/profiling/perf/backends/perf_x86_64.c

Loading…
Cancel
Save