Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
a406ab6d
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
14
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看板
提交
a406ab6d
编写于
6月 15, 2011
作者:
R
Robert Richter
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'oprofile/urgent' into HEAD
上级
5f307491
a0e3e702
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
57 addition
and
13 deletion
+57
-13
arch/x86/oprofile/backtrace.c
arch/x86/oprofile/backtrace.c
+47
-9
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/nmi_int.c
+10
-4
未找到文件。
arch/x86/oprofile/backtrace.c
浏览文件 @
a406ab6d
...
@@ -11,10 +11,12 @@
...
@@ -11,10 +11,12 @@
#include <linux/oprofile.h>
#include <linux/oprofile.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/compat.h>
#include <linux/highmem.h>
#include <asm/ptrace.h>
#include <asm/ptrace.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/stacktrace.h>
#include <asm/stacktrace.h>
#include <linux/compat.h>
static
int
backtrace_stack
(
void
*
data
,
char
*
name
)
static
int
backtrace_stack
(
void
*
data
,
char
*
name
)
{
{
...
@@ -36,17 +38,53 @@ static struct stacktrace_ops backtrace_ops = {
...
@@ -36,17 +38,53 @@ static struct stacktrace_ops backtrace_ops = {
.
walk_stack
=
print_context_stack
,
.
walk_stack
=
print_context_stack
,
};
};
/* from arch/x86/kernel/cpu/perf_event.c: */
/*
* best effort, GUP based copy_from_user() that assumes IRQ or NMI context
*/
static
unsigned
long
copy_from_user_nmi
(
void
*
to
,
const
void
__user
*
from
,
unsigned
long
n
)
{
unsigned
long
offset
,
addr
=
(
unsigned
long
)
from
;
unsigned
long
size
,
len
=
0
;
struct
page
*
page
;
void
*
map
;
int
ret
;
do
{
ret
=
__get_user_pages_fast
(
addr
,
1
,
0
,
&
page
);
if
(
!
ret
)
break
;
offset
=
addr
&
(
PAGE_SIZE
-
1
);
size
=
min
(
PAGE_SIZE
-
offset
,
n
-
len
);
map
=
kmap_atomic
(
page
);
memcpy
(
to
,
map
+
offset
,
size
);
kunmap_atomic
(
map
);
put_page
(
page
);
len
+=
size
;
to
+=
size
;
addr
+=
size
;
}
while
(
len
<
n
);
return
len
;
}
#ifdef CONFIG_COMPAT
#ifdef CONFIG_COMPAT
static
struct
stack_frame_ia32
*
static
struct
stack_frame_ia32
*
dump_user_backtrace_32
(
struct
stack_frame_ia32
*
head
)
dump_user_backtrace_32
(
struct
stack_frame_ia32
*
head
)
{
{
/* Also check accessibility of one struct frame_head beyond: */
struct
stack_frame_ia32
bufhead
[
2
];
struct
stack_frame_ia32
bufhead
[
2
];
struct
stack_frame_ia32
*
fp
;
struct
stack_frame_ia32
*
fp
;
unsigned
long
bytes
;
/* Also check accessibility of one struct frame_head beyond */
bytes
=
copy_from_user_nmi
(
bufhead
,
head
,
sizeof
(
bufhead
));
if
(
!
access_ok
(
VERIFY_READ
,
head
,
sizeof
(
bufhead
)))
if
(
bytes
!=
sizeof
(
bufhead
))
return
NULL
;
if
(
__copy_from_user_inatomic
(
bufhead
,
head
,
sizeof
(
bufhead
)))
return
NULL
;
return
NULL
;
fp
=
(
struct
stack_frame_ia32
*
)
compat_ptr
(
bufhead
[
0
].
next_frame
);
fp
=
(
struct
stack_frame_ia32
*
)
compat_ptr
(
bufhead
[
0
].
next_frame
);
...
@@ -87,12 +125,12 @@ x86_backtrace_32(struct pt_regs * const regs, unsigned int depth)
...
@@ -87,12 +125,12 @@ x86_backtrace_32(struct pt_regs * const regs, unsigned int depth)
static
struct
stack_frame
*
dump_user_backtrace
(
struct
stack_frame
*
head
)
static
struct
stack_frame
*
dump_user_backtrace
(
struct
stack_frame
*
head
)
{
{
/* Also check accessibility of one struct frame_head beyond: */
struct
stack_frame
bufhead
[
2
];
struct
stack_frame
bufhead
[
2
];
unsigned
long
bytes
;
/* Also check accessibility of one struct stack_frame beyond */
bytes
=
copy_from_user_nmi
(
bufhead
,
head
,
sizeof
(
bufhead
));
if
(
!
access_ok
(
VERIFY_READ
,
head
,
sizeof
(
bufhead
)))
if
(
bytes
!=
sizeof
(
bufhead
))
return
NULL
;
if
(
__copy_from_user_inatomic
(
bufhead
,
head
,
sizeof
(
bufhead
)))
return
NULL
;
return
NULL
;
oprofile_add_trace
(
bufhead
[
0
].
return_address
);
oprofile_add_trace
(
bufhead
[
0
].
return_address
);
...
...
arch/x86/oprofile/nmi_int.c
浏览文件 @
a406ab6d
...
@@ -112,8 +112,10 @@ static void nmi_cpu_start(void *dummy)
...
@@ -112,8 +112,10 @@ static void nmi_cpu_start(void *dummy)
static
int
nmi_start
(
void
)
static
int
nmi_start
(
void
)
{
{
get_online_cpus
();
get_online_cpus
();
on_each_cpu
(
nmi_cpu_start
,
NULL
,
1
);
ctr_running
=
1
;
ctr_running
=
1
;
/* make ctr_running visible to the nmi handler: */
smp_mb
();
on_each_cpu
(
nmi_cpu_start
,
NULL
,
1
);
put_online_cpus
();
put_online_cpus
();
return
0
;
return
0
;
}
}
...
@@ -504,15 +506,18 @@ static int nmi_setup(void)
...
@@ -504,15 +506,18 @@ static int nmi_setup(void)
nmi_enabled
=
0
;
nmi_enabled
=
0
;
ctr_running
=
0
;
ctr_running
=
0
;
barrier
();
/* make variables visible to the nmi handler: */
smp_mb
();
err
=
register_die_notifier
(
&
profile_exceptions_nb
);
err
=
register_die_notifier
(
&
profile_exceptions_nb
);
if
(
err
)
if
(
err
)
goto
fail
;
goto
fail
;
get_online_cpus
();
get_online_cpus
();
register_cpu_notifier
(
&
oprofile_cpu_nb
);
register_cpu_notifier
(
&
oprofile_cpu_nb
);
on_each_cpu
(
nmi_cpu_setup
,
NULL
,
1
);
nmi_enabled
=
1
;
nmi_enabled
=
1
;
/* make nmi_enabled visible to the nmi handler: */
smp_mb
();
on_each_cpu
(
nmi_cpu_setup
,
NULL
,
1
);
put_online_cpus
();
put_online_cpus
();
return
0
;
return
0
;
...
@@ -531,7 +536,8 @@ static void nmi_shutdown(void)
...
@@ -531,7 +536,8 @@ static void nmi_shutdown(void)
nmi_enabled
=
0
;
nmi_enabled
=
0
;
ctr_running
=
0
;
ctr_running
=
0
;
put_online_cpus
();
put_online_cpus
();
barrier
();
/* make variables visible to the nmi handler: */
smp_mb
();
unregister_die_notifier
(
&
profile_exceptions_nb
);
unregister_die_notifier
(
&
profile_exceptions_nb
);
msrs
=
&
get_cpu_var
(
cpu_msrs
);
msrs
=
&
get_cpu_var
(
cpu_msrs
);
model
->
shutdown
(
msrs
);
model
->
shutdown
(
msrs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录