Skip to content

Commit 0dea6d5

Browse files
compudjrostedt
authored andcommitted
tracepoint: Remove unused API functions
After the following commit: commit b75ef8b Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Date: Wed Aug 10 15:18:39 2011 -0400 Tracepoint: Dissociate from module mutex The following functions became unnecessary: - tracepoint_probe_register_noupdate, - tracepoint_probe_unregister_noupdate, - tracepoint_probe_update_all. In fact, none of the in-kernel tracers, nor LTTng, nor SystemTAP use them. Remove those. Moreover, the functions: - tracepoint_iter_start, - tracepoint_iter_next, - tracepoint_iter_stop, - tracepoint_iter_reset. are unused by in-kernel tracers, LTTng and SystemTAP. Remove those too. Link: http://lkml.kernel.org/r/1395379142-2118-2-git-send-email-mathieu.desnoyers@efficios.com Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent bc4c426 commit 0dea6d5

2 files changed

Lines changed: 5 additions & 235 deletions

File tree

‎include/linux/tracepoint.h‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ extern int tracepoint_probe_register(const char *name, void *probe, void *data);
4848
extern int
4949
tracepoint_probe_unregister(const char *name, void *probe, void *data);
5050

51-
extern int tracepoint_probe_register_noupdate(const char *name, void *probe,
52-
void *data);
53-
extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe,
54-
void *data);
55-
extern void tracepoint_probe_update_all(void);
56-
5751
#ifdef CONFIG_MODULES
5852
struct tp_module {
5953
struct list_head list;
@@ -62,18 +56,6 @@ struct tp_module {
6256
};
6357
#endif /* CONFIG_MODULES */
6458

65-
struct tracepoint_iter {
66-
#ifdef CONFIG_MODULES
67-
struct tp_module *module;
68-
#endif /* CONFIG_MODULES */
69-
struct tracepoint * const *tracepoint;
70-
};
71-
72-
extern void tracepoint_iter_start(struct tracepoint_iter *iter);
73-
extern void tracepoint_iter_next(struct tracepoint_iter *iter);
74-
extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
75-
extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
76-
7759
/*
7860
* tracepoint_synchronize_unregister must be called between the last tracepoint
7961
* probe unregistration and the end of module exit to make sure there is no

‎kernel/tracepoint.c‎

Lines changed: 5 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ struct tracepoint_entry {
6767
};
6868

6969
struct tp_probes {
70-
union {
71-
struct rcu_head rcu;
72-
struct list_head list;
73-
} u;
70+
struct rcu_head rcu;
7471
struct tracepoint_func probes[0];
7572
};
7673

@@ -83,15 +80,15 @@ static inline void *allocate_probes(int count)
8380

8481
static void rcu_free_old_probes(struct rcu_head *head)
8582
{
86-
kfree(container_of(head, struct tp_probes, u.rcu));
83+
kfree(container_of(head, struct tp_probes, rcu));
8784
}
8885

8986
static inline void release_probes(struct tracepoint_func *old)
9087
{
9188
if (old) {
9289
struct tp_probes *tp_probes = container_of(old,
9390
struct tp_probes, probes[0]);
94-
call_rcu_sched(&tp_probes->u.rcu, rcu_free_old_probes);
91+
call_rcu_sched(&tp_probes->rcu, rcu_free_old_probes);
9592
}
9693
}
9794

@@ -459,204 +456,11 @@ int tracepoint_probe_unregister(const char *name, void *probe, void *data)
459456
}
460457
EXPORT_SYMBOL_GPL(tracepoint_probe_unregister);
461458

462-
static LIST_HEAD(old_probes);
463-
static int need_update;
464-
465-
static void tracepoint_add_old_probes(void *old)
466-
{
467-
need_update = 1;
468-
if (old) {
469-
struct tp_probes *tp_probes = container_of(old,
470-
struct tp_probes, probes[0]);
471-
list_add(&tp_probes->u.list, &old_probes);
472-
}
473-
}
474-
475-
/**
476-
* tracepoint_probe_register_noupdate - register a probe but not connect
477-
* @name: tracepoint name
478-
* @probe: probe handler
479-
* @data: probe private data
480-
*
481-
* caller must call tracepoint_probe_update_all()
482-
*/
483-
int tracepoint_probe_register_noupdate(const char *name, void *probe,
484-
void *data)
485-
{
486-
struct tracepoint_func *old;
487-
488-
mutex_lock(&tracepoints_mutex);
489-
old = tracepoint_add_probe(name, probe, data);
490-
if (IS_ERR(old)) {
491-
mutex_unlock(&tracepoints_mutex);
492-
return PTR_ERR(old);
493-
}
494-
tracepoint_add_old_probes(old);
495-
mutex_unlock(&tracepoints_mutex);
496-
return 0;
497-
}
498-
EXPORT_SYMBOL_GPL(tracepoint_probe_register_noupdate);
499-
500-
/**
501-
* tracepoint_probe_unregister_noupdate - remove a probe but not disconnect
502-
* @name: tracepoint name
503-
* @probe: probe function pointer
504-
* @data: probe private data
505-
*
506-
* caller must call tracepoint_probe_update_all()
507-
*/
508-
int tracepoint_probe_unregister_noupdate(const char *name, void *probe,
509-
void *data)
510-
{
511-
struct tracepoint_func *old;
512-
513-
mutex_lock(&tracepoints_mutex);
514-
old = tracepoint_remove_probe(name, probe, data);
515-
if (IS_ERR(old)) {
516-
mutex_unlock(&tracepoints_mutex);
517-
return PTR_ERR(old);
518-
}
519-
tracepoint_add_old_probes(old);
520-
mutex_unlock(&tracepoints_mutex);
521-
return 0;
522-
}
523-
EXPORT_SYMBOL_GPL(tracepoint_probe_unregister_noupdate);
524-
525-
/**
526-
* tracepoint_probe_update_all - update tracepoints
527-
*/
528-
void tracepoint_probe_update_all(void)
529-
{
530-
LIST_HEAD(release_probes);
531-
struct tp_probes *pos, *next;
532-
533-
mutex_lock(&tracepoints_mutex);
534-
if (!need_update) {
535-
mutex_unlock(&tracepoints_mutex);
536-
return;
537-
}
538-
if (!list_empty(&old_probes))
539-
list_replace_init(&old_probes, &release_probes);
540-
need_update = 0;
541-
tracepoint_update_probes();
542-
mutex_unlock(&tracepoints_mutex);
543-
list_for_each_entry_safe(pos, next, &release_probes, u.list) {
544-
list_del(&pos->u.list);
545-
call_rcu_sched(&pos->u.rcu, rcu_free_old_probes);
546-
}
547-
}
548-
EXPORT_SYMBOL_GPL(tracepoint_probe_update_all);
549-
550-
/**
551-
* tracepoint_get_iter_range - Get a next tracepoint iterator given a range.
552-
* @tracepoint: current tracepoints (in), next tracepoint (out)
553-
* @begin: beginning of the range
554-
* @end: end of the range
555-
*
556-
* Returns whether a next tracepoint has been found (1) or not (0).
557-
* Will return the first tracepoint in the range if the input tracepoint is
558-
* NULL.
559-
*/
560-
static int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
561-
struct tracepoint * const *begin, struct tracepoint * const *end)
562-
{
563-
if (!*tracepoint && begin != end) {
564-
*tracepoint = begin;
565-
return 1;
566-
}
567-
if (*tracepoint >= begin && *tracepoint < end)
568-
return 1;
569-
return 0;
570-
}
571-
572-
#ifdef CONFIG_MODULES
573-
static void tracepoint_get_iter(struct tracepoint_iter *iter)
574-
{
575-
int found = 0;
576-
struct tp_module *iter_mod;
577-
578-
/* Core kernel tracepoints */
579-
if (!iter->module) {
580-
found = tracepoint_get_iter_range(&iter->tracepoint,
581-
__start___tracepoints_ptrs,
582-
__stop___tracepoints_ptrs);
583-
if (found)
584-
goto end;
585-
}
586-
/* Tracepoints in modules */
587-
mutex_lock(&tracepoints_mutex);
588-
list_for_each_entry(iter_mod, &tracepoint_module_list, list) {
589-
/*
590-
* Sorted module list
591-
*/
592-
if (iter_mod < iter->module)
593-
continue;
594-
else if (iter_mod > iter->module)
595-
iter->tracepoint = NULL;
596-
found = tracepoint_get_iter_range(&iter->tracepoint,
597-
iter_mod->tracepoints_ptrs,
598-
iter_mod->tracepoints_ptrs
599-
+ iter_mod->num_tracepoints);
600-
if (found) {
601-
iter->module = iter_mod;
602-
break;
603-
}
604-
}
605-
mutex_unlock(&tracepoints_mutex);
606-
end:
607-
if (!found)
608-
tracepoint_iter_reset(iter);
609-
}
610-
#else /* CONFIG_MODULES */
611-
static void tracepoint_get_iter(struct tracepoint_iter *iter)
612-
{
613-
int found = 0;
614-
615-
/* Core kernel tracepoints */
616-
found = tracepoint_get_iter_range(&iter->tracepoint,
617-
__start___tracepoints_ptrs,
618-
__stop___tracepoints_ptrs);
619-
if (!found)
620-
tracepoint_iter_reset(iter);
621-
}
622-
#endif /* CONFIG_MODULES */
623-
624-
void tracepoint_iter_start(struct tracepoint_iter *iter)
625-
{
626-
tracepoint_get_iter(iter);
627-
}
628-
EXPORT_SYMBOL_GPL(tracepoint_iter_start);
629-
630-
void tracepoint_iter_next(struct tracepoint_iter *iter)
631-
{
632-
iter->tracepoint++;
633-
/*
634-
* iter->tracepoint may be invalid because we blindly incremented it.
635-
* Make sure it is valid by marshalling on the tracepoints, getting the
636-
* tracepoints from following modules if necessary.
637-
*/
638-
tracepoint_get_iter(iter);
639-
}
640-
EXPORT_SYMBOL_GPL(tracepoint_iter_next);
641-
642-
void tracepoint_iter_stop(struct tracepoint_iter *iter)
643-
{
644-
}
645-
EXPORT_SYMBOL_GPL(tracepoint_iter_stop);
646-
647-
void tracepoint_iter_reset(struct tracepoint_iter *iter)
648-
{
649-
#ifdef CONFIG_MODULES
650-
iter->module = NULL;
651-
#endif /* CONFIG_MODULES */
652-
iter->tracepoint = NULL;
653-
}
654-
EXPORT_SYMBOL_GPL(tracepoint_iter_reset);
655459

656460
#ifdef CONFIG_MODULES
657461
static int tracepoint_module_coming(struct module *mod)
658462
{
659-
struct tp_module *tp_mod, *iter;
463+
struct tp_module *tp_mod;
660464
int ret = 0;
661465

662466
if (!mod->num_tracepoints)
@@ -677,23 +481,7 @@ static int tracepoint_module_coming(struct module *mod)
677481
}
678482
tp_mod->num_tracepoints = mod->num_tracepoints;
679483
tp_mod->tracepoints_ptrs = mod->tracepoints_ptrs;
680-
681-
/*
682-
* tracepoint_module_list is kept sorted by struct module pointer
683-
* address for iteration on tracepoints from a seq_file that can release
684-
* the mutex between calls.
685-
*/
686-
list_for_each_entry_reverse(iter, &tracepoint_module_list, list) {
687-
BUG_ON(iter == tp_mod); /* Should never be in the list twice */
688-
if (iter < tp_mod) {
689-
/* We belong to the location right after iter. */
690-
list_add(&tp_mod->list, &iter->list);
691-
goto module_added;
692-
}
693-
}
694-
/* We belong to the beginning of the list */
695-
list_add(&tp_mod->list, &tracepoint_module_list);
696-
module_added:
484+
list_add_tail(&tp_mod->list, &tracepoint_module_list);
697485
tracepoint_update_probe_range(mod->tracepoints_ptrs,
698486
mod->tracepoints_ptrs + mod->num_tracepoints);
699487
end:

0 commit comments

Comments
 (0)