summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'driver/gator_main.c')
-rw-r--r--driver/gator_main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/driver/gator_main.c b/driver/gator_main.c
index 988045f..994e35d 100644
--- a/driver/gator_main.c
+++ b/driver/gator_main.c
@@ -110,6 +110,7 @@ static DEFINE_MUTEX(gator_buffer_mutex);
110bool event_based_sampling; 110bool event_based_sampling;
111 111
112static DECLARE_WAIT_QUEUE_HEAD(gator_buffer_wait); 112static DECLARE_WAIT_QUEUE_HEAD(gator_buffer_wait);
113static struct timer_list gator_buffer_wake_up_timer;
113static LIST_HEAD(gator_events); 114static LIST_HEAD(gator_events);
114 115
115/****************************************************************************** 116/******************************************************************************
@@ -163,6 +164,11 @@ u32 gator_cpuid(void)
163} 164}
164#endif 165#endif
165 166
167static void gator_buffer_wake_up(unsigned long data)
168{
169 wake_up(&gator_buffer_wait);
170}
171
166/****************************************************************************** 172/******************************************************************************
167 * Commit interface 173 * Commit interface
168 ******************************************************************************/ 174 ******************************************************************************/
@@ -283,7 +289,9 @@ static void gator_commit_buffer(int cpu, int buftype)
283 289
284 per_cpu(gator_buffer_commit, cpu)[buftype] = per_cpu(gator_buffer_write, cpu)[buftype]; 290 per_cpu(gator_buffer_commit, cpu)[buftype] = per_cpu(gator_buffer_write, cpu)[buftype];
285 gator_buffer_header(cpu, buftype); 291 gator_buffer_header(cpu, buftype);
286 wake_up(&gator_buffer_wait); 292
293 // had to delay scheduling work as attempting to schedule work during the context switch is illegal in kernel versions 3.5 and greater
294 mod_timer(&gator_buffer_wake_up_timer, jiffies + 1);
287} 295}
288 296
289static void buffer_check(int cpu, int buftype) 297static void buffer_check(int cpu, int buftype)
@@ -1069,11 +1077,14 @@ static int __init gator_module_init(void)
1069 return -1; 1077 return -1;
1070 } 1078 }
1071 1079
1080 setup_timer(&gator_buffer_wake_up_timer, gator_buffer_wake_up, 0);
1081
1072 return 0; 1082 return 0;
1073} 1083}
1074 1084
1075static void __exit gator_module_exit(void) 1085static void __exit gator_module_exit(void)
1076{ 1086{
1087 del_timer_sync(&gator_buffer_wake_up_timer);
1077 tracepoint_synchronize_unregister(); 1088 tracepoint_synchronize_unregister();
1078 gatorfs_unregister(); 1089 gatorfs_unregister();
1079} 1090}