summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew Richardson2014-04-24 03:24:14 -0500
committerJon Medhurst2014-04-24 09:23:19 -0500
commitba783f1443773505231ac2808c9a3716c3c2f3ae (patch)
tree779d2d7cbed00255011510713e2ec49fec8740bd
parentadf5fae8808f09cc6cd95dd77d49904aa30cb250 (diff)
downloadarm-ds5-gator-ba783f1443773505231ac2808c9a3716c3c2f3ae.tar.gz
arm-ds5-gator-ba783f1443773505231ac2808c9a3716c3c2f3ae.tar.xz
arm-ds5-gator-ba783f1443773505231ac2808c9a3716c3c2f3ae.zip
gator: Use for_each_kernel_tracepoint in Linux 3.15
Starting with Linux 3.15, unexported tracepoints can't be used directly. Use for_each_kernel_tracepoint to iterate over all tracepoints and save off the tracepoints we're interested in. Signed-off-by: Drew Richardson <drew.richardson@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--driver/gator.h10
-rw-r--r--driver/gator_main.c53
2 files changed, 62 insertions, 1 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
1383GATOR_TRACEPOINTS;
1384#undef GATOR_HANDLE_TRACEPOINT
1385
1386static 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 }
1393GATOR_TRACEPOINTS;
1394#undef GATOR_HANDLE_TRACEPOINT
1395}
1396
1397#else
1398
1399#define for_each_kernel_tracepoint(fct, priv)
1400
1401#endif
1402
1352static int __init gator_module_init(void) 1403static 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 }