Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
a076aa4f
Commit
a076aa4f
authored
Jan 08, 2009
by
Robert Richter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'oprofile/cell' into oprofile/oprofile-for-tip
parents
d2852b93
25006644
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
705 additions
and
140 deletions
+705
-140
arch/powerpc/include/asm/cell-pmu.h
arch/powerpc/include/asm/cell-pmu.h
+2
-0
arch/powerpc/include/asm/oprofile_impl.h
arch/powerpc/include/asm/oprofile_impl.h
+6
-0
arch/powerpc/oprofile/cell/pr_util.h
arch/powerpc/oprofile/cell/pr_util.h
+8
-3
arch/powerpc/oprofile/cell/spu_profiler.c
arch/powerpc/oprofile/cell/spu_profiler.c
+43
-13
arch/powerpc/oprofile/common.c
arch/powerpc/oprofile/common.c
+22
-0
arch/powerpc/oprofile/op_model_cell.c
arch/powerpc/oprofile/op_model_cell.c
+624
-124
No files found.
arch/powerpc/include/asm/cell-pmu.h
View file @
a076aa4f
...
@@ -37,9 +37,11 @@
...
@@ -37,9 +37,11 @@
#define CBE_PM_STOP_AT_MAX 0x40000000
#define CBE_PM_STOP_AT_MAX 0x40000000
#define CBE_PM_TRACE_MODE_GET(pm_control) (((pm_control) >> 28) & 0x3)
#define CBE_PM_TRACE_MODE_GET(pm_control) (((pm_control) >> 28) & 0x3)
#define CBE_PM_TRACE_MODE_SET(mode) (((mode) & 0x3) << 28)
#define CBE_PM_TRACE_MODE_SET(mode) (((mode) & 0x3) << 28)
#define CBE_PM_TRACE_BUF_OVFLW(bit) (((bit) & 0x1) << 17)
#define CBE_PM_COUNT_MODE_SET(count) (((count) & 0x3) << 18)
#define CBE_PM_COUNT_MODE_SET(count) (((count) & 0x3) << 18)
#define CBE_PM_FREEZE_ALL_CTRS 0x00100000
#define CBE_PM_FREEZE_ALL_CTRS 0x00100000
#define CBE_PM_ENABLE_EXT_TRACE 0x00008000
#define CBE_PM_ENABLE_EXT_TRACE 0x00008000
#define CBE_PM_SPU_ADDR_TRACE_SET(msk) (((msk) & 0x3) << 9)
/* Macros for the trace_address register. */
/* Macros for the trace_address register. */
#define CBE_PM_TRACE_BUF_FULL 0x00000800
#define CBE_PM_TRACE_BUF_FULL 0x00000800
...
...
arch/powerpc/include/asm/oprofile_impl.h
View file @
a076aa4f
...
@@ -32,6 +32,12 @@ struct op_system_config {
...
@@ -32,6 +32,12 @@ struct op_system_config {
unsigned
long
mmcr0
;
unsigned
long
mmcr0
;
unsigned
long
mmcr1
;
unsigned
long
mmcr1
;
unsigned
long
mmcra
;
unsigned
long
mmcra
;
#ifdef CONFIG_OPROFILE_CELL
/* Register for oprofile user tool to check cell kernel profiling
* suport.
*/
unsigned
long
cell_support
;
#endif
#endif
#endif
unsigned
long
enable_kernel
;
unsigned
long
enable_kernel
;
unsigned
long
enable_user
;
unsigned
long
enable_user
;
...
...
arch/powerpc/oprofile/cell/pr_util.h
View file @
a076aa4f
...
@@ -30,6 +30,10 @@
...
@@ -30,6 +30,10 @@
extern
struct
delayed_work
spu_work
;
extern
struct
delayed_work
spu_work
;
extern
int
spu_prof_running
;
extern
int
spu_prof_running
;
#define TRACE_ARRAY_SIZE 1024
extern
spinlock_t
oprof_spu_smpl_arry_lck
;
struct
spu_overlay_info
{
/* map of sections within an SPU overlay */
struct
spu_overlay_info
{
/* map of sections within an SPU overlay */
unsigned
int
vma
;
/* SPU virtual memory address from elf */
unsigned
int
vma
;
/* SPU virtual memory address from elf */
unsigned
int
size
;
/* size of section from elf */
unsigned
int
size
;
/* size of section from elf */
...
@@ -89,10 +93,11 @@ void vma_map_free(struct vma_to_fileoffset_map *map);
...
@@ -89,10 +93,11 @@ void vma_map_free(struct vma_to_fileoffset_map *map);
* Entry point for SPU profiling.
* Entry point for SPU profiling.
* cycles_reset is the SPU_CYCLES count value specified by the user.
* cycles_reset is the SPU_CYCLES count value specified by the user.
*/
*/
int
start_spu_profiling
(
unsigned
int
cycles_reset
);
int
start_spu_profiling_cycles
(
unsigned
int
cycles_reset
);
void
start_spu_profiling_events
(
void
);
void
stop_spu_profiling
(
void
);
void
stop_spu_profiling_cycles
(
void
);
void
stop_spu_profiling_events
(
void
);
/* add the necessary profiling hooks */
/* add the necessary profiling hooks */
int
spu_sync_start
(
void
);
int
spu_sync_start
(
void
);
...
...
arch/powerpc/oprofile/cell/spu_profiler.c
View file @
a076aa4f
...
@@ -18,11 +18,21 @@
...
@@ -18,11 +18,21 @@
#include <asm/cell-pmu.h>
#include <asm/cell-pmu.h>
#include "pr_util.h"
#include "pr_util.h"
#define TRACE_ARRAY_SIZE 1024
#define SCALE_SHIFT 14
#define SCALE_SHIFT 14
static
u32
*
samples
;
static
u32
*
samples
;
/* spu_prof_running is a flag used to indicate if spu profiling is enabled
* or not. It is set by the routines start_spu_profiling_cycles() and
* start_spu_profiling_events(). The flag is cleared by the routines
* stop_spu_profiling_cycles() and stop_spu_profiling_events(). These
* routines are called via global_start() and global_stop() which are called in
* op_powerpc_start() and op_powerpc_stop(). These routines are called once
* per system as a result of the user starting/stopping oprofile. Hence, only
* one CPU per user at a time will be changing the value of spu_prof_running.
* In general, OProfile does not protect against multiple users trying to run
* OProfile at a time.
*/
int
spu_prof_running
;
int
spu_prof_running
;
static
unsigned
int
profiling_interval
;
static
unsigned
int
profiling_interval
;
...
@@ -31,8 +41,8 @@ static unsigned int profiling_interval;
...
@@ -31,8 +41,8 @@ static unsigned int profiling_interval;
#define SPU_PC_MASK 0xFFFF
#define SPU_PC_MASK 0xFFFF
static
DEFINE_SPINLOCK
(
sample_array_lo
ck
);
DEFINE_SPINLOCK
(
oprof_spu_smpl_arry_l
ck
);
unsigned
long
sample_array_lo
ck_flags
;
unsigned
long
oprof_spu_smpl_arry_l
ck_flags
;
void
set_spu_profiling_frequency
(
unsigned
int
freq_khz
,
unsigned
int
cycles_reset
)
void
set_spu_profiling_frequency
(
unsigned
int
freq_khz
,
unsigned
int
cycles_reset
)
{
{
...
@@ -145,13 +155,13 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
...
@@ -145,13 +155,13 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
* sample array must be loaded and then processed for a given
* sample array must be loaded and then processed for a given
* cpu. The sample array is not per cpu.
* cpu. The sample array is not per cpu.
*/
*/
spin_lock_irqsave
(
&
sample_array_lo
ck
,
spin_lock_irqsave
(
&
oprof_spu_smpl_arry_l
ck
,
sample_array_lo
ck_flags
);
oprof_spu_smpl_arry_l
ck_flags
);
num_samples
=
cell_spu_pc_collection
(
cpu
);
num_samples
=
cell_spu_pc_collection
(
cpu
);
if
(
num_samples
==
0
)
{
if
(
num_samples
==
0
)
{
spin_unlock_irqrestore
(
&
sample_array_lo
ck
,
spin_unlock_irqrestore
(
&
oprof_spu_smpl_arry_l
ck
,
sample_array_lo
ck_flags
);
oprof_spu_smpl_arry_l
ck_flags
);
continue
;
continue
;
}
}
...
@@ -162,8 +172,8 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
...
@@ -162,8 +172,8 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
num_samples
);
num_samples
);
}
}
spin_unlock_irqrestore
(
&
sample_array_lo
ck
,
spin_unlock_irqrestore
(
&
oprof_spu_smpl_arry_l
ck
,
sample_array_lo
ck_flags
);
oprof_spu_smpl_arry_l
ck_flags
);
}
}
smp_wmb
();
/* insure spu event buffer updates are written */
smp_wmb
();
/* insure spu event buffer updates are written */
...
@@ -182,13 +192,13 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
...
@@ -182,13 +192,13 @@ static enum hrtimer_restart profile_spus(struct hrtimer *timer)
static
struct
hrtimer
timer
;
static
struct
hrtimer
timer
;
/*
/*
* Entry point for SPU profiling.
* Entry point for SPU
cycle
profiling.
* NOTE: SPU profiling is done system-wide, not per-CPU.
* NOTE: SPU profiling is done system-wide, not per-CPU.
*
*
* cycles_reset is the count value specified by the user when
* cycles_reset is the count value specified by the user when
* setting up OProfile to count SPU_CYCLES.
* setting up OProfile to count SPU_CYCLES.
*/
*/
int
start_spu_profiling
(
unsigned
int
cycles_reset
)
int
start_spu_profiling
_cycles
(
unsigned
int
cycles_reset
)
{
{
ktime_t
kt
;
ktime_t
kt
;
...
@@ -212,10 +222,30 @@ int start_spu_profiling(unsigned int cycles_reset)
...
@@ -212,10 +222,30 @@ int start_spu_profiling(unsigned int cycles_reset)
return
0
;
return
0
;
}
}
void
stop_spu_profiling
(
void
)
/*
* Entry point for SPU event profiling.
* NOTE: SPU profiling is done system-wide, not per-CPU.
*
* cycles_reset is the count value specified by the user when
* setting up OProfile to count SPU_CYCLES.
*/
void
start_spu_profiling_events
(
void
)
{
spu_prof_running
=
1
;
schedule_delayed_work
(
&
spu_work
,
DEFAULT_TIMER_EXPIRE
);
return
;
}
void
stop_spu_profiling_cycles
(
void
)
{
{
spu_prof_running
=
0
;
spu_prof_running
=
0
;
hrtimer_cancel
(
&
timer
);
hrtimer_cancel
(
&
timer
);
kfree
(
samples
);
kfree
(
samples
);
pr_debug
(
"SPU_PROF: stop_spu_profiling issued
\n
"
);
pr_debug
(
"SPU_PROF: stop_spu_profiling_cycles issued
\n
"
);
}
void
stop_spu_profiling_events
(
void
)
{
spu_prof_running
=
0
;
}
}
arch/powerpc/oprofile/common.c
View file @
a076aa4f
...
@@ -132,6 +132,28 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
...
@@ -132,6 +132,28 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
oprofilefs_create_ulong
(
sb
,
root
,
"mmcr0"
,
&
sys
.
mmcr0
);
oprofilefs_create_ulong
(
sb
,
root
,
"mmcr0"
,
&
sys
.
mmcr0
);
oprofilefs_create_ulong
(
sb
,
root
,
"mmcr1"
,
&
sys
.
mmcr1
);
oprofilefs_create_ulong
(
sb
,
root
,
"mmcr1"
,
&
sys
.
mmcr1
);
oprofilefs_create_ulong
(
sb
,
root
,
"mmcra"
,
&
sys
.
mmcra
);
oprofilefs_create_ulong
(
sb
,
root
,
"mmcra"
,
&
sys
.
mmcra
);
#ifdef CONFIG_OPROFILE_CELL
/* create a file the user tool can check to see what level of profiling
* support exits with this kernel. Initialize bit mask to indicate
* what support the kernel has:
* bit 0 - Supports SPU event profiling in addition to PPU
* event and cycles; and SPU cycle profiling
* bits 1-31 - Currently unused.
*
* If the file does not exist, then the kernel only supports SPU
* cycle profiling, PPU event and cycle profiling.
*/
oprofilefs_create_ulong
(
sb
,
root
,
"cell_support"
,
&
sys
.
cell_support
);
sys
.
cell_support
=
0x1
;
/* Note, the user OProfile tool must check
* that this bit is set before attempting to
* user SPU event profiling. Older kernels
* will not have this file, hence the user
* tool is not allowed to do SPU event
* profiling on older kernels. Older kernels
* will accept SPU events but collected data
* is garbage.
*/
#endif
#endif
#endif
for
(
i
=
0
;
i
<
model
->
num_counters
;
++
i
)
{
for
(
i
=
0
;
i
<
model
->
num_counters
;
++
i
)
{
...
...
arch/powerpc/oprofile/op_model_cell.c
View file @
a076aa4f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment