~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/trace/trace_events_trigger.c

Version: ~ [ linux-5.8 ] ~ [ linux-5.7.12 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.55 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.136 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.191 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.232 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.232 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * trace_events_trigger - trace event triggers
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License as published by
  6  * the Free Software Foundation; either version 2 of the License, or
  7  * (at your option) any later version.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  * GNU General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU General Public License
 15  * along with this program; if not, write to the Free Software
 16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 17  *
 18  * Copyright (C) 2013 Tom Zanussi <tom.zanussi@linux.intel.com>
 19  */
 20 
 21 #include <linux/module.h>
 22 #include <linux/ctype.h>
 23 #include <linux/mutex.h>
 24 #include <linux/slab.h>
 25 
 26 #include "trace.h"
 27 
 28 static LIST_HEAD(trigger_commands);
 29 static DEFINE_MUTEX(trigger_cmd_mutex);
 30 
 31 static void
 32 trigger_data_free(struct event_trigger_data *data)
 33 {
 34         if (data->cmd_ops->set_filter)
 35                 data->cmd_ops->set_filter(NULL, data, NULL);
 36 
 37         synchronize_sched(); /* make sure current triggers exit before free */
 38         kfree(data);
 39 }
 40 
 41 /**
 42  * event_triggers_call - Call triggers associated with a trace event
 43  * @file: The ftrace_event_file associated with the event
 44  * @rec: The trace entry for the event, NULL for unconditional invocation
 45  *
 46  * For each trigger associated with an event, invoke the trigger
 47  * function registered with the associated trigger command.  If rec is
 48  * non-NULL, it means that the trigger requires further processing and
 49  * shouldn't be unconditionally invoked.  If rec is non-NULL and the
 50  * trigger has a filter associated with it, rec will checked against
 51  * the filter and if the record matches the trigger will be invoked.
 52  * If the trigger is a 'post_trigger', meaning it shouldn't be invoked
 53  * in any case until the current event is written, the trigger
 54  * function isn't invoked but the bit associated with the deferred
 55  * trigger is set in the return value.
 56  *
 57  * Returns an enum event_trigger_type value containing a set bit for
 58  * any trigger that should be deferred, ETT_NONE if nothing to defer.
 59  *
 60  * Called from tracepoint handlers (with rcu_read_lock_sched() held).
 61  *
 62  * Return: an enum event_trigger_type value containing a set bit for
 63  * any trigger that should be deferred, ETT_NONE if nothing to defer.
 64  */
 65 enum event_trigger_type
 66 event_triggers_call(struct ftrace_event_file *file, void *rec)
 67 {
 68         struct event_trigger_data *data;
 69         enum event_trigger_type tt = ETT_NONE;
 70         struct event_filter *filter;
 71 
 72         if (list_empty(&file->triggers))
 73                 return tt;
 74 
 75         list_for_each_entry_rcu(data, &file->triggers, list) {
 76                 if (!rec) {
 77                         data->ops->func(data);
 78                         continue;
 79                 }
 80                 filter = rcu_dereference_sched(data->filter);
 81                 if (filter && !filter_match_preds(filter, rec))
 82                         continue;
 83                 if (data->cmd_ops->post_trigger) {
 84                         tt |= data->cmd_ops->trigger_type;
 85                         continue;
 86                 }
 87                 data->ops->func(data);
 88         }
 89         return tt;
 90 }
 91 EXPORT_SYMBOL_GPL(event_triggers_call);
 92 
 93 /**
 94  * event_triggers_post_call - Call 'post_triggers' for a trace event
 95  * @file: The ftrace_event_file associated with the event
 96  * @tt: enum event_trigger_type containing a set bit for each trigger to invoke
 97  *
 98  * For each trigger associated with an event, invoke the trigger
 99  * function registered with the associated trigger command, if the
100  * corresponding bit is set in the tt enum passed into this function.
101  * See @event_triggers_call for details on how those bits are set.
102  *
103  * Called from tracepoint handlers (with rcu_read_lock_sched() held).
104  */
105 void
106 event_triggers_post_call(struct ftrace_event_file *file,
107                          enum event_trigger_type tt)
108 {
109         struct event_trigger_data *data;
110 
111         list_for_each_entry_rcu(data, &file->triggers, list) {
112                 if (data->cmd_ops->trigger_type & tt)
113                         data->ops->func(data);
114         }
115 }
116 EXPORT_SYMBOL_GPL(event_triggers_post_call);
117 
118 #define SHOW_AVAILABLE_TRIGGERS (void *)(1UL)
119 
120 static void *trigger_next(struct seq_file *m, void *t, loff_t *pos)
121 {
122         struct ftrace_event_file *event_file = event_file_data(m->private);
123 
124         if (t == SHOW_AVAILABLE_TRIGGERS)
125                 return NULL;
126 
127         return seq_list_next(t, &event_file->triggers, pos);
128 }
129 
130 static void *trigger_start(struct seq_file *m, loff_t *pos)
131 {
132         struct ftrace_event_file *event_file;
133 
134         /* ->stop() is called even if ->start() fails */
135         mutex_lock(&event_mutex);
136         event_file = event_file_data(m->private);
137         if (unlikely(!event_file))
138                 return ERR_PTR(-ENODEV);
139 
140         if (list_empty(&event_file->triggers))
141                 return *pos == 0 ? SHOW_AVAILABLE_TRIGGERS : NULL;
142 
143         return seq_list_start(&event_file->triggers, *pos);
144 }
145 
146 static void trigger_stop(struct seq_file *m, void *t)
147 {
148         mutex_unlock(&event_mutex);
149 }
150 
151 static int trigger_show(struct seq_file *m, void *v)
152 {
153         struct event_trigger_data *data;
154         struct event_command *p;
155 
156         if (v == SHOW_AVAILABLE_TRIGGERS) {
157                 seq_puts(m, "# Available triggers:\n");
158                 seq_putc(m, '#');
159                 mutex_lock(&trigger_cmd_mutex);
160                 list_for_each_entry_reverse(p, &trigger_commands, list)
161                         seq_printf(m, " %s", p->name);
162                 seq_putc(m, '\n');
163                 mutex_unlock(&trigger_cmd_mutex);
164                 return 0;
165         }
166 
167         data = list_entry(v, struct event_trigger_data, list);
168         data->ops->print(m, data->ops, data);
169 
170         return 0;
171 }
172 
173 static const struct seq_operations event_triggers_seq_ops = {
174         .start = trigger_start,
175         .next = trigger_next,
176         .stop = trigger_stop,
177         .show = trigger_show,
178 };
179 
180 static int event_trigger_regex_open(struct inode *inode, struct file *file)
181 {
182         int ret = 0;
183 
184         mutex_lock(&event_mutex);
185 
186         if (unlikely(!event_file_data(file))) {
187                 mutex_unlock(&event_mutex);
188                 return -ENODEV;
189         }
190 
191         if (file->f_mode & FMODE_READ) {
192                 ret = seq_open(file, &event_triggers_seq_ops);
193                 if (!ret) {
194                         struct seq_file *m = file->private_data;
195                         m->private = file;
196                 }
197         }
198 
199         mutex_unlock(&event_mutex);
200 
201         return ret;
202 }
203 
204 static int trigger_process_regex(struct ftrace_event_file *file, char *buff)
205 {
206         char *command, *next = buff;
207         struct event_command *p;
208         int ret = -EINVAL;
209 
210         command = strsep(&next, ": \t");
211         command = (command[0] != '!') ? command : command + 1;
212 
213         mutex_lock(&trigger_cmd_mutex);
214         list_for_each_entry(p, &trigger_commands, list) {
215                 if (strcmp(p->name, command) == 0) {
216                         ret = p->func(p, file, buff, command, next);
217                         goto out_unlock;
218                 }
219         }
220  out_unlock:
221         mutex_unlock(&trigger_cmd_mutex);
222 
223         return ret;
224 }
225 
226 static ssize_t event_trigger_regex_write(struct file *file,
227                                          const char __user *ubuf,
228                                          size_t cnt, loff_t *ppos)
229 {
230         struct ftrace_event_file *event_file;
231         ssize_t ret;
232         char *buf;
233 
234         if (!cnt)
235                 return 0;
236 
237         if (cnt >= PAGE_SIZE)
238                 return -EINVAL;
239 
240         buf = (char *)__get_free_page(GFP_TEMPORARY);
241         if (!buf)
242                 return -ENOMEM;
243 
244         if (copy_from_user(buf, ubuf, cnt)) {
245                 free_page((unsigned long)buf);
246                 return -EFAULT;
247         }
248         buf[cnt] = '\0';
249         strim(buf);
250 
251         mutex_lock(&event_mutex);
252         event_file = event_file_data(file);
253         if (unlikely(!event_file)) {
254                 mutex_unlock(&event_mutex);
255                 free_page((unsigned long)buf);
256                 return -ENODEV;
257         }
258         ret = trigger_process_regex(event_file, buf);
259         mutex_unlock(&event_mutex);
260 
261         free_page((unsigned long)buf);
262         if (ret < 0)
263                 goto out;
264 
265         *ppos += cnt;
266         ret = cnt;
267  out:
268         return ret;
269 }
270 
271 static int event_trigger_regex_release(struct inode *inode, struct file *file)
272 {
273         mutex_lock(&event_mutex);
274 
275         if (file->f_mode & FMODE_READ)
276                 seq_release(inode, file);
277 
278         mutex_unlock(&event_mutex);
279 
280         return 0;
281 }
282 
283 static ssize_t
284 event_trigger_write(struct file *filp, const char __user *ubuf,
285                     size_t cnt, loff_t *ppos)
286 {
287         return event_trigger_regex_write(filp, ubuf, cnt, ppos);
288 }
289 
290 static int
291 event_trigger_open(struct inode *inode, struct file *filp)
292 {
293         return event_trigger_regex_open(inode, filp);
294 }
295 
296 static int
297 event_trigger_release(struct inode *inode, struct file *file)
298 {
299         return event_trigger_regex_release(inode, file);
300 }
301 
302 const struct file_operations event_trigger_fops = {
303         .open = event_trigger_open,
304         .read = seq_read,
305         .write = event_trigger_write,
306         .llseek = tracing_lseek,
307         .release = event_trigger_release,
308 };
309 
310 /*
311  * Currently we only register event commands from __init, so mark this
312  * __init too.
313  */
314 static __init int register_event_command(struct event_command *cmd)
315 {
316         struct event_command *p;
317         int ret = 0;
318 
319         mutex_lock(&trigger_cmd_mutex);
320         list_for_each_entry(p, &trigger_commands, list) {
321                 if (strcmp(cmd->name, p->name) == 0) {
322                         ret = -EBUSY;
323                         goto out_unlock;
324                 }
325         }
326         list_add(&cmd->list, &trigger_commands);
327  out_unlock:
328         mutex_unlock(&trigger_cmd_mutex);
329 
330         return ret;
331 }
332 
333 /*
334  * Currently we only unregister event commands from __init, so mark
335  * this __init too.
336  */
337 static __init int unregister_event_command(struct event_command *cmd)
338 {
339         struct event_command *p, *n;
340         int ret = -ENODEV;
341 
342         mutex_lock(&trigger_cmd_mutex);
343         list_for_each_entry_safe(p, n, &trigger_commands, list) {
344                 if (strcmp(cmd->name, p->name) == 0) {
345                         ret = 0;
346                         list_del_init(&p->list);
347                         goto out_unlock;
348                 }
349         }
350  out_unlock:
351         mutex_unlock(&trigger_cmd_mutex);
352 
353         return ret;
354 }
355 
356 /**
357  * event_trigger_print - Generic event_trigger_ops @print implementation
358  * @name: The name of the event trigger
359  * @m: The seq_file being printed to
360  * @data: Trigger-specific data
361  * @filter_str: filter_str to print, if present
362  *
363  * Common implementation for event triggers to print themselves.
364  *
365  * Usually wrapped by a function that simply sets the @name of the
366  * trigger command and then invokes this.
367  *
368  * Return: 0 on success, errno otherwise
369  */
370 static int
371 event_trigger_print(const char *name, struct seq_file *m,
372                     void *data, char *filter_str)
373 {
374         long count = (long)data;
375 
376         seq_printf(m, "%s", name);
377 
378         if (count == -1)
379                 seq_puts(m, ":unlimited");
380         else
381                 seq_printf(m, ":count=%ld", count);
382 
383         if (filter_str)
384                 seq_printf(m, " if %s\n", filter_str);
385         else
386                 seq_puts(m, "\n");
387 
388         return 0;
389 }
390 
391 /**
392  * event_trigger_init - Generic event_trigger_ops @init implementation
393  * @ops: The trigger ops associated with the trigger
394  * @data: Trigger-specific data
395  *
396  * Common implementation of event trigger initialization.
397  *
398  * Usually used directly as the @init method in event trigger
399  * implementations.
400  *
401  * Return: 0 on success, errno otherwise
402  */
403 static int
404 event_trigger_init(struct event_trigger_ops *ops,
405                    struct event_trigger_data *data)
406 {
407         data->ref++;
408         return 0;
409 }
410 
411 /**
412  * event_trigger_free - Generic event_trigger_ops @free implementation
413  * @ops: The trigger ops associated with the trigger
414  * @data: Trigger-specific data
415  *
416  * Common implementation of event trigger de-initialization.
417  *
418  * Usually used directly as the @free method in event trigger
419  * implementations.
420  */
421 static void
422 event_trigger_free(struct event_trigger_ops *ops,
423                    struct event_trigger_data *data)
424 {
425         if (WARN_ON_ONCE(data->ref <= 0))
426                 return;
427 
428         data->ref--;
429         if (!data->ref)
430                 trigger_data_free(data);
431 }
432 
433 static int trace_event_trigger_enable_disable(struct ftrace_event_file *file,
434                                               int trigger_enable)
435 {
436         int ret = 0;
437 
438         if (trigger_enable) {
439                 if (atomic_inc_return(&file->tm_ref) > 1)
440                         return ret;
441                 set_bit(FTRACE_EVENT_FL_TRIGGER_MODE_BIT, &file->flags);
442                 ret = trace_event_enable_disable(file, 1, 1);
443         } else {
444                 if (atomic_dec_return(&file->tm_ref) > 0)
445                         return ret;
446                 clear_bit(FTRACE_EVENT_FL_TRIGGER_MODE_BIT, &file->flags);
447                 ret = trace_event_enable_disable(file, 0, 1);
448         }
449 
450         return ret;
451 }
452 
453 /**
454  * clear_event_triggers - Clear all triggers associated with a trace array
455  * @tr: The trace array to clear
456  *
457  * For each trigger, the triggering event has its tm_ref decremented
458  * via trace_event_trigger_enable_disable(), and any associated event
459  * (in the case of enable/disable_event triggers) will have its sm_ref
460  * decremented via free()->trace_event_enable_disable().  That
461  * combination effectively reverses the soft-mode/trigger state added
462  * by trigger registration.
463  *
464  * Must be called with event_mutex held.
465  */
466 void
467 clear_event_triggers(struct trace_array *tr)
468 {
469         struct ftrace_event_file *file;
470 
471         list_for_each_entry(file, &tr->events, list) {
472                 struct event_trigger_data *data, *n;
473                 list_for_each_entry_safe(data, n, &file->triggers, list) {
474                         trace_event_trigger_enable_disable(file, 0);
475                         list_del_rcu(&data->list);
476                         if (data->ops->free)
477                                 data->ops->free(data->ops, data);
478                 }
479         }
480 }
481 
482 /**
483  * update_cond_flag - Set or reset the TRIGGER_COND bit
484  * @file: The ftrace_event_file associated with the event
485  *
486  * If an event has triggers and any of those triggers has a filter or
487  * a post_trigger, trigger invocation needs to be deferred until after
488  * the current event has logged its data, and the event should have
489  * its TRIGGER_COND bit set, otherwise the TRIGGER_COND bit should be
490  * cleared.
491  */
492 static void update_cond_flag(struct ftrace_event_file *file)
493 {
494         struct event_trigger_data *data;
495         bool set_cond = false;
496 
497         list_for_each_entry_rcu(data, &file->triggers, list) {
498                 if (data->filter || data->cmd_ops->post_trigger) {
499                         set_cond = true;
500                         break;
501                 }
502         }
503 
504         if (set_cond)
505                 set_bit(FTRACE_EVENT_FL_TRIGGER_COND_BIT, &file->flags);
506         else
507                 clear_bit(FTRACE_EVENT_FL_TRIGGER_COND_BIT, &file->flags);
508 }
509 
510 /**
511  * register_trigger - Generic event_command @reg implementation
512  * @glob: The raw string used to register the trigger
513  * @ops: The trigger ops associated with the trigger
514  * @data: Trigger-specific data to associate with the trigger
515  * @file: The ftrace_event_file associated with the event
516  *
517  * Common implementation for event trigger registration.
518  *
519  * Usually used directly as the @reg method in event command
520  * implementations.
521  *
522  * Return: 0 on success, errno otherwise
523  */
524 static int register_trigger(char *glob, struct event_trigger_ops *ops,
525                             struct event_trigger_data *data,
526                             struct ftrace_event_file *file)
527 {
528         struct event_trigger_data *test;
529         int ret = 0;
530 
531         list_for_each_entry_rcu(test, &file->triggers, list) {
532                 if (test->cmd_ops->trigger_type == data->cmd_ops->trigger_type) {
533                         ret = -EEXIST;
534                         goto out;
535                 }
536         }
537 
538         if (data->ops->init) {
539                 ret = data->ops->init(data->ops, data);
540                 if (ret < 0)
541                         goto out;
542         }
543 
544         list_add_rcu(&data->list, &file->triggers);
545         ret++;
546 
547         if (trace_event_trigger_enable_disable(file, 1) < 0) {
548                 list_del_rcu(&data->list);
549                 ret--;
550         }
551         update_cond_flag(file);
552 out:
553         return ret;
554 }
555 
556 /**
557  * unregister_trigger - Generic event_command @unreg implementation
558  * @glob: The raw string used to register the trigger
559  * @ops: The trigger ops associated with the trigger
560  * @test: Trigger-specific data used to find the trigger to remove
561  * @file: The ftrace_event_file associated with the event
562  *
563  * Common implementation for event trigger unregistration.
564  *
565  * Usually used directly as the @unreg method in event command
566  * implementations.
567  */
568 static void unregister_trigger(char *glob, struct event_trigger_ops *ops,
569                                struct event_trigger_data *test,
570                                struct ftrace_event_file *file)
571 {
572         struct event_trigger_data *data;
573         bool unregistered = false;
574 
575         list_for_each_entry_rcu(data, &file->triggers, list) {
576                 if (data->cmd_ops->trigger_type == test->cmd_ops->trigger_type) {
577                         unregistered = true;
578                         list_del_rcu(&data->list);
579                         update_cond_flag(file);
580                         trace_event_trigger_enable_disable(file, 0);
581                         break;
582                 }
583         }
584 
585         if (unregistered && data->ops->free)
586                 data->ops->free(data->ops, data);
587 }
588 
589 /**
590  * event_trigger_callback - Generic event_command @func implementation
591  * @cmd_ops: The command ops, used for trigger registration
592  * @file: The ftrace_event_file associated with the event
593  * @glob: The raw string used to register the trigger
594  * @cmd: The cmd portion of the string used to register the trigger
595  * @param: The params portion of the string used to register the trigger
596  *
597  * Common implementation for event command parsing and trigger
598  * instantiation.
599  *
600  * Usually used directly as the @func method in event command
601  * implementations.
602  *
603  * Return: 0 on success, errno otherwise
604  */
605 static int
606 event_trigger_callback(struct event_command *cmd_ops,
607                        struct ftrace_event_file *file,
608                        char *glob, char *cmd, char *param)
609 {
610         struct event_trigger_data *trigger_data;
611         struct event_trigger_ops *trigger_ops;
612         char *trigger = NULL;
613         char *number;
614         int ret;
615 
616         /* separate the trigger from the filter (t:n [if filter]) */
617         if (param && isdigit(param[0]))
618                 trigger = strsep(&param, " \t");
619 
620         trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
621 
622         ret = -ENOMEM;
623         trigger_data = kzalloc(sizeof(*trigger_data), GFP_KERNEL);
624         if (!trigger_data)
625                 goto out;
626 
627         trigger_data->count = -1;
628         trigger_data->ops = trigger_ops;
629         trigger_data->cmd_ops = cmd_ops;
630         INIT_LIST_HEAD(&trigger_data->list);
631 
632         if (glob[0] == '!') {
633                 cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
634                 kfree(trigger_data);
635                 ret = 0;
636                 goto out;
637         }
638 
639         if (trigger) {
640                 number = strsep(&trigger, ":");
641 
642                 ret = -EINVAL;
643                 if (!strlen(number))
644                         goto out_free;
645 
646                 /*
647                  * We use the callback data field (which is a pointer)
648                  * as our counter.
649                  */
650                 ret = kstrtoul(number, 0, &trigger_data->count);
651                 if (ret)
652                         goto out_free;
653         }
654 
655         if (!param) /* if param is non-empty, it's supposed to be a filter */
656                 goto out_reg;
657 
658         if (!cmd_ops->set_filter)
659                 goto out_reg;
660 
661         ret = cmd_ops->set_filter(param, trigger_data, file);
662         if (ret < 0)
663                 goto out_free;
664 
665  out_reg:
666         /* Up the trigger_data count to make sure reg doesn't free it on failure */
667         event_trigger_init(trigger_ops, trigger_data);
668         ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
669         /*
670          * The above returns on success the # of functions enabled,
671          * but if it didn't find any functions it returns zero.
672          * Consider no functions a failure too.
673          */
674         if (!ret) {
675                 cmd_ops->unreg(glob, trigger_ops, trigger_data, file);
676                 ret = -ENOENT;
677         } else if (ret > 0)
678                 ret = 0;
679 
680         /* Down the counter of trigger_data or free it if not used anymore */
681         event_trigger_free(trigger_ops, trigger_data);
682  out:
683         return ret;
684 
685  out_free:
686         if (cmd_ops->set_filter)
687                 cmd_ops->set_filter(NULL, trigger_data, NULL);
688         kfree(trigger_data);
689         goto out;
690 }
691 
692 /**
693  * set_trigger_filter - Generic event_command @set_filter implementation
694  * @filter_str: The filter string for the trigger, NULL to remove filter
695  * @trigger_data: Trigger-specific data
696  * @file: The ftrace_event_file associated with the event
697  *
698  * Common implementation for event command filter parsing and filter
699  * instantiation.
700  *
701  * Usually used directly as the @set_filter method in event command
702  * implementations.
703  *
704  * Also used to remove a filter (if filter_str = NULL).
705  *
706  * Return: 0 on success, errno otherwise
707  */
708 static int set_trigger_filter(char *filter_str,
709                               struct event_trigger_data *trigger_data,
710                               struct ftrace_event_file *file)
711 {
712         struct event_trigger_data *data = trigger_data;
713         struct event_filter *filter = NULL, *tmp;
714         int ret = -EINVAL;
715         char *s;
716 
717         if (!filter_str) /* clear the current filter */
718                 goto assign;
719 
720         s = strsep(&filter_str, " \t");
721 
722         if (!strlen(s) || strcmp(s, "if") != 0)
723                 goto out;
724 
725         if (!filter_str)
726                 goto out;
727 
728         /* The filter is for the 'trigger' event, not the triggered event */
729         ret = create_event_filter(file->event_call, filter_str, false, &filter);
730         /*
731          * If create_event_filter() fails, filter still needs to be freed.
732          * Which the calling code will do with data->filter.
733          */
734  assign:
735         tmp = rcu_access_pointer(data->filter);
736 
737         rcu_assign_pointer(data->filter, filter);
738 
739         if (tmp) {
740                 /* Make sure the call is done with the filter */
741                 synchronize_sched();
742                 free_event_filter(tmp);
743         }
744 
745         kfree(data->filter_str);
746         data->filter_str = NULL;
747 
748         if (filter_str) {
749                 data->filter_str = kstrdup(filter_str, GFP_KERNEL);
750                 if (!data->filter_str) {
751                         free_event_filter(rcu_access_pointer(data->filter));
752                         data->filter = NULL;
753                         ret = -ENOMEM;
754                 }
755         }
756  out:
757         return ret;
758 }
759 
760 static void
761 traceon_trigger(struct event_trigger_data *data)
762 {
763         if (tracing_is_on())
764                 return;
765 
766         tracing_on();
767 }
768 
769 static void
770 traceon_count_trigger(struct event_trigger_data *data)
771 {
772         if (tracing_is_on())
773                 return;
774 
775         if (!data->count)
776                 return;
777 
778         if (data->count != -1)
779                 (data->count)--;
780 
781         tracing_on();
782 }
783 
784 static void
785 traceoff_trigger(struct event_trigger_data *data)
786 {
787         if (!tracing_is_on())
788                 return;
789 
790         tracing_off();
791 }
792 
793 static void
794 traceoff_count_trigger(struct event_trigger_data *data)
795 {
796         if (!tracing_is_on())
797                 return;
798 
799         if (!data->count)
800                 return;
801 
802         if (data->count != -1)
803                 (data->count)--;
804 
805         tracing_off();
806 }
807 
808 static int
809 traceon_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
810                       struct event_trigger_data *data)
811 {
812         return event_trigger_print("traceon", m, (void *)data->count,
813                                    data->filter_str);
814 }
815 
816 static int
817 traceoff_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
818                        struct event_trigger_data *data)
819 {
820         return event_trigger_print("traceoff", m, (void *)data->count,
821                                    data->filter_str);
822 }
823 
824 static struct event_trigger_ops traceon_trigger_ops = {
825         .func                   = traceon_trigger,
826         .print                  = traceon_trigger_print,
827         .init                   = event_trigger_init,
828         .free                   = event_trigger_free,
829 };
830 
831 static struct event_trigger_ops traceon_count_trigger_ops = {
832         .func                   = traceon_count_trigger,
833         .print                  = traceon_trigger_print,
834         .init                   = event_trigger_init,
835         .free                   = event_trigger_free,
836 };
837 
838 static struct event_trigger_ops traceoff_trigger_ops = {
839         .func                   = traceoff_trigger,
840         .print                  = traceoff_trigger_print,
841         .init                   = event_trigger_init,
842         .free                   = event_trigger_free,
843 };
844 
845 static struct event_trigger_ops traceoff_count_trigger_ops = {
846         .func                   = traceoff_count_trigger,
847         .print                  = traceoff_trigger_print,
848         .init                   = event_trigger_init,
849         .free                   = event_trigger_free,
850 };
851 
852 static struct event_trigger_ops *
853 onoff_get_trigger_ops(char *cmd, char *param)
854 {
855         struct event_trigger_ops *ops;
856 
857         /* we register both traceon and traceoff to this callback */
858         if (strcmp(cmd, "traceon") == 0)
859                 ops = param ? &traceon_count_trigger_ops :
860                         &traceon_trigger_ops;
861         else
862                 ops = param ? &traceoff_count_trigger_ops :
863                         &traceoff_trigger_ops;
864 
865         return ops;
866 }
867 
868 static struct event_command trigger_traceon_cmd = {
869         .name                   = "traceon",
870         .trigger_type           = ETT_TRACE_ONOFF,
871         .func                   = event_trigger_callback,
872         .reg                    = register_trigger,
873         .unreg                  = unregister_trigger,
874         .get_trigger_ops        = onoff_get_trigger_ops,
875         .set_filter             = set_trigger_filter,
876 };
877 
878 static struct event_command trigger_traceoff_cmd = {
879         .name                   = "traceoff",
880         .trigger_type           = ETT_TRACE_ONOFF,
881         .func                   = event_trigger_callback,
882         .reg                    = register_trigger,
883         .unreg                  = unregister_trigger,
884         .get_trigger_ops        = onoff_get_trigger_ops,
885         .set_filter             = set_trigger_filter,
886 };
887 
888 #ifdef CONFIG_TRACER_SNAPSHOT
889 static void
890 snapshot_trigger(struct event_trigger_data *data)
891 {
892         tracing_snapshot();
893 }
894 
895 static void
896 snapshot_count_trigger(struct event_trigger_data *data)
897 {
898         if (!data->count)
899                 return;
900 
901         if (data->count != -1)
902                 (data->count)--;
903 
904         snapshot_trigger(data);
905 }
906 
907 static int
908 register_snapshot_trigger(char *glob, struct event_trigger_ops *ops,
909                           struct event_trigger_data *data,
910                           struct ftrace_event_file *file)
911 {
912         int ret = register_trigger(glob, ops, data, file);
913 
914         if (ret > 0 && tracing_alloc_snapshot() != 0) {
915                 unregister_trigger(glob, ops, data, file);
916                 ret = 0;
917         }
918 
919         return ret;
920 }
921 
922 static int
923 snapshot_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
924                        struct event_trigger_data *data)
925 {
926         return event_trigger_print("snapshot", m, (void *)data->count,
927                                    data->filter_str);
928 }
929 
930 static struct event_trigger_ops snapshot_trigger_ops = {
931         .func                   = snapshot_trigger,
932         .print                  = snapshot_trigger_print,
933         .init                   = event_trigger_init,
934         .free                   = event_trigger_free,
935 };
936 
937 static struct event_trigger_ops snapshot_count_trigger_ops = {
938         .func                   = snapshot_count_trigger,
939         .print                  = snapshot_trigger_print,
940         .init                   = event_trigger_init,
941         .free                   = event_trigger_free,
942 };
943 
944 static struct event_trigger_ops *
945 snapshot_get_trigger_ops(char *cmd, char *param)
946 {
947         return param ? &snapshot_count_trigger_ops : &snapshot_trigger_ops;
948 }
949 
950 static struct event_command trigger_snapshot_cmd = {
951         .name                   = "snapshot",
952         .trigger_type           = ETT_SNAPSHOT,
953         .func                   = event_trigger_callback,
954         .reg                    = register_snapshot_trigger,
955         .unreg                  = unregister_trigger,
956         .get_trigger_ops        = snapshot_get_trigger_ops,
957         .set_filter             = set_trigger_filter,
958 };
959 
960 static __init int register_trigger_snapshot_cmd(void)
961 {
962         int ret;
963 
964         ret = register_event_command(&trigger_snapshot_cmd);
965         WARN_ON(ret < 0);
966 
967         return ret;
968 }
969 #else
970 static __init int register_trigger_snapshot_cmd(void) { return 0; }
971 #endif /* CONFIG_TRACER_SNAPSHOT */
972 
973 #ifdef CONFIG_STACKTRACE
974 /*
975  * Skip 3:
976  *   stacktrace_trigger()
977  *   event_triggers_post_call()
978  *   ftrace_raw_event_xxx()
979  */
980 #define STACK_SKIP 3
981 
982 static void
983 stacktrace_trigger(struct event_trigger_data *data)
984 {
985         trace_dump_stack(STACK_SKIP);
986 }
987 
988 static void
989 stacktrace_count_trigger(struct event_trigger_data *data)
990 {
991         if (!data->count)
992                 return;
993 
994         if (data->count != -1)
995                 (data->count)--;
996 
997         stacktrace_trigger(data);
998 }
999 
1000 static int
1001 stacktrace_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
1002                          struct event_trigger_data *data)
1003 {
1004         return event_trigger_print("stacktrace", m, (void *)data->count,
1005                                    data->filter_str);
1006 }
1007 
1008 static struct event_trigger_ops stacktrace_trigger_ops = {
1009         .func                   = stacktrace_trigger,
1010         .print                  = stacktrace_trigger_print,
1011         .init                   = event_trigger_init,
1012         .free                   = event_trigger_free,
1013 };
1014 
1015 static struct event_trigger_ops stacktrace_count_trigger_ops = {
1016         .func                   = stacktrace_count_trigger,
1017         .print                  = stacktrace_trigger_print,
1018         .init                   = event_trigger_init,
1019         .free                   = event_trigger_free,
1020 };
1021 
1022 static struct event_trigger_ops *
1023 stacktrace_get_trigger_ops(char *cmd, char *param)
1024 {
1025         return param ? &stacktrace_count_trigger_ops : &stacktrace_trigger_ops;
1026 }
1027 
1028 static struct event_command trigger_stacktrace_cmd = {
1029         .name                   = "stacktrace",
1030         .trigger_type           = ETT_STACKTRACE,
1031         .post_trigger           = true,
1032         .func                   = event_trigger_callback,
1033         .reg                    = register_trigger,
1034         .unreg                  = unregister_trigger,
1035         .get_trigger_ops        = stacktrace_get_trigger_ops,
1036         .set_filter             = set_trigger_filter,
1037 };
1038 
1039 static __init int register_trigger_stacktrace_cmd(void)
1040 {
1041         int ret;
1042 
1043         ret = register_event_command(&trigger_stacktrace_cmd);
1044         WARN_ON(ret < 0);
1045 
1046         return ret;
1047 }
1048 #else
1049 static __init int register_trigger_stacktrace_cmd(void) { return 0; }
1050 #endif /* CONFIG_STACKTRACE */
1051 
1052 static __init void unregister_trigger_traceon_traceoff_cmds(void)
1053 {
1054         unregister_event_command(&trigger_traceon_cmd);
1055         unregister_event_command(&trigger_traceoff_cmd);
1056 }
1057 
1058 /* Avoid typos */
1059 #define ENABLE_EVENT_STR        "enable_event"
1060 #define DISABLE_EVENT_STR       "disable_event"
1061 
1062 struct enable_trigger_data {
1063         struct ftrace_event_file        *file;
1064         bool                            enable;
1065 };
1066 
1067 static void
1068 event_enable_trigger(struct event_trigger_data *data)
1069 {
1070         struct enable_trigger_data *enable_data = data->private_data;
1071 
1072         if (enable_data->enable)
1073                 clear_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &enable_data->file->flags);
1074         else
1075                 set_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, &enable_data->file->flags);
1076 }
1077 
1078 static void
1079 event_enable_count_trigger(struct event_trigger_data *data)
1080 {
1081         struct enable_trigger_data *enable_data = data->private_data;
1082 
1083         if (!data->count)
1084                 return;
1085 
1086         /* Skip if the event is in a state we want to switch to */
1087         if (enable_data->enable == !(enable_data->file->flags & FTRACE_EVENT_FL_SOFT_DISABLED))
1088                 return;
1089 
1090         if (data->count != -1)
1091                 (data->count)--;
1092 
1093         event_enable_trigger(data);
1094 }
1095 
1096 static int
1097 event_enable_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
1098                            struct event_trigger_data *data)
1099 {
1100         struct enable_trigger_data *enable_data = data->private_data;
1101 
1102         seq_printf(m, "%s:%s:%s",
1103                    enable_data->enable ? ENABLE_EVENT_STR : DISABLE_EVENT_STR,
1104                    enable_data->file->event_call->class->system,
1105                    ftrace_event_name(enable_data->file->event_call));
1106 
1107         if (data->count == -1)
1108                 seq_puts(m, ":unlimited");
1109         else
1110                 seq_printf(m, ":count=%ld", data->count);
1111 
1112         if (data->filter_str)
1113                 seq_printf(m, " if %s\n", data->filter_str);
1114         else
1115                 seq_puts(m, "\n");
1116 
1117         return 0;
1118 }
1119 
1120 static void
1121 event_enable_trigger_free(struct event_trigger_ops *ops,
1122                           struct event_trigger_data *data)
1123 {
1124         struct enable_trigger_data *enable_data = data->private_data;
1125 
1126         if (WARN_ON_ONCE(data->ref <= 0))
1127                 return;
1128 
1129         data->ref--;
1130         if (!data->ref) {
1131                 /* Remove the SOFT_MODE flag */
1132                 trace_event_enable_disable(enable_data->file, 0, 1);
1133                 module_put(enable_data->file->event_call->mod);
1134                 trigger_data_free(data);
1135                 kfree(enable_data);
1136         }
1137 }
1138 
1139 static struct event_trigger_ops event_enable_trigger_ops = {
1140         .func                   = event_enable_trigger,
1141         .print                  = event_enable_trigger_print,
1142         .init                   = event_trigger_init,
1143         .free                   = event_enable_trigger_free,
1144 };
1145 
1146 static struct event_trigger_ops event_enable_count_trigger_ops = {
1147         .func                   = event_enable_count_trigger,
1148         .print                  = event_enable_trigger_print,
1149         .init                   = event_trigger_init,
1150         .free                   = event_enable_trigger_free,
1151 };
1152 
1153 static struct event_trigger_ops event_disable_trigger_ops = {
1154         .func                   = event_enable_trigger,
1155         .print                  = event_enable_trigger_print,
1156         .init                   = event_trigger_init,
1157         .free                   = event_enable_trigger_free,
1158 };
1159 
1160 static struct event_trigger_ops event_disable_count_trigger_ops = {
1161         .func                   = event_enable_count_trigger,
1162         .print                  = event_enable_trigger_print,
1163         .init                   = event_trigger_init,
1164         .free                   = event_enable_trigger_free,
1165 };
1166 
1167 static int
1168 event_enable_trigger_func(struct event_command *cmd_ops,
1169                           struct ftrace_event_file *file,
1170                           char *glob, char *cmd, char *param)
1171 {
1172         struct ftrace_event_file *event_enable_file;
1173         struct enable_trigger_data *enable_data;
1174         struct event_trigger_data *trigger_data;
1175         struct event_trigger_ops *trigger_ops;
1176         struct trace_array *tr = file->tr;
1177         const char *system;
1178         const char *event;
1179         char *trigger;
1180         char *number;
1181         bool enable;
1182         int ret;
1183 
1184         if (!param)
1185                 return -EINVAL;
1186 
1187         /* separate the trigger from the filter (s:e:n [if filter]) */
1188         trigger = strsep(&param, " \t");
1189         if (!trigger)
1190                 return -EINVAL;
1191 
1192         system = strsep(&trigger, ":");
1193         if (!trigger)
1194                 return -EINVAL;
1195 
1196         event = strsep(&trigger, ":");
1197 
1198         ret = -EINVAL;
1199         event_enable_file = find_event_file(tr, system, event);
1200         if (!event_enable_file)
1201                 goto out;
1202 
1203         enable = strcmp(cmd, ENABLE_EVENT_STR) == 0;
1204 
1205         trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
1206 
1207         ret = -ENOMEM;
1208         trigger_data = kzalloc(sizeof(*trigger_data), GFP_KERNEL);
1209         if (!trigger_data)
1210                 goto out;
1211 
1212         enable_data = kzalloc(sizeof(*enable_data), GFP_KERNEL);
1213         if (!enable_data) {
1214                 kfree(trigger_data);
1215                 goto out;
1216         }
1217 
1218         trigger_data->count = -1;
1219         trigger_data->ops = trigger_ops;
1220         trigger_data->cmd_ops = cmd_ops;
1221         INIT_LIST_HEAD(&trigger_data->list);
1222         RCU_INIT_POINTER(trigger_data->filter, NULL);
1223 
1224         enable_data->enable = enable;
1225         enable_data->file = event_enable_file;
1226         trigger_data->private_data = enable_data;
1227 
1228         if (glob[0] == '!') {
1229                 cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file);
1230                 kfree(trigger_data);
1231                 kfree(enable_data);
1232                 ret = 0;
1233                 goto out;
1234         }
1235 
1236         /* Up the trigger_data count to make sure nothing frees it on failure */
1237         event_trigger_init(trigger_ops, trigger_data);
1238 
1239         if (trigger) {
1240                 number = strsep(&trigger, ":");
1241 
1242                 ret = -EINVAL;
1243                 if (!strlen(number))
1244                         goto out_free;
1245 
1246                 /*
1247                  * We use the callback data field (which is a pointer)
1248                  * as our counter.
1249                  */
1250                 ret = kstrtoul(number, 0, &trigger_data->count);
1251                 if (ret)
1252                         goto out_free;
1253         }
1254 
1255         if (!param) /* if param is non-empty, it's supposed to be a filter */
1256                 goto out_reg;
1257 
1258         if (!cmd_ops->set_filter)
1259                 goto out_reg;
1260 
1261         ret = cmd_ops->set_filter(param, trigger_data, file);
1262         if (ret < 0)
1263                 goto out_free;
1264 
1265  out_reg:
1266         /* Don't let event modules unload while probe registered */
1267         ret = try_module_get(event_enable_file->event_call->mod);
1268         if (!ret) {
1269                 ret = -EBUSY;
1270                 goto out_free;
1271         }
1272 
1273         ret = trace_event_enable_disable(event_enable_file, 1, 1);
1274         if (ret < 0)
1275                 goto out_put;
1276         ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file);
1277         /*
1278          * The above returns on success the # of functions enabled,
1279          * but if it didn't find any functions it returns zero.
1280          * Consider no functions a failure too.
1281          */
1282         if (!ret) {
1283                 ret = -ENOENT;
1284                 goto out_disable;
1285         } else if (ret < 0)
1286                 goto out_disable;
1287         /* Just return zero, not the number of enabled functions */
1288         ret = 0;
1289         event_trigger_free(trigger_ops, trigger_data);
1290  out:
1291         return ret;
1292 
1293  out_disable:
1294         trace_event_enable_disable(event_enable_file, 0, 1);
1295  out_put:
1296         module_put(event_enable_file->event_call->mod);
1297  out_free:
1298         if (cmd_ops->set_filter)
1299                 cmd_ops->set_filter(NULL, trigger_data, NULL);
1300         event_trigger_free(trigger_ops, trigger_data);
1301         kfree(enable_data);
1302         goto out;
1303 }
1304 
1305 static int event_enable_register_trigger(char *glob,
1306                                          struct event_trigger_ops *ops,
1307                                          struct event_trigger_data *data,
1308                                          struct ftrace_event_file *file)
1309 {
1310         struct enable_trigger_data *enable_data = data->private_data;
1311         struct enable_trigger_data *test_enable_data;
1312         struct event_trigger_data *test;
1313         int ret = 0;
1314 
1315         list_for_each_entry_rcu(test, &file->triggers, list) {
1316                 test_enable_data = test->private_data;
1317                 if (test_enable_data &&
1318                     (test_enable_data->file == enable_data->file)) {
1319                         ret = -EEXIST;
1320                         goto out;
1321                 }
1322         }
1323 
1324         if (data->ops->init) {
1325                 ret = data->ops->init(data->ops, data);
1326                 if (ret < 0)
1327                         goto out;
1328         }
1329 
1330         list_add_rcu(&data->list, &file->triggers);
1331         ret++;
1332 
1333         if (trace_event_trigger_enable_disable(file, 1) < 0) {
1334                 list_del_rcu(&data->list);
1335                 ret--;
1336         }
1337         update_cond_flag(file);
1338 out:
1339         return ret;
1340 }
1341 
1342 static void event_enable_unregister_trigger(char *glob,
1343                                             struct event_trigger_ops *ops,
1344                                             struct event_trigger_data *test,
1345                                             struct ftrace_event_file *file)
1346 {
1347         struct enable_trigger_data *test_enable_data = test->private_data;
1348         struct enable_trigger_data *enable_data;
1349         struct event_trigger_data *data;
1350         bool unregistered = false;
1351 
1352         list_for_each_entry_rcu(data, &file->triggers, list) {
1353                 enable_data = data->private_data;
1354                 if (enable_data &&
1355                     (enable_data->file == test_enable_data->file)) {
1356                         unregistered = true;
1357                         list_del_rcu(&data->list);
1358                         update_cond_flag(file);
1359                         trace_event_trigger_enable_disable(file, 0);
1360                         break;
1361                 }
1362         }
1363 
1364         if (unregistered && data->ops->free)
1365                 data->ops->free(data->ops, data);
1366 }
1367 
1368 static struct event_trigger_ops *
1369 event_enable_get_trigger_ops(char *cmd, char *param)
1370 {
1371         struct event_trigger_ops *ops;
1372         bool enable;
1373 
1374         enable = strcmp(cmd, ENABLE_EVENT_STR) == 0;
1375 
1376         if (enable)
1377                 ops = param ? &event_enable_count_trigger_ops :
1378                         &event_enable_trigger_ops;
1379         else
1380                 ops = param ? &event_disable_count_trigger_ops :
1381                         &event_disable_trigger_ops;
1382 
1383         return ops;
1384 }
1385 
1386 static struct event_command trigger_enable_cmd = {
1387         .name                   = ENABLE_EVENT_STR,
1388         .trigger_type           = ETT_EVENT_ENABLE,
1389         .func                   = event_enable_trigger_func,
1390         .reg                    = event_enable_register_trigger,
1391         .unreg                  = event_enable_unregister_trigger,
1392         .get_trigger_ops        = event_enable_get_trigger_ops,
1393         .set_filter             = set_trigger_filter,
1394 };
1395 
1396 static struct event_command trigger_disable_cmd = {
1397         .name                   = DISABLE_EVENT_STR,
1398         .trigger_type           = ETT_EVENT_ENABLE,
1399         .func                   = event_enable_trigger_func,
1400         .reg                    = event_enable_register_trigger,
1401         .unreg                  = event_enable_unregister_trigger,
1402         .get_trigger_ops        = event_enable_get_trigger_ops,
1403         .set_filter             = set_trigger_filter,
1404 };
1405 
1406 static __init void unregister_trigger_enable_disable_cmds(void)
1407 {
1408         unregister_event_command(&trigger_enable_cmd);
1409         unregister_event_command(&trigger_disable_cmd);
1410 }
1411 
1412 static __init int register_trigger_enable_disable_cmds(void)
1413 {
1414         int ret;
1415 
1416         ret = register_event_command(&trigger_enable_cmd);
1417         if (WARN_ON(ret < 0))
1418                 return ret;
1419         ret = register_event_command(&trigger_disable_cmd);
1420         if (WARN_ON(ret < 0))
1421                 unregister_trigger_enable_disable_cmds();
1422 
1423         return ret;
1424 }
1425 
1426 static __init int register_trigger_traceon_traceoff_cmds(void)
1427 {
1428         int ret;
1429 
1430         ret = register_event_command(&trigger_traceon_cmd);
1431         if (WARN_ON(ret < 0))
1432                 return ret;
1433         ret = register_event_command(&trigger_traceoff_cmd);
1434         if (WARN_ON(ret < 0))
1435                 unregister_trigger_traceon_traceoff_cmds();
1436 
1437         return ret;
1438 }
1439 
1440 __init int register_trigger_cmds(void)
1441 {
1442         register_trigger_traceon_traceoff_cmds();
1443         register_trigger_snapshot_cmd();
1444         register_trigger_stacktrace_cmd();
1445         register_trigger_enable_disable_cmds();
1446 
1447         return 0;
1448 }
1449 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp