Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
62a394eb
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
62a394eb
编写于
3月 13, 2009
作者:
I
Ingo Molnar
浏览文件
操作
浏览文件
下载
差异文件
Merge branches 'tracing/ftrace' and 'tracing/syscalls'; commit 'v2.6.29-rc8' into tracing/core
上级
d2e82546
1b3fa2ce
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
161 addition
and
3 deletion
+161
-3
arch/x86/Kconfig
arch/x86/Kconfig
+1
-0
arch/x86/include/asm/thread_info.h
arch/x86/include/asm/thread_info.h
+6
-3
arch/x86/kernel/ptrace.c
arch/x86/kernel/ptrace.c
+7
-0
include/linux/ftrace.h
include/linux/ftrace.h
+21
-0
kernel/trace/Kconfig
kernel/trace/Kconfig
+10
-0
kernel/trace/Makefile
kernel/trace/Makefile
+1
-0
kernel/trace/trace.h
kernel/trace/trace.h
+2
-0
kernel/trace/trace_syscalls.c
kernel/trace/trace_syscalls.c
+113
-0
未找到文件。
arch/x86/Kconfig
浏览文件 @
62a394eb
...
@@ -35,6 +35,7 @@ config X86
...
@@ -35,6 +35,7 @@ config X86
select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACE_MCOUNT_TEST
select HAVE_FUNCTION_TRACE_MCOUNT_TEST
select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
select HAVE_FTRACE_SYSCALLS
select HAVE_KVM
select HAVE_KVM
select HAVE_ARCH_KGDB
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select HAVE_ARCH_TRACEHOOK
...
...
arch/x86/include/asm/thread_info.h
浏览文件 @
62a394eb
...
@@ -94,6 +94,7 @@ struct thread_info {
...
@@ -94,6 +94,7 @@ struct thread_info {
#define TIF_FORCED_TF 24
/* true if TF in eflags artificially */
#define TIF_FORCED_TF 24
/* true if TF in eflags artificially */
#define TIF_DEBUGCTLMSR 25
/* uses thread_struct.debugctlmsr */
#define TIF_DEBUGCTLMSR 25
/* uses thread_struct.debugctlmsr */
#define TIF_DS_AREA_MSR 26
/* uses thread_struct.ds_area_msr */
#define TIF_DS_AREA_MSR 26
/* uses thread_struct.ds_area_msr */
#define TIF_SYSCALL_FTRACE 27
/* for ftrace syscall instrumentation */
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
...
@@ -115,15 +116,17 @@ struct thread_info {
...
@@ -115,15 +116,17 @@ struct thread_info {
#define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
#define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR)
#define _TIF_DEBUGCTLMSR (1 << TIF_DEBUGCTLMSR)
#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR)
#define _TIF_DS_AREA_MSR (1 << TIF_DS_AREA_MSR)
#define _TIF_SYSCALL_FTRACE (1 << TIF_SYSCALL_FTRACE)
/* work to do in syscall_trace_enter() */
/* work to do in syscall_trace_enter() */
#define _TIF_WORK_SYSCALL_ENTRY \
#define _TIF_WORK_SYSCALL_ENTRY \
(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | \
(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU |
_TIF_SYSCALL_FTRACE |
\
_TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
_TIF_SYSCALL_AUDIT | _TIF_SECCOMP | _TIF_SINGLESTEP)
/* work to do in syscall_trace_leave() */
/* work to do in syscall_trace_leave() */
#define _TIF_WORK_SYSCALL_EXIT \
#define _TIF_WORK_SYSCALL_EXIT \
(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)
(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP | \
_TIF_SYSCALL_FTRACE)
/* work to do on interrupt/exception return */
/* work to do on interrupt/exception return */
#define _TIF_WORK_MASK \
#define _TIF_WORK_MASK \
...
@@ -132,7 +135,7 @@ struct thread_info {
...
@@ -132,7 +135,7 @@ struct thread_info {
_TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))
_TIF_SINGLESTEP|_TIF_SECCOMP|_TIF_SYSCALL_EMU))
/* work to do on any return to user space */
/* work to do on any return to user space */
#define _TIF_ALLWORK_MASK (
0x0000FFFF & ~_TIF_SECCOMP
)
#define _TIF_ALLWORK_MASK (
(0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_FTRACE
)
/* Only used for 64 bit */
/* Only used for 64 bit */
#define _TIF_DO_NOTIFY_MASK \
#define _TIF_DO_NOTIFY_MASK \
...
...
arch/x86/kernel/ptrace.c
浏览文件 @
62a394eb
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <linux/audit.h>
#include <linux/audit.h>
#include <linux/seccomp.h>
#include <linux/seccomp.h>
#include <linux/signal.h>
#include <linux/signal.h>
#include <linux/ftrace.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/pgtable.h>
...
@@ -1416,6 +1417,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
...
@@ -1416,6 +1417,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
tracehook_report_syscall_entry
(
regs
))
tracehook_report_syscall_entry
(
regs
))
ret
=
-
1L
;
ret
=
-
1L
;
if
(
unlikely
(
test_thread_flag
(
TIF_SYSCALL_FTRACE
)))
ftrace_syscall_enter
(
regs
);
if
(
unlikely
(
current
->
audit_context
))
{
if
(
unlikely
(
current
->
audit_context
))
{
if
(
IS_IA32
)
if
(
IS_IA32
)
audit_syscall_entry
(
AUDIT_ARCH_I386
,
audit_syscall_entry
(
AUDIT_ARCH_I386
,
...
@@ -1439,6 +1443,9 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
...
@@ -1439,6 +1443,9 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
if
(
unlikely
(
current
->
audit_context
))
if
(
unlikely
(
current
->
audit_context
))
audit_syscall_exit
(
AUDITSC_RESULT
(
regs
->
ax
),
regs
->
ax
);
audit_syscall_exit
(
AUDITSC_RESULT
(
regs
->
ax
),
regs
->
ax
);
if
(
unlikely
(
test_thread_flag
(
TIF_SYSCALL_FTRACE
)))
ftrace_syscall_exit
(
regs
);
if
(
test_thread_flag
(
TIF_SYSCALL_TRACE
))
if
(
test_thread_flag
(
TIF_SYSCALL_TRACE
))
tracehook_report_syscall_exit
(
regs
,
0
);
tracehook_report_syscall_exit
(
regs
,
0
);
...
...
include/linux/ftrace.h
浏览文件 @
62a394eb
...
@@ -503,4 +503,25 @@ static inline void trace_hw_branch_oops(void) {}
...
@@ -503,4 +503,25 @@ static inline void trace_hw_branch_oops(void) {}
#endif
/* CONFIG_HW_BRANCH_TRACER */
#endif
/* CONFIG_HW_BRANCH_TRACER */
/*
* A syscall entry in the ftrace syscalls array.
*
* @syscall_nr: syscall number
*/
struct
syscall_trace_entry
{
int
syscall_nr
;
};
#ifdef CONFIG_FTRACE_SYSCALLS
extern
void
start_ftrace_syscalls
(
void
);
extern
void
stop_ftrace_syscalls
(
void
);
extern
void
ftrace_syscall_enter
(
struct
pt_regs
*
regs
);
extern
void
ftrace_syscall_exit
(
struct
pt_regs
*
regs
);
#else
static
inline
void
start_ftrace_syscalls
(
void
)
{
}
static
inline
void
stop_ftrace_syscalls
(
void
)
{
}
static
inline
void
ftrace_syscall_enter
(
struct
pt_regs
*
regs
)
{
}
static
inline
void
ftrace_syscall_exit
(
struct
pt_regs
*
regs
)
{
}
#endif
#endif
/* _LINUX_FTRACE_H */
#endif
/* _LINUX_FTRACE_H */
kernel/trace/Kconfig
浏览文件 @
62a394eb
...
@@ -34,6 +34,9 @@ config HAVE_FTRACE_MCOUNT_RECORD
...
@@ -34,6 +34,9 @@ config HAVE_FTRACE_MCOUNT_RECORD
config HAVE_HW_BRANCH_TRACER
config HAVE_HW_BRANCH_TRACER
bool
bool
config HAVE_FTRACE_SYSCALLS
bool
config TRACER_MAX_TRACE
config TRACER_MAX_TRACE
bool
bool
...
@@ -175,6 +178,13 @@ config EVENT_TRACER
...
@@ -175,6 +178,13 @@ config EVENT_TRACER
allowing the user to pick and choose which trace point they
allowing the user to pick and choose which trace point they
want to trace.
want to trace.
config FTRACE_SYSCALLS
bool "Trace syscalls"
depends on HAVE_FTRACE_SYSCALLS
select TRACING
help
Basic tracer to catch the syscall entry and exit events.
config BOOT_TRACER
config BOOT_TRACER
bool "Trace boot initcalls"
bool "Trace boot initcalls"
select TRACING
select TRACING
...
...
kernel/trace/Makefile
浏览文件 @
62a394eb
...
@@ -43,5 +43,6 @@ obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o
...
@@ -43,5 +43,6 @@ obj-$(CONFIG_BLK_DEV_IO_TRACE) += blktrace.o
obj-$(CONFIG_EVENT_TRACER)
+=
trace_events.o
obj-$(CONFIG_EVENT_TRACER)
+=
trace_events.o
obj-$(CONFIG_EVENT_TRACER)
+=
events.o
obj-$(CONFIG_EVENT_TRACER)
+=
events.o
obj-$(CONFIG_EVENT_TRACER)
+=
trace_export.o
obj-$(CONFIG_EVENT_TRACER)
+=
trace_export.o
obj-$(CONFIG_FTRACE_SYSCALLS)
+=
trace_syscalls.o
libftrace-y
:=
ftrace.o
libftrace-y
:=
ftrace.o
kernel/trace/trace.h
浏览文件 @
62a394eb
...
@@ -31,6 +31,8 @@ enum trace_type {
...
@@ -31,6 +31,8 @@ enum trace_type {
TRACE_GRAPH_ENT
,
TRACE_GRAPH_ENT
,
TRACE_USER_STACK
,
TRACE_USER_STACK
,
TRACE_HW_BRANCHES
,
TRACE_HW_BRANCHES
,
TRACE_SYSCALL_ENTER
,
TRACE_SYSCALL_EXIT
,
TRACE_KMEM_ALLOC
,
TRACE_KMEM_ALLOC
,
TRACE_KMEM_FREE
,
TRACE_KMEM_FREE
,
TRACE_POWER
,
TRACE_POWER
,
...
...
kernel/trace/trace_syscalls.c
0 → 100644
浏览文件 @
62a394eb
#include <linux/ftrace.h>
#include <linux/kernel.h>
#include <asm/syscall.h>
#include "trace_output.h"
#include "trace.h"
static
atomic_t
refcount
;
void
start_ftrace_syscalls
(
void
)
{
unsigned
long
flags
;
struct
task_struct
*
g
,
*
t
;
if
(
atomic_inc_return
(
&
refcount
)
!=
1
)
goto
out
;
read_lock_irqsave
(
&
tasklist_lock
,
flags
);
do_each_thread
(
g
,
t
)
{
set_tsk_thread_flag
(
t
,
TIF_SYSCALL_FTRACE
);
}
while_each_thread
(
g
,
t
);
read_unlock_irqrestore
(
&
tasklist_lock
,
flags
);
out:
atomic_dec
(
&
refcount
);
}
void
stop_ftrace_syscalls
(
void
)
{
unsigned
long
flags
;
struct
task_struct
*
g
,
*
t
;
if
(
atomic_dec_return
(
&
refcount
))
goto
out
;
read_lock_irqsave
(
&
tasklist_lock
,
flags
);
do_each_thread
(
g
,
t
)
{
clear_tsk_thread_flag
(
t
,
TIF_SYSCALL_FTRACE
);
}
while_each_thread
(
g
,
t
);
read_unlock_irqrestore
(
&
tasklist_lock
,
flags
);
out:
atomic_inc
(
&
refcount
);
}
void
ftrace_syscall_enter
(
struct
pt_regs
*
regs
)
{
int
syscall_nr
;
syscall_nr
=
syscall_get_nr
(
current
,
regs
);
trace_printk
(
"syscall %d enter
\n
"
,
syscall_nr
);
}
void
ftrace_syscall_exit
(
struct
pt_regs
*
regs
)
{
int
syscall_nr
;
syscall_nr
=
syscall_get_nr
(
current
,
regs
);
trace_printk
(
"syscall %d exit
\n
"
,
syscall_nr
);
}
static
int
init_syscall_tracer
(
struct
trace_array
*
tr
)
{
start_ftrace_syscalls
();
return
0
;
}
static
void
reset_syscall_tracer
(
struct
trace_array
*
tr
)
{
stop_ftrace_syscalls
();
}
static
struct
trace_event
syscall_enter_event
=
{
.
type
=
TRACE_SYSCALL_ENTER
,
};
static
struct
trace_event
syscall_exit_event
=
{
.
type
=
TRACE_SYSCALL_EXIT
,
};
static
struct
tracer
syscall_tracer
__read_mostly
=
{
.
name
=
"syscall"
,
.
init
=
init_syscall_tracer
,
.
reset
=
reset_syscall_tracer
};
__init
int
register_ftrace_syscalls
(
void
)
{
int
ret
;
ret
=
register_ftrace_event
(
&
syscall_enter_event
);
if
(
!
ret
)
{
printk
(
KERN_WARNING
"event %d failed to register
\n
"
,
syscall_enter_event
.
type
);
WARN_ON_ONCE
(
1
);
}
ret
=
register_ftrace_event
(
&
syscall_exit_event
);
if
(
!
ret
)
{
printk
(
KERN_WARNING
"event %d failed to register
\n
"
,
syscall_exit_event
.
type
);
WARN_ON_ONCE
(
1
);
}
return
register_tracer
(
&
syscall_tracer
);
}
device_initcall
(
register_ftrace_syscalls
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录