]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/trace/trace_events.c
tracing: Call on_each_cpu() when adding or removing single pids from set_event_pid
[linux.git] / kernel / trace / trace_events.c
index ab07058e27c1d3f9d188387abd51bb2bec9ce86e..292bccf3e0112f7ad348c4c47b6252ea15355393 100644 (file)
@@ -938,6 +938,7 @@ static void t_stop(struct seq_file *m, void *p)
 }
 
 static void *p_start(struct seq_file *m, loff_t *pos)
+       __acquires(RCU)
 {
        struct trace_pid_list *pid_list;
        struct trace_array *tr = m->private;
@@ -960,6 +961,7 @@ static void *p_start(struct seq_file *m, loff_t *pos)
 }
 
 static void p_stop(struct seq_file *m, void *p)
+       __releases(RCU)
 {
        rcu_read_unlock_sched();
        mutex_unlock(&event_mutex);
@@ -1549,6 +1551,22 @@ static int max_pids(struct trace_pid_list *pid_list)
        return (PAGE_SIZE << pid_list->order) / sizeof(pid_t);
 }
 
+static void ignore_task_cpu(void *data)
+{
+       struct trace_array *tr = data;
+       struct trace_pid_list *pid_list;
+
+       /*
+        * This function is called by on_each_cpu() while the
+        * event_mutex is held.
+        */
+       pid_list = rcu_dereference_protected(tr->filtered_pids,
+                                            mutex_is_locked(&event_mutex));
+
+       this_cpu_write(tr->trace_buffer.data->ignore_pid,
+                      check_ignore_pid(pid_list, current));
+}
+
 static ssize_t
 ftrace_event_pid_write(struct file *filp, const char __user *ubuf,
                       size_t cnt, loff_t *ppos)
@@ -1713,6 +1731,13 @@ ftrace_event_pid_write(struct file *filp, const char __user *ubuf,
                                                 tr, 0);
        }
 
+       /*
+        * Ignoring of pids is done at task switch. But we have to
+        * check for those tasks that are currently running.
+        * Always do this in case a pid was appended or removed.
+        */
+       on_each_cpu(ignore_task_cpu, tr, 1);
+
        mutex_unlock(&event_mutex);
 
        ret = read;