From d726bd3d11d434f5758b27d12a7debcf2133ebaa Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Tue, 5 Jan 2021 00:50:49 -0500 Subject: [PATCH] profile: fix definition of PROFILE_ENABLE and __NR_profile Change-Id: I3f9f5870f8380d3668e1ccb06fd0f6d3307e3fa4 --- CMakeLists.txt | 7 +++++++ arch/arm64/kernel/include/syscall_list.h | 2 +- arch/x86_64/kernel/include/syscall_list.h | 2 +- kernel/include/profile.h | 7 ++----- kernel/include/syscall.h | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5fb889d..b22e4a80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,12 @@ if(ENABLE_FUGAKU_DEBUG) set(KBUILD_C_FLAGS "${KBUILD_C_FLAGS} -DENABLE_FUGAKU_DEBUG") endif() +option(PROFILE_ENABLE "System call profile" ON) +if(PROFILE_ENABLE) + add_definitions(-DPROFILE_ENABLE) + set(KBUILD_C_FLAGS "${KBUILD_C_FLAGS} -DPROFILE_ENABLE") +endif() + option(ENABLE_LINUX_WORK_IRQ_FOR_IKC "Use Linux work IRQ for IKC IPI" ON) if (ENABLE_LINUX_WORK_IRQ_FOR_IKC) set(KBUILD_C_FLAGS "${KBUILD_C_FLAGS} -DIHK_IKC_USE_LINUX_WORK_IRQ") @@ -289,6 +295,7 @@ message("ENABLE_PERF: ${ENABLE_PERF}") message("ENABLE_TOFU: ${ENABLE_TOFU}") message("ENABLE_FUGAKU_HACKS: ${ENABLE_FUGAKU_HACKS}") message("ENABLE_FUGAKU_DEBUG: ${ENABLE_FUGAKU_DEBUG}") +message("PROFILE_ENABLE: ${PROFILE_ENABLE}") message("ENABLE_RUSAGE: ${ENABLE_RUSAGE}") message("ENABLE_QLMPI: ${ENABLE_QLMPI}") message("ENABLE_UTI: ${ENABLE_UTI}") diff --git a/arch/arm64/kernel/include/syscall_list.h b/arch/arm64/kernel/include/syscall_list.h index 3236b715..28e99eb3 100644 --- a/arch/arm64/kernel/include/syscall_list.h +++ b/arch/arm64/kernel/include/syscall_list.h @@ -124,7 +124,7 @@ SYSCALL_HANDLED(271, process_vm_writev) SYSCALL_HANDLED(281, execveat) SYSCALL_HANDLED(700, get_cpu_id) #ifdef PROFILE_ENABLE -SYSCALL_HANDLED(__NR_profile, profile) +SYSCALL_HANDLED(PROFILE_EVENT_MAX, profile) #endif // PROFILE_ENABLE SYSCALL_HANDLED(730, util_migrate_inter_kernel) SYSCALL_HANDLED(731, util_indicate_clone) diff --git a/arch/x86_64/kernel/include/syscall_list.h b/arch/x86_64/kernel/include/syscall_list.h index 84132e36..17a1d654 100644 --- a/arch/x86_64/kernel/include/syscall_list.h +++ b/arch/x86_64/kernel/include/syscall_list.h @@ -168,7 +168,7 @@ SYSCALL_HANDLED(311, process_vm_writev) SYSCALL_HANDLED(322, execveat) SYSCALL_HANDLED(700, get_cpu_id) #ifdef PROFILE_ENABLE -SYSCALL_HANDLED(__NR_profile, profile) +SYSCALL_HANDLED(PROFILE_EVENT_MAX, profile) #endif // PROFILE_ENABLE SYSCALL_HANDLED(730, util_migrate_inter_kernel) SYSCALL_HANDLED(731, util_indicate_clone) diff --git a/kernel/include/profile.h b/kernel/include/profile.h index 47495032..510d155b 100644 --- a/kernel/include/profile.h +++ b/kernel/include/profile.h @@ -1,9 +1,6 @@ #ifndef __PROCESS_PROFILE_H_ #define __PROCESS_PROFILE_H_ -/* Uncomment this to enable profiling */ -#define PROFILE_ENABLE - #ifdef PROFILE_ENABLE #define PROFILE_SYSCALL_MAX 2000 #define PROFILE_OFFLOAD_MAX (PROFILE_SYSCALL_MAX << 1) @@ -58,8 +55,6 @@ enum profile_event_type { PROFILE_EVENT_MAX /* Should be the last event type */ }; -#define __NR_profile PROFILE_EVENT_MAX - #ifdef __KERNEL__ struct thread; struct process; @@ -79,6 +74,8 @@ void profile_dealloc_proc_events(struct process *proc); #include #include +#define __NR_profile PROFILE_EVENT_MAX + /* Per-thread */ static inline void mckernel_profile_thread_on(void) { diff --git a/kernel/include/syscall.h b/kernel/include/syscall.h index 12e909af..74767b24 100644 --- a/kernel/include/syscall.h +++ b/kernel/include/syscall.h @@ -20,6 +20,7 @@ #include #include #include +#include #define NUM_SYSCALLS 255