Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
56f4c400
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
56f4c400
编写于
12月 30, 2010
作者:
I
Ingo Molnar
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'core' of
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile
into perf/core
上级
32ae2ade
da169f5d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
18 deletion
+43
-18
arch/x86/include/asm/msr-index.h
arch/x86/include/asm/msr-index.h
+4
-0
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/nmi_int.c
+3
-0
arch/x86/oprofile/op_model_amd.c
arch/x86/oprofile/op_model_amd.c
+36
-18
未找到文件。
arch/x86/include/asm/msr-index.h
浏览文件 @
56f4c400
...
@@ -123,6 +123,10 @@
...
@@ -123,6 +123,10 @@
#define MSR_AMD64_IBSCTL 0xc001103a
#define MSR_AMD64_IBSCTL 0xc001103a
#define MSR_AMD64_IBSBRTARGET 0xc001103b
#define MSR_AMD64_IBSBRTARGET 0xc001103b
/* Fam 15h MSRs */
#define MSR_F15H_PERF_CTL 0xc0010200
#define MSR_F15H_PERF_CTR 0xc0010201
/* Fam 10h MSRs */
/* Fam 10h MSRs */
#define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058
#define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058
#define FAM10H_MMIO_CONF_ENABLE (1<<0)
#define FAM10H_MMIO_CONF_ENABLE (1<<0)
...
...
arch/x86/oprofile/nmi_int.c
浏览文件 @
56f4c400
...
@@ -732,6 +732,9 @@ int __init op_nmi_init(struct oprofile_operations *ops)
...
@@ -732,6 +732,9 @@ int __init op_nmi_init(struct oprofile_operations *ops)
case
0x14
:
case
0x14
:
cpu_type
=
"x86-64/family14h"
;
cpu_type
=
"x86-64/family14h"
;
break
;
break
;
case
0x15
:
cpu_type
=
"x86-64/family15h"
;
break
;
default:
default:
return
-
ENODEV
;
return
-
ENODEV
;
}
}
...
...
arch/x86/oprofile/op_model_amd.c
浏览文件 @
56f4c400
...
@@ -29,11 +29,12 @@
...
@@ -29,11 +29,12 @@
#include "op_x86_model.h"
#include "op_x86_model.h"
#include "op_counter.h"
#include "op_counter.h"
#define NUM_COUNTERS 4
#define NUM_COUNTERS 4
#define NUM_COUNTERS_F15H 6
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
#define NUM_VIRT_COUNTERS
32
#define NUM_VIRT_COUNTERS
32
#else
#else
#define NUM_VIRT_COUNTERS
NUM_COUNTERS
#define NUM_VIRT_COUNTERS
0
#endif
#endif
#define OP_EVENT_MASK 0x0FFF
#define OP_EVENT_MASK 0x0FFF
...
@@ -41,7 +42,8 @@
...
@@ -41,7 +42,8 @@
#define MSR_AMD_EVENTSEL_RESERVED ((0xFFFFFCF0ULL<<32)|(1ULL<<21))
#define MSR_AMD_EVENTSEL_RESERVED ((0xFFFFFCF0ULL<<32)|(1ULL<<21))
static
unsigned
long
reset_value
[
NUM_VIRT_COUNTERS
];
static
int
num_counters
;
static
unsigned
long
reset_value
[
OP_MAX_COUNTER
];
#define IBS_FETCH_SIZE 6
#define IBS_FETCH_SIZE 6
#define IBS_OP_SIZE 12
#define IBS_OP_SIZE 12
...
@@ -387,7 +389,7 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
...
@@ -387,7 +389,7 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
int
i
;
int
i
;
/* enable active counters */
/* enable active counters */
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
int
virt
=
op_x86_phys_to_virt
(
i
);
int
virt
=
op_x86_phys_to_virt
(
i
);
if
(
!
reset_value
[
virt
])
if
(
!
reset_value
[
virt
])
continue
;
continue
;
...
@@ -406,7 +408,7 @@ static void op_amd_shutdown(struct op_msrs const * const msrs)
...
@@ -406,7 +408,7 @@ static void op_amd_shutdown(struct op_msrs const * const msrs)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
if
(
!
msrs
->
counters
[
i
].
addr
)
if
(
!
msrs
->
counters
[
i
].
addr
)
continue
;
continue
;
release_perfctr_nmi
(
MSR_K7_PERFCTR0
+
i
);
release_perfctr_nmi
(
MSR_K7_PERFCTR0
+
i
);
...
@@ -418,7 +420,7 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs)
...
@@ -418,7 +420,7 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
i
++
)
{
for
(
i
=
0
;
i
<
num_counters
;
i
++
)
{
if
(
!
reserve_perfctr_nmi
(
MSR_K7_PERFCTR0
+
i
))
if
(
!
reserve_perfctr_nmi
(
MSR_K7_PERFCTR0
+
i
))
goto
fail
;
goto
fail
;
if
(
!
reserve_evntsel_nmi
(
MSR_K7_EVNTSEL0
+
i
))
{
if
(
!
reserve_evntsel_nmi
(
MSR_K7_EVNTSEL0
+
i
))
{
...
@@ -426,8 +428,13 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs)
...
@@ -426,8 +428,13 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs)
goto
fail
;
goto
fail
;
}
}
/* both registers must be reserved */
/* both registers must be reserved */
msrs
->
counters
[
i
].
addr
=
MSR_K7_PERFCTR0
+
i
;
if
(
num_counters
==
NUM_COUNTERS_F15H
)
{
msrs
->
controls
[
i
].
addr
=
MSR_K7_EVNTSEL0
+
i
;
msrs
->
counters
[
i
].
addr
=
MSR_F15H_PERF_CTR
+
(
i
<<
1
);
msrs
->
controls
[
i
].
addr
=
MSR_F15H_PERF_CTL
+
(
i
<<
1
);
}
else
{
msrs
->
controls
[
i
].
addr
=
MSR_K7_EVNTSEL0
+
i
;
msrs
->
counters
[
i
].
addr
=
MSR_K7_PERFCTR0
+
i
;
}
continue
;
continue
;
fail:
fail:
if
(
!
counter_config
[
i
].
enabled
)
if
(
!
counter_config
[
i
].
enabled
)
...
@@ -447,7 +454,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
...
@@ -447,7 +454,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
int
i
;
int
i
;
/* setup reset_value */
/* setup reset_value */
for
(
i
=
0
;
i
<
NUM_VIRT_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
OP_MAX_COUNTER
;
++
i
)
{
if
(
counter_config
[
i
].
enabled
if
(
counter_config
[
i
].
enabled
&&
msrs
->
counters
[
op_x86_virt_to_phys
(
i
)].
addr
)
&&
msrs
->
counters
[
op_x86_virt_to_phys
(
i
)].
addr
)
reset_value
[
i
]
=
counter_config
[
i
].
count
;
reset_value
[
i
]
=
counter_config
[
i
].
count
;
...
@@ -456,7 +463,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
...
@@ -456,7 +463,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
}
}
/* clear all counters */
/* clear all counters */
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
if
(
!
msrs
->
controls
[
i
].
addr
)
if
(
!
msrs
->
controls
[
i
].
addr
)
continue
;
continue
;
rdmsrl
(
msrs
->
controls
[
i
].
addr
,
val
);
rdmsrl
(
msrs
->
controls
[
i
].
addr
,
val
);
...
@@ -472,7 +479,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
...
@@ -472,7 +479,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
}
}
/* enable active counters */
/* enable active counters */
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
int
virt
=
op_x86_phys_to_virt
(
i
);
int
virt
=
op_x86_phys_to_virt
(
i
);
if
(
!
reset_value
[
virt
])
if
(
!
reset_value
[
virt
])
continue
;
continue
;
...
@@ -503,7 +510,7 @@ static int op_amd_check_ctrs(struct pt_regs * const regs,
...
@@ -503,7 +510,7 @@ static int op_amd_check_ctrs(struct pt_regs * const regs,
u64
val
;
u64
val
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
int
virt
=
op_x86_phys_to_virt
(
i
);
int
virt
=
op_x86_phys_to_virt
(
i
);
if
(
!
reset_value
[
virt
])
if
(
!
reset_value
[
virt
])
continue
;
continue
;
...
@@ -526,7 +533,7 @@ static void op_amd_start(struct op_msrs const * const msrs)
...
@@ -526,7 +533,7 @@ static void op_amd_start(struct op_msrs const * const msrs)
u64
val
;
u64
val
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
if
(
!
reset_value
[
op_x86_phys_to_virt
(
i
)])
if
(
!
reset_value
[
op_x86_phys_to_virt
(
i
)])
continue
;
continue
;
rdmsrl
(
msrs
->
controls
[
i
].
addr
,
val
);
rdmsrl
(
msrs
->
controls
[
i
].
addr
,
val
);
...
@@ -546,7 +553,7 @@ static void op_amd_stop(struct op_msrs const * const msrs)
...
@@ -546,7 +553,7 @@ static void op_amd_stop(struct op_msrs const * const msrs)
* Subtle: stop on all counters to avoid race with setting our
* Subtle: stop on all counters to avoid race with setting our
* pm callback
* pm callback
*/
*/
for
(
i
=
0
;
i
<
NUM_COUNTERS
;
++
i
)
{
for
(
i
=
0
;
i
<
num_counters
;
++
i
)
{
if
(
!
reset_value
[
op_x86_phys_to_virt
(
i
)])
if
(
!
reset_value
[
op_x86_phys_to_virt
(
i
)])
continue
;
continue
;
rdmsrl
(
msrs
->
controls
[
i
].
addr
,
val
);
rdmsrl
(
msrs
->
controls
[
i
].
addr
,
val
);
...
@@ -698,18 +705,29 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
...
@@ -698,18 +705,29 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)
return
0
;
return
0
;
}
}
struct
op_x86_model_spec
op_amd_spec
;
static
int
op_amd_init
(
struct
oprofile_operations
*
ops
)
static
int
op_amd_init
(
struct
oprofile_operations
*
ops
)
{
{
init_ibs
();
init_ibs
();
create_arch_files
=
ops
->
create_files
;
create_arch_files
=
ops
->
create_files
;
ops
->
create_files
=
setup_ibs_files
;
ops
->
create_files
=
setup_ibs_files
;
if
(
boot_cpu_data
.
x86
==
0x15
)
{
num_counters
=
NUM_COUNTERS_F15H
;
}
else
{
num_counters
=
NUM_COUNTERS
;
}
op_amd_spec
.
num_counters
=
num_counters
;
op_amd_spec
.
num_controls
=
num_counters
;
op_amd_spec
.
num_virt_counters
=
max
(
num_counters
,
NUM_VIRT_COUNTERS
);
return
0
;
return
0
;
}
}
struct
op_x86_model_spec
op_amd_spec
=
{
struct
op_x86_model_spec
op_amd_spec
=
{
.
num_counters
=
NUM_COUNTERS
,
/* num_counters/num_controls filled in at runtime */
.
num_controls
=
NUM_COUNTERS
,
.
num_virt_counters
=
NUM_VIRT_COUNTERS
,
.
reserved
=
MSR_AMD_EVENTSEL_RESERVED
,
.
reserved
=
MSR_AMD_EVENTSEL_RESERVED
,
.
event_mask
=
OP_EVENT_MASK
,
.
event_mask
=
OP_EVENT_MASK
,
.
init
=
op_amd_init
,
.
init
=
op_amd_init
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录