From adf5fae8808f09cc6cd95dd77d49904aa30cb250 Mon Sep 17 00:00:00 2001 From: Drew Richardson Date: Wed, 23 Apr 2014 10:42:07 +0100 Subject: gator: Remove generic GPU tracepoint support These tracepoints are not used by anything and removing them lets us avoid any rework required for the tracepoint API changes in Linux 3.15. Signed-off-by: Drew Richardson Signed-off-by: Jon Medhurst --- driver/gator_marshaling.c | 2 ++ driver/gator_trace_gpu.c | 38 +++++------------------ driver/gator_trace_gpu.h | 79 ----------------------------------------------- 3 files changed, 9 insertions(+), 110 deletions(-) delete mode 100644 driver/gator_trace_gpu.h 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) } #endif +#if defined(MALI_SUPPORT) static void marshal_sched_gpu_start(int unit, int core, int tgid, int pid) { unsigned long cpu = get_physical_cpu(), flags; @@ -276,6 +277,7 @@ static void marshal_sched_gpu_stop(int unit, int core) // Check and commit; commit is set to occur once buffer is 3/4 full buffer_check(cpu, GPU_TRACE_BUF, time); } +#endif static void marshal_sched_trace_start(int tgid, int pid, int cookie) { 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 @@ #endif #endif -#include "gator_trace_gpu.h" - /* * Taken from MALI_PROFILING_EVENT_TYPE_* items in Mali DDK. */ @@ -37,7 +35,6 @@ /* Note whether tracepoints have been registered */ static int mali_timeline_trace_registered; static int mali_job_slots_trace_registered; -static int gpu_trace_registered; enum { GPU_UNIT_NONE = 0, @@ -50,6 +47,8 @@ enum { #define MALI_4xx (0x0b07) #define MALI_T6xx (0x0056) +#if defined(MALI_SUPPORT) + struct mali_gpu_job { int count; int last_tgid; @@ -113,6 +112,7 @@ static void mali_gpu_stop(int unit, int core) marshal_sched_gpu_start(unit, core, last_tgid, last_pid/*, last_job_id*/); } } +#endif #if defined(MALI_SUPPORT) && (MALI_SUPPORT != MALI_T6xx) #include "gator_events_mali_4xx.h" @@ -232,16 +232,6 @@ GATOR_DEFINE_PROBE(mali_job_slots_event, TP_PROTO(unsigned int event_id, unsigne } #endif -GATOR_DEFINE_PROBE(gpu_activity_start, TP_PROTO(int gpu_unit, int gpu_core, struct task_struct *p)) -{ - mali_gpu_enqueue(gpu_unit, gpu_core, (int)p->tgid, (int)p->pid, 0); -} - -GATOR_DEFINE_PROBE(gpu_activity_stop, TP_PROTO(int gpu_unit, int gpu_core)) -{ - mali_gpu_stop(gpu_unit, gpu_core); -} - static int gator_trace_gpu_start(void) { /* @@ -249,8 +239,10 @@ static int gator_trace_gpu_start(void) * Absence of gpu trace points is not an error */ +#if defined(MALI_SUPPORT) memset(&mali_gpu_jobs, 0, sizeof(mali_gpu_jobs)); - gpu_trace_registered = mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; +#endif + mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; #if defined(MALI_SUPPORT) && (MALI_SUPPORT != MALI_T6xx) if (!GATOR_REGISTER_TRACE(mali_timeline_event)) { @@ -264,17 +256,6 @@ static int gator_trace_gpu_start(void) } #endif - if (!mali_timeline_trace_registered) { - if (GATOR_REGISTER_TRACE(gpu_activity_start)) { - return 0; - } - if (GATOR_REGISTER_TRACE(gpu_activity_stop)) { - GATOR_UNREGISTER_TRACE(gpu_activity_start); - return 0; - } - gpu_trace_registered = 1; - } - return 0; } @@ -292,10 +273,5 @@ static void gator_trace_gpu_stop(void) } #endif - if (gpu_trace_registered) { - GATOR_UNREGISTER_TRACE(gpu_activity_stop); - GATOR_UNREGISTER_TRACE(gpu_activity_start); - } - - gpu_trace_registered = mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; + mali_timeline_trace_registered = mali_job_slots_trace_registered = 0; } 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 @@ -/** - * Copyright (C) ARM Limited 2010-2014. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#undef TRACE_GPU -#define TRACE_GPU gpu - -#if !defined(_TRACE_GPU_H) -#define _TRACE_GPU_H - -#include - -/* - * UNIT - the GPU processor type - * 1 = Vertex Processor - * 2 = Fragment Processor - * - * CORE - the GPU processor core number - * this is not the CPU core number - */ - -/* - * Tracepoint for calling GPU unit start activity on core - */ -TRACE_EVENT(gpu_activity_start, - - TP_PROTO(int gpu_unit, int gpu_core, struct task_struct *p), - - TP_ARGS(gpu_unit, gpu_core, p), - - TP_STRUCT__entry( - __field(int, gpu_unit) - __field(int, gpu_core) - __array(char, comm, TASK_COMM_LEN) - __field(pid_t, pid) - ), - - TP_fast_assign( - __entry->gpu_unit = gpu_unit; - __entry->gpu_core = gpu_core; - memcpy(__entry->comm, p->comm, TASK_COMM_LEN); - __entry->pid = p->pid; - ), - - TP_printk("unit=%d core=%d comm=%s pid=%d", - __entry->gpu_unit, __entry->gpu_core, __entry->comm, - __entry->pid) - ); - -/* - * Tracepoint for calling GPU unit stop activity on core - */ -TRACE_EVENT(gpu_activity_stop, - - TP_PROTO(int gpu_unit, int gpu_core), - - TP_ARGS(gpu_unit, gpu_core), - - TP_STRUCT__entry( - __field(int, gpu_unit) - __field(int, gpu_core) - ), - - TP_fast_assign( - __entry->gpu_unit = gpu_unit; - __entry->gpu_core = gpu_core; - ), - - TP_printk("unit=%d core=%d", __entry->gpu_unit, __entry->gpu_core) - ); - -#endif /* _TRACE_GPU_H */ - -/* This part must be outside protection */ -#include -- cgit v1.2.3-54-g00ecf From ba783f1443773505231ac2808c9a3716c3c2f3ae Mon Sep 17 00:00:00 2001 From: Drew Richardson Date: Thu, 24 Apr 2014 09:24:14 +0100 Subject: 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 Signed-off-by: Jon Medhurst --- driver/gator.h | 10 +++++++++- driver/gator_main.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) 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, register_trace_##probe_name(probe_##probe_name) # define GATOR_UNREGISTER_TRACE(probe_name) \ unregister_trace_##probe_name(probe_##probe_name) -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) # define GATOR_DEFINE_PROBE(probe_name, proto) \ static void probe_##probe_name(void *data, PARAMS(proto)) # define GATOR_REGISTER_TRACE(probe_name) \ register_trace_##probe_name(probe_##probe_name, NULL) # define GATOR_UNREGISTER_TRACE(probe_name) \ unregister_trace_##probe_name(probe_##probe_name, NULL) +#else +# define GATOR_DEFINE_PROBE(probe_name, proto) \ + extern struct tracepoint *gator_tracepoint_##probe_name; \ + static void probe_##probe_name(void *data, PARAMS(proto)) +# define GATOR_REGISTER_TRACE(probe_name) \ + tracepoint_probe_register(gator_tracepoint_##probe_name, probe_##probe_name, NULL) +# define GATOR_UNREGISTER_TRACE(probe_name) \ + tracepoint_probe_unregister(gator_tracepoint_##probe_name, probe_##probe_name, NULL) #endif /****************************************************************************** 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) /****************************************************************************** * Module ******************************************************************************/ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) + +#define GATOR_TRACEPOINTS \ + GATOR_HANDLE_TRACEPOINT(block_rq_complete); \ + GATOR_HANDLE_TRACEPOINT(cpu_frequency); \ + GATOR_HANDLE_TRACEPOINT(cpu_idle); \ + GATOR_HANDLE_TRACEPOINT(cpu_migrate_begin); \ + GATOR_HANDLE_TRACEPOINT(cpu_migrate_current); \ + GATOR_HANDLE_TRACEPOINT(cpu_migrate_finish); \ + GATOR_HANDLE_TRACEPOINT(irq_handler_exit); \ + GATOR_HANDLE_TRACEPOINT(mali_hw_counter); \ + GATOR_HANDLE_TRACEPOINT(mali_job_slots_event); \ + GATOR_HANDLE_TRACEPOINT(mali_mmu_as_in_use); \ + GATOR_HANDLE_TRACEPOINT(mali_mmu_as_released); \ + GATOR_HANDLE_TRACEPOINT(mali_page_fault_insert_pages); \ + GATOR_HANDLE_TRACEPOINT(mali_pm_status); \ + GATOR_HANDLE_TRACEPOINT(mali_sw_counter); \ + GATOR_HANDLE_TRACEPOINT(mali_sw_counters); \ + GATOR_HANDLE_TRACEPOINT(mali_timeline_event); \ + GATOR_HANDLE_TRACEPOINT(mali_total_alloc_pages_change); \ + GATOR_HANDLE_TRACEPOINT(mm_page_alloc); \ + GATOR_HANDLE_TRACEPOINT(mm_page_free); \ + GATOR_HANDLE_TRACEPOINT(mm_page_free_batched); \ + GATOR_HANDLE_TRACEPOINT(sched_process_fork); \ + GATOR_HANDLE_TRACEPOINT(sched_process_free); \ + GATOR_HANDLE_TRACEPOINT(sched_switch); \ + GATOR_HANDLE_TRACEPOINT(softirq_exit); \ + +#define GATOR_HANDLE_TRACEPOINT(probe_name) \ + struct tracepoint *gator_tracepoint_##probe_name +GATOR_TRACEPOINTS; +#undef GATOR_HANDLE_TRACEPOINT + +static void gator_fct(struct tracepoint *tp, void *priv) +{ +#define GATOR_HANDLE_TRACEPOINT(probe_name) \ + if (strcmp(tp->name, #probe_name) == 0) { \ + gator_tracepoint_##probe_name = tp; \ + return; \ + } +GATOR_TRACEPOINTS; +#undef GATOR_HANDLE_TRACEPOINT +} + +#else + +#define for_each_kernel_tracepoint(fct, priv) + +#endif + static int __init gator_module_init(void) { + for_each_kernel_tracepoint(gator_fct, NULL); + if (gatorfs_register()) { return -1; } -- cgit v1.2.3-54-g00ecf