aboutsummaryrefslogtreecommitdiff
path: root/driver/gator_main.c
diff options
context:
space:
mode:
authorDrew Richardson <drew.richardson@arm.com>2012-07-31 12:00:00 -0700
committerDrew Richardson <drew.richardson@arm.com>2014-12-19 15:29:29 -0800
commit5f9955b9c65967a7a62f7860295d8ac187c9ec11 (patch)
treef5c3a2b6025bf9f3e436b8de9ae9f67131fe854d /driver/gator_main.c
parent3abe11d177c6c93fab66d04fd42d11452a0c508e (diff)
gator: Version 5.115.11
Signed-off-by: Drew Richardson <drew.richardson@arm.com>
Diffstat (limited to 'driver/gator_main.c')
-rw-r--r--driver/gator_main.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/driver/gator_main.c b/driver/gator_main.c
index 7d48812..db728ad 100644
--- a/driver/gator_main.c
+++ b/driver/gator_main.c
@@ -7,7 +7,7 @@
*
*/
-static unsigned long gator_protocol_version = 9;
+static unsigned long gator_protocol_version = 10;
#include <linux/slab.h>
#include <linux/cpu.h>
@@ -108,8 +108,12 @@ static DEFINE_MUTEX(start_mutex);
static DEFINE_MUTEX(gator_buffer_mutex);
bool event_based_sampling;
+#if defined(__arm__) && (GATOR_PERF_PMU_SUPPORT)
+DEFINE_PER_CPU(struct perf_event *, pevent_ebs);
+#endif
static DECLARE_WAIT_QUEUE_HEAD(gator_buffer_wait);
+static struct timer_list gator_buffer_wake_up_timer;
static LIST_HEAD(gator_events);
/******************************************************************************
@@ -163,6 +167,11 @@ u32 gator_cpuid(void)
}
#endif
+static void gator_buffer_wake_up(unsigned long data)
+{
+ wake_up(&gator_buffer_wait);
+}
+
/******************************************************************************
* Commit interface
******************************************************************************/
@@ -283,7 +292,9 @@ static void gator_commit_buffer(int cpu, int buftype)
per_cpu(gator_buffer_commit, cpu)[buftype] = per_cpu(gator_buffer_write, cpu)[buftype];
gator_buffer_header(cpu, buftype);
- wake_up(&gator_buffer_wait);
+
+ // had to delay scheduling work as attempting to schedule work during the context switch is illegal in kernel versions 3.5 and greater
+ mod_timer(&gator_buffer_wake_up_timer, jiffies + 1);
}
static void buffer_check(int cpu, int buftype)
@@ -682,11 +693,6 @@ static void gator_stop(void)
{
struct gator_interface *gi;
- // stop all events
- list_for_each_entry(gi, &gator_events, list)
- if (gi->stop)
- gi->stop();
-
gator_annotate_stop();
gator_trace_sched_stop();
gator_trace_power_stop();
@@ -696,6 +702,11 @@ static void gator_stop(void)
// stop all interrupt callback reads before tearing down other interfaces
gator_notifier_stop(); // should be called before gator_timer_stop to avoid re-enabling the hrtimer after it has been offlined
gator_timer_stop();
+
+ // stop all events
+ list_for_each_entry(gi, &gator_events, list)
+ if (gi->stop)
+ gi->stop();
}
/******************************************************************************
@@ -1069,11 +1080,14 @@ static int __init gator_module_init(void)
return -1;
}
+ setup_timer(&gator_buffer_wake_up_timer, gator_buffer_wake_up, 0);
+
return 0;
}
static void __exit gator_module_exit(void)
{
+ del_timer_sync(&gator_buffer_wake_up_timer);
tracepoint_synchronize_unregister();
gatorfs_unregister();
}