aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBob Nelson <rrnelson@linux.vnet.ibm.com>2007-07-20 15:39:53 -0400
committerArnd Bergmann <arnd@klappe.arndb.de>2007-07-20 15:42:24 -0400
commit1474855d0878cced6f39f51f3c2bd7428b44cb1e (patch)
treecbad42404bfc0f7222d0a88e4ed9b0e9e0d0cb50 /include
parent36aaccc1e96481e8310b1d13600096da0f24ff43 (diff)
[CELL] oprofile: add support to OProfile for profiling CELL BE SPUs
From: Maynard Johnson <mpjohn@us.ibm.com> This patch updates the existing arch/powerpc/oprofile/op_model_cell.c to add in the SPU profiling capabilities. In addition, a 'cell' subdirectory was added to arch/powerpc/oprofile to hold Cell-specific SPU profiling code. Exports spu_set_profile_private_kref and spu_get_profile_private_kref which are used by OProfile to store private profile information in spufs data structures. Also incorporated several fixes from other patches (rrn). Check pointer returned from kzalloc. Eliminated unnecessary cast. Better error handling and cleanup in the related area. 64-bit unsigned long parameter was being demoted to 32-bit unsigned int and eventually promoted back to unsigned long. Signed-off-by: Carl Love <carll@us.ibm.com> Signed-off-by: Maynard Johnson <mpjohn@us.ibm.com> Signed-off-by: Bob Nelson <rrnelson@us.ibm.com> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Acked-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-powerpc/oprofile_impl.h10
-rw-r--r--include/asm-powerpc/spu.h15
-rw-r--r--include/linux/dcookies.h1
-rw-r--r--include/linux/elf-em.h3
-rw-r--r--include/linux/oprofile.h35
5 files changed, 59 insertions, 5 deletions
diff --git a/include/asm-powerpc/oprofile_impl.h b/include/asm-powerpc/oprofile_impl.h
index 8d6b47f7b300..938fefb4c4bc 100644
--- a/include/asm-powerpc/oprofile_impl.h
+++ b/include/asm-powerpc/oprofile_impl.h
@@ -39,14 +39,16 @@ struct op_system_config {
39 39
40/* Per-arch configuration */ 40/* Per-arch configuration */
41struct op_powerpc_model { 41struct op_powerpc_model {
42 void (*reg_setup) (struct op_counter_config *, 42 int (*reg_setup) (struct op_counter_config *,
43 struct op_system_config *, 43 struct op_system_config *,
44 int num_counters); 44 int num_counters);
45 void (*cpu_setup) (struct op_counter_config *); 45 int (*cpu_setup) (struct op_counter_config *);
46 void (*start) (struct op_counter_config *); 46 int (*start) (struct op_counter_config *);
47 void (*global_start) (struct op_counter_config *); 47 int (*global_start) (struct op_counter_config *);
48 void (*stop) (void); 48 void (*stop) (void);
49 void (*global_stop) (void); 49 void (*global_stop) (void);
50 int (*sync_start)(void);
51 int (*sync_stop)(void);
50 void (*handle_interrupt) (struct pt_regs *, 52 void (*handle_interrupt) (struct pt_regs *,
51 struct op_counter_config *); 53 struct op_counter_config *);
52 int num_counters; 54 int num_counters;
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 24f352da2869..a0f7fc8e23bb 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -138,6 +138,7 @@ struct spu {
138 struct spu_runqueue *rq; 138 struct spu_runqueue *rq;
139 unsigned long long timestamp; 139 unsigned long long timestamp;
140 pid_t pid; 140 pid_t pid;
141 pid_t tgid;
141 int class_0_pending; 142 int class_0_pending;
142 spinlock_t register_lock; 143 spinlock_t register_lock;
143 144
@@ -217,6 +218,20 @@ extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
217struct mm_struct; 218struct mm_struct;
218extern void spu_flush_all_slbs(struct mm_struct *mm); 219extern void spu_flush_all_slbs(struct mm_struct *mm);
219 220
221/* This interface allows a profiler (e.g., OProfile) to store a ref
222 * to spu context information that it creates. This caching technique
223 * avoids the need to recreate this information after a save/restore operation.
224 *
225 * Assumes the caller has already incremented the ref count to
226 * profile_info; then spu_context_destroy must call kref_put
227 * on prof_info_kref.
228 */
229void spu_set_profile_private_kref(struct spu_context *ctx,
230 struct kref *prof_info_kref,
231 void ( * prof_info_release) (struct kref *kref));
232
233void *spu_get_profile_private_kref(struct spu_context *ctx);
234
220/* system callbacks from the SPU */ 235/* system callbacks from the SPU */
221struct spu_syscall_block { 236struct spu_syscall_block {
222 u64 nr_ret; 237 u64 nr_ret;
diff --git a/include/linux/dcookies.h b/include/linux/dcookies.h
index 0fe7cdf326f7..98c69ab80c84 100644
--- a/include/linux/dcookies.h
+++ b/include/linux/dcookies.h
@@ -12,6 +12,7 @@
12 12
13#ifdef CONFIG_PROFILING 13#ifdef CONFIG_PROFILING
14 14
15#include <linux/dcache.h>
15#include <linux/types.h> 16#include <linux/types.h>
16 17
17struct dcookie_user; 18struct dcookie_user;
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 0311bad838b1..5834e843a946 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -20,7 +20,8 @@
20#define EM_PARISC 15 /* HPPA */ 20#define EM_PARISC 15 /* HPPA */
21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ 21#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
22#define EM_PPC 20 /* PowerPC */ 22#define EM_PPC 20 /* PowerPC */
23#define EM_PPC64 21 /* PowerPC64 */ 23#define EM_PPC64 21 /* PowerPC64 */
24#define EM_SPU 23 /* Cell BE SPU */
24#define EM_SH 42 /* SuperH */ 25#define EM_SH 42 /* SuperH */
25#define EM_SPARCV9 43 /* SPARC v9 64-bit */ 26#define EM_SPARCV9 43 /* SPARC v9 64-bit */
26#define EM_IA_64 50 /* HP/Intel IA-64 */ 27#define EM_IA_64 50 /* HP/Intel IA-64 */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 0d514b252454..041bb31100f4 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -17,6 +17,26 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <asm/atomic.h> 18#include <asm/atomic.h>
19 19
20/* Each escaped entry is prefixed by ESCAPE_CODE
21 * then one of the following codes, then the
22 * relevant data.
23 * These #defines live in this file so that arch-specific
24 * buffer sync'ing code can access them.
25 */
26#define ESCAPE_CODE ~0UL
27#define CTX_SWITCH_CODE 1
28#define CPU_SWITCH_CODE 2
29#define COOKIE_SWITCH_CODE 3
30#define KERNEL_ENTER_SWITCH_CODE 4
31#define KERNEL_EXIT_SWITCH_CODE 5
32#define MODULE_LOADED_CODE 6
33#define CTX_TGID_CODE 7
34#define TRACE_BEGIN_CODE 8
35#define TRACE_END_CODE 9
36#define XEN_ENTER_SWITCH_CODE 10
37#define SPU_PROFILING_CODE 11
38#define SPU_CTX_SWITCH_CODE 12
39
20struct super_block; 40struct super_block;
21struct dentry; 41struct dentry;
22struct file_operations; 42struct file_operations;
@@ -35,6 +55,14 @@ struct oprofile_operations {
35 int (*start)(void); 55 int (*start)(void);
36 /* Stop delivering interrupts. */ 56 /* Stop delivering interrupts. */
37 void (*stop)(void); 57 void (*stop)(void);
58 /* Arch-specific buffer sync functions.
59 * Return value = 0: Success
60 * Return value = -1: Failure
61 * Return value = 1: Run generic sync function
62 */
63 int (*sync_start)(void);
64 int (*sync_stop)(void);
65
38 /* Initiate a stack backtrace. Optional. */ 66 /* Initiate a stack backtrace. Optional. */
39 void (*backtrace)(struct pt_regs * const regs, unsigned int depth); 67 void (*backtrace)(struct pt_regs * const regs, unsigned int depth);
40 /* CPU identification string. */ 68 /* CPU identification string. */
@@ -56,6 +84,13 @@ int oprofile_arch_init(struct oprofile_operations * ops);
56void oprofile_arch_exit(void); 84void oprofile_arch_exit(void);
57 85
58/** 86/**
87 * Add data to the event buffer.
88 * The data passed is free-form, but typically consists of
89 * file offsets, dcookies, context information, and ESCAPE codes.
90 */
91void add_event_entry(unsigned long data);
92
93/**
59 * Add a sample. This may be called from any context. Pass 94 * Add a sample. This may be called from any context. Pass
60 * smp_processor_id() as cpu. 95 * smp_processor_id() as cpu.
61 */ 96 */