aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2017-06-09 10:04:57 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2017-06-09 10:08:33 -0400
commit0b78bf5027b53f94d79a4cbbfbf3636c6864cea3 (patch)
tree863ee4dc5df01e9c8e74ce6caf5557a09ea686b1 /litmus
parent13e211a712006ce4a9974a136499bcfc44f23a99 (diff)
Feather-Trace device interface: synchronize event activation/deactivation
The platform code does not synchronize anything, so make sure there's only one caller at any time.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/ftdev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/litmus/ftdev.c b/litmus/ftdev.c
index 095301a23450..646e8c9fe230 100644
--- a/litmus/ftdev.c
+++ b/litmus/ftdev.c
@@ -6,6 +6,7 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/device.h> 7#include <linux/device.h>
8#include <linux/vmalloc.h> 8#include <linux/vmalloc.h>
9#include <linux/mutex.h>
9 10
10#include <litmus/feather_trace.h> 11#include <litmus/feather_trace.h>
11#include <litmus/ftdev.h> 12#include <litmus/ftdev.h>
@@ -51,13 +52,17 @@ struct ftdev_event {
51 struct ftdev_event* next; 52 struct ftdev_event* next;
52}; 53};
53 54
55static DEFINE_MUTEX(ft_event_activation_mutex);
56
54static int activate(struct ftdev_event** chain, int id) 57static int activate(struct ftdev_event** chain, int id)
55{ 58{
56 struct ftdev_event* ev = kmalloc(sizeof(*ev), GFP_KERNEL); 59 struct ftdev_event* ev = kmalloc(sizeof(*ev), GFP_KERNEL);
57 if (ev) { 60 if (ev) {
61 mutex_lock(&ft_event_activation_mutex);
58 printk(KERN_INFO 62 printk(KERN_INFO
59 "Enabling feather-trace event %d.\n", (int) id); 63 "Enabling feather-trace event %d.\n", (int) id);
60 ft_enable_event(id); 64 ft_enable_event(id);
65 mutex_unlock(&ft_event_activation_mutex);
61 ev->id = id; 66 ev->id = id;
62 ev->next = *chain; 67 ev->next = *chain;
63 *chain = ev; 68 *chain = ev;
@@ -76,7 +81,9 @@ static void deactivate(struct ftdev_event** chain, int id)
76 *cur = nxt; 81 *cur = nxt;
77 printk(KERN_INFO 82 printk(KERN_INFO
78 "Disabling feather-trace event %d.\n", (int) id); 83 "Disabling feather-trace event %d.\n", (int) id);
84 mutex_lock(&ft_event_activation_mutex);
79 ft_disable_event(id); 85 ft_disable_event(id);
86 mutex_unlock(&ft_event_activation_mutex);
80 break; 87 break;
81 } 88 }
82 cur = &(*cur)->next; 89 cur = &(*cur)->next;