diff options
author | Jon Medhurst | 2014-04-24 09:23:44 -0500 |
---|---|---|
committer | Jon Medhurst | 2014-04-24 09:23:44 -0500 |
commit | ce2784285261bd64ce3c49a9e1c5f6624854cc99 (patch) | |
tree | 779d2d7cbed00255011510713e2ec49fec8740bd | |
parent | 81e9a122ea802cf8fcaddfc91c3912e7076eed6e (diff) | |
parent | ba783f1443773505231ac2808c9a3716c3c2f3ae (diff) | |
download | arm-ds5-gator-ce2784285261bd64ce3c49a9e1c5f6624854cc99.tar.gz arm-ds5-gator-ce2784285261bd64ce3c49a9e1c5f6624854cc99.tar.xz arm-ds5-gator-ce2784285261bd64ce3c49a9e1c5f6624854cc99.zip |
-rw-r--r-- | driver/gator.h | 10 | ||||
-rw-r--r-- | driver/gator_main.c | 53 | ||||
-rw-r--r-- | driver/gator_marshaling.c | 2 | ||||
-rw-r--r-- | driver/gator_trace_gpu.c | 38 | ||||
-rw-r--r-- | driver/gator_trace_gpu.h | 79 |
5 files changed, 71 insertions, 111 deletions
diff --git a/driver/gator.h b/driver/gator.h index 586cd9e..58cb0a2 100644 --- a/driver/gator.h +++ b/driver/gator.h | |||
@@ -82,13 +82,21 @@ int gatorfs_create_ro_ulong(struct super_block *sb, struct dentry *root, | |||
82 | register_trace_##probe_name(probe_##probe_name) | 82 | register_trace_##probe_name(probe_##probe_name) |
83 | # define GATOR_UNREGISTER_TRACE(probe_name) \ | 83 | # define GATOR_UNREGISTER_TRACE(probe_name) \ |
84 | unregister_trace_##probe_name(probe_##probe_name) | 84 | unregister_trace_##probe_name(probe_##probe_name) |
85 | #else | 85 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) |
86 | # define GATOR_DEFINE_PROBE(probe_name, proto) \ | 86 | # define GATOR_DEFINE_PROBE(probe_name, proto) \ |
87 | static void probe_##probe_name(void *data, PARAMS(proto)) | 87 | static void probe_##probe_name(void *data, PARAMS(proto)) |
88 | # define GATOR_REGISTER_TRACE(probe_name) \ | 88 | # define GATOR_REGISTER_TRACE(probe_name) \ |
89 | register_trace_##probe_name(probe_##probe_name, NULL) | 89 | register_trace_##probe_name(probe_##probe_name, NULL) |
90 | # define GATOR_UNREGISTER_TRACE(probe_name) \ | 90 | # define GATOR_UNREGISTER_TRACE(probe_name) \ |
91 | unregister_trace_##probe_name(probe_##probe_name, NULL) | 91 | unregister_trace_##probe_name(probe_##probe_name, NULL) |
92 | #else | ||
93 | # define GATOR_DEFINE_PROBE(probe_name, proto) \ | ||
94 | extern struct tracepoint *gator_tracepoint_##probe_name; \ | ||
95 | static void probe_##probe_name(void *data, PARAMS(proto)) | ||
96 | # define GATOR_REGISTER_TRACE(probe_name) \ | ||
97 | tracepoint_probe_register(gator_tracepoint_##probe_name, probe_##probe_name, NULL) | ||
98 | # define GATOR_UNREGISTER_TRACE(probe_name) \ | ||
99 | tracepoint_probe_unregister(gator_tracepoint_##probe_name, probe_##probe_name, NULL) | ||
92 | #endif | 100 | #endif |
93 | 101 | ||
94 | /****************************************************************************** | 102 | /****************************************************************************** |
diff --git a/driver/gator_main.c b/driver/gator_main.c index 4a1f056..55772ef 100644 --- a/driver/gator_main.c +++ b/driver/gator_main.c | |||
@@ -1349,8 +1349,61 @@ static void gator_op_create_files(struct super_block *sb, struct dentry *root) | |||
1349 | /****************************************************************************** | 1349 | /****************************************************************************** |
1350 | * Module | 1350 | * Module |
1351 | ******************************************************************************/ | 1351 | ******************************************************************************/ |
1352 | |||
1353 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) | ||
1354 | |||
1355 | #define GATOR_TRACEPOINTS \ | ||
1356 | GATOR_HANDLE_TRACEPOINT(block_rq_complete); \ | ||
1357 | GATOR_HANDLE_TRACEPOINT(cpu_frequency); \ | ||
1358 | GATOR_HANDLE_TRACEPOINT(cpu_idle); \ | ||
1359 | GATOR_HANDLE_TRACEPOINT(cpu_migrate_begin); \ | ||
1360 | GATOR_HANDLE_TRACEPOINT(cpu_migrate_current); \ | ||
1361 | GATOR_HANDLE_TRACEPOINT(cpu_migrate_finish); \ | ||
1362 | GATOR_HANDLE_TRACEPOINT(irq_handler_exit); \ | ||
1363 | GATOR_HANDLE_TRACEPOINT(mali_hw_counter); \ | ||
1364 | GATOR_HANDLE_TRACEPOINT(mali_job_slots_event); \ | ||
1365 | GATOR_HANDLE_TRACEPOINT(mali_mmu_as_in_use); \ | ||
1366 | GATOR_HANDLE_TRACEPOINT(mali_mmu_as_released); \ | ||
1367 | GATOR_HANDLE_TRACEPOINT(mali_page_fault_insert_pages); \ | ||
1368 | GATOR_HANDLE_TRACEPOINT(mali_pm_status); \ | ||
1369 | GATOR_HANDLE_TRACEPOINT(mali_sw_counter); \ | ||
1370 | GATOR_HANDLE_TRACEPOINT(mali_sw_counters); \ | ||
1371 | GATOR_HANDLE_TRACEPOINT(mali_timeline_event); \ | ||
1372 | GATOR_HANDLE_TRACEPOINT(mali_total_alloc_pages_change); \ | ||
1373 | GATOR_HANDLE_TRACEPOINT(mm_page_alloc); \ | ||
1374 | GATOR_HANDLE_TRACEPOINT(mm_page_free); \ | ||
1375 | GATOR_HANDLE_TRACEPOINT(mm_page_free_batched); \ | ||
1376 | GATOR_HANDLE_TRACEPOINT(sched_process_fork); \ | ||
1377 | GATOR_HANDLE_TRACEPOINT(sched_process_free); \ | ||
1378 | GATOR_HANDLE_TRACEPOINT(sched_switch); \ | ||
1379 | GATOR_HANDLE_TRACEPOINT(softirq_exit); \ | ||
1380 | |||
1381 | #define GATOR_HANDLE_TRACEPOINT(probe_name) \ | ||
1382 | struct tracepoint *gator_tracepoint_##probe_name | ||
1383 | GATOR_TRACEPOINTS; | ||
1384 | #undef GATOR_HANDLE_TRACEPOINT | ||
1385 | |||
1386 | static void gator_fct(struct tracepoint *tp, void *priv) | ||
1387 | { | ||
1388 | #define GATOR_HANDLE_TRACEPOINT(probe_name) \ | ||
1389 | if (strcmp(tp->name, #probe_name) == 0) { \ | ||
1390 | gator_tracepoint_##probe_name = tp; \ | ||
1391 | return; \ | ||
1392 | } | ||
1393 | GATOR_TRACEPOINTS; | ||
1394 | #undef GATOR_HANDLE_TRACEPOINT | ||
1395 | } | ||
1396 | |||
1397 | #else | ||
1398 | |||
1399 | #define for_each_kernel_tracepoint(fct, priv) | ||
1400 | |||
1401 | #endif | ||
1402 | |||
1352 | static int __init gator_module_init(void) | 1403 | static int __init gator_module_init(void) |
1353 | { | 1404 | { |
1405 | for_each_kernel_tracepoint(gator_fct, NULL); | ||
1406 | |||
1354 | if (gatorfs_register()) { | 1407 | if (gatorfs_register()) { |
1355 | return -1; | 1408 | return -1; |
1356 | } | 1409 | } |
diff --git a/driver/gator_marshaling.c b/driver/gator_marshaling.c index fd413ad..18c890d 100644 --- a/driver/gator_marshaling.c +++ b/driver/gator_marshaling.c | |||
@@ -233,6 +233,7 @@ static void marshal_event_single(int core, int key, int value) | |||
233 | } | 233 | } |
234 | #endif | 234 | #endif |
235 | 235 | ||
236 | #if defined(MALI_SUPPORT) | ||
236 | static void marshal_sched_gpu_start(int unit, int core, int tgid, int pid) | 237 | static void marshal_sched_gpu_start(int unit, int core, int tgid, int pid) |
237 | { | 238 | { |
238 | unsigned long cpu = get_physical_cpu(), flags; | 239 | unsigned long cpu = get_physical_cpu(), flags; |
@@ -276,6 +277,7 @@ static void marshal_sched_gpu_stop(int unit, int core) | |||
276 | // Check and commit; commit is set to occur once buffer is 3/4 full | 277 | // Check and commit; commit is set to occur once buffer is 3/4 full |
277 | buffer_check(cpu, GPU_TRACE_BUF, time); | 278 | buffer_check(cpu, GPU_TRACE_BUF, time); |
278 | } | 279 | } |
280 | #endif | ||
279 | 281 | ||
280 | static void marshal_sched_trace_start(int tgid, int pid, int cookie) | 282 | static void marshal_sched_trace_start(int tgid, int pid, int cookie) |
281 | { | 283 | { |
diff --git a/driver/gator_trace_gpu.c b/driver/gator_trace_gpu.c index 6332098..6afa548 100644 --- a/driver/gator_trace_gpu.c +++ b/driver/gator_trace_gpu.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #endif | 23 | #endif |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #include "gator_trace_gpu.h" | ||
27 | |||
28 | /* | 26 | /* |
29 | * Taken from MALI_PROFILING_EVENT_TYPE_* items in Mali DDK. | 27 | * Taken from MALI_PROFILING_EVENT_TYPE_* items in Mali DDK. |
30 | */ | 28 | */ |
@@ -37,7 +35,6 @@ | |||
37 | /* Note whether tracepoints have been registered */ | 35 | /* Note whether tracepoints have been registered */ |
38 | static int mali_timeline_trace_registered; | 36 | static int mali_timeline_trace_registered; |
39 | static int mali_job_slots_trace_registered; | 37 | static int mali_job_slots_trace_registered; |
40 | static int gpu_trace_registered; | ||
41 | 38 | ||
42 | enum { | 39 | enum { |
43 | GPU_UNIT_NONE = 0, | 40 | GPU_UNIT_NONE = 0, |
@@ -50,6 +47,8 @@ enum { | |||
50 | #define MALI_4xx (0x0b07) | 47 | #define MALI_4xx (0x0b07) |
51 | #define MALI_T6xx (0x0056) | 48 | #define MALI_T6xx (0x0056) |
52 | 49 | ||
50 | #if defined(MALI_SUPPORT) | ||
51 | |||
53 | struct mali_gpu_job { | 52 | struct mali_gpu_job { |
54 | int count; | 53 | int count; |
55 | int last_tgid; | 54 | int last_tgid; |
@@ -113,6 +112,7 @@ static void mali_gpu_stop(int unit, int core) | |||
113 | marshal_sched_gpu_start(unit, core, last_tgid, last_pid/*, last_job_id*/); | 112 | marshal_sched_gpu_start(unit, core, last_tgid, last_pid/*, last_job_id*/); |
114 | } | 113 | } |
115 | } | 114 | } |
115 | #endif | ||
116 | 116 | ||
117 | #if defined(MALI_SUPPORT) && (MALI_SUPPORT != MALI_T6xx) | 117 | #if defined(MALI_SUPPORT) && (MALI_SUPPORT != MALI_T6xx) |
118 | #include "gator_events_mali_4xx.h" | 118 | #include "gator_events_mali_4xx.h" |
@@ -232,16 +232,6 @@ GATOR_DEFINE_PROBE(mali_job_slots_event, TP_PROTO(unsigned int event_id, unsigne | |||
232 | } | 232 | } |
233 | #endif | 233 | #endif |
234 | 234 | ||
235 | GATOR_DEFINE_PROBE(gpu_activity_start, TP_PROTO(int gpu_unit, int gpu_core, struct task_struct *p)) | ||
236 | { | ||
237 | mali_gpu_enqueue(gpu_unit, gpu_core, (int)p->tgid, (int)p->pid, 0); | ||
238 | } | ||
239 | |||
240 | GATOR_DEFINE_PROBE(gpu_activity_stop, TP_PROTO(int gpu_unit, int gpu_core)) | ||
241 | { | ||
242 | mali_gpu_stop(gpu_unit, gpu_core); | ||
243 | } | ||
244 | |||
245 | static int gator_trace_gpu_start(void) | 235 | static int gator_trace_gpu_start(void) |
246 | { | 236 | { |
247 | /* | 237 | /* |
@@ -249,8 +239,10 @@ static int gator_trace_gpu_start(void) | |||
249 | * Absence of gpu trace points is not an error | 239 | * Absence of gpu trace points is not an error |
250 | */ | 240 | */ |
251 | 241 | ||
242 | #if defined(MALI_SUPPORT) | ||
252 | memset(&mali_gpu_jobs, 0, sizeof(mali_gpu_jobs)); | 243 | memset(&mali_gpu_jobs, 0, sizeof(mali_gpu_jobs)); |
253 | gpu_trace_registered = mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; | 244 | #endif |
245 | mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; | ||
254 | 246 | ||
255 | #if defined(MALI_SUPPORT) && (MALI_SUPPORT != MALI_T6xx) | 247 | #if defined(MALI_SUPPORT) && (MALI_SUPPORT != MALI_T6xx) |
256 | if (!GATOR_REGISTER_TRACE(mali_timeline_event)) { | 248 | if (!GATOR_REGISTER_TRACE(mali_timeline_event)) { |
@@ -264,17 +256,6 @@ static int gator_trace_gpu_start(void) | |||
264 | } | 256 | } |
265 | #endif | 257 | #endif |
266 | 258 | ||
267 | if (!mali_timeline_trace_registered) { | ||
268 | if (GATOR_REGISTER_TRACE(gpu_activity_start)) { | ||
269 | return 0; | ||
270 | } | ||
271 | if (GATOR_REGISTER_TRACE(gpu_activity_stop)) { | ||
272 | GATOR_UNREGISTER_TRACE(gpu_activity_start); | ||
273 | return 0; | ||
274 | } | ||
275 | gpu_trace_registered = 1; | ||
276 | } | ||
277 | |||
278 | return 0; | 259 | return 0; |
279 | } | 260 | } |
280 | 261 | ||
@@ -292,10 +273,5 @@ static void gator_trace_gpu_stop(void) | |||
292 | } | 273 | } |
293 | #endif | 274 | #endif |
294 | 275 | ||
295 | if (gpu_trace_registered) { | 276 | mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; |
296 | GATOR_UNREGISTER_TRACE(gpu_activity_stop); | ||
297 | GATOR_UNREGISTER_TRACE(gpu_activity_start); | ||
298 | } | ||
299 | |||
300 | gpu_trace_registered = mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; | ||
301 | } | 277 | } |
diff --git a/driver/gator_trace_gpu.h b/driver/gator_trace_gpu.h deleted file mode 100644 index 5113d45..0000000 --- a/driver/gator_trace_gpu.h +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /** | ||
2 | * Copyright (C) ARM Limited 2010-2014. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #undef TRACE_GPU | ||
10 | #define TRACE_GPU gpu | ||
11 | |||
12 | #if !defined(_TRACE_GPU_H) | ||
13 | #define _TRACE_GPU_H | ||
14 | |||
15 | #include <linux/tracepoint.h> | ||
16 | |||
17 | /* | ||
18 | * UNIT - the GPU processor type | ||
19 | * 1 = Vertex Processor | ||
20 | * 2 = Fragment Processor | ||
21 | * | ||
22 | * CORE - the GPU processor core number | ||
23 | * this is not the CPU core number | ||
24 | */ | ||
25 | |||
26 | /* | ||
27 | * Tracepoint for calling GPU unit start activity on core | ||
28 | */ | ||
29 | TRACE_EVENT(gpu_activity_start, | ||
30 | |||
31 | TP_PROTO(int gpu_unit, int gpu_core, struct task_struct *p), | ||
32 | |||
33 | TP_ARGS(gpu_unit, gpu_core, p), | ||
34 | |||
35 | TP_STRUCT__entry( | ||
36 | __field(int, gpu_unit) | ||
37 | __field(int, gpu_core) | ||
38 | __array(char, comm, TASK_COMM_LEN) | ||
39 | __field(pid_t, pid) | ||
40 | ), | ||
41 | |||
42 | TP_fast_assign( | ||
43 | __entry->gpu_unit = gpu_unit; | ||
44 | __entry->gpu_core = gpu_core; | ||
45 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); | ||
46 | __entry->pid = p->pid; | ||
47 | ), | ||
48 | |||
49 | TP_printk("unit=%d core=%d comm=%s pid=%d", | ||
50 | __entry->gpu_unit, __entry->gpu_core, __entry->comm, | ||
51 | __entry->pid) | ||
52 | ); | ||
53 | |||
54 | /* | ||
55 | * Tracepoint for calling GPU unit stop activity on core | ||
56 | */ | ||
57 | TRACE_EVENT(gpu_activity_stop, | ||
58 | |||
59 | TP_PROTO(int gpu_unit, int gpu_core), | ||
60 | |||
61 | TP_ARGS(gpu_unit, gpu_core), | ||
62 | |||
63 | TP_STRUCT__entry( | ||
64 | __field(int, gpu_unit) | ||
65 | __field(int, gpu_core) | ||
66 | ), | ||
67 | |||
68 | TP_fast_assign( | ||
69 | __entry->gpu_unit = gpu_unit; | ||
70 | __entry->gpu_core = gpu_core; | ||
71 | ), | ||
72 | |||
73 | TP_printk("unit=%d core=%d", __entry->gpu_unit, __entry->gpu_core) | ||
74 | ); | ||
75 | |||
76 | #endif /* _TRACE_GPU_H */ | ||
77 | |||
78 | /* This part must be outside protection */ | ||
79 | #include <trace/define_trace.h> | ||