diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-04-20 17:04:50 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-14 09:50:34 -0400 |
commit | 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e (patch) | |
tree | 904476d7780a27001281b9cb93c7959128f9a1d7 /kernel | |
parent | 53da59aa6dd881fd0bbdd058a8a299d90ce9dd1d (diff) |
tracing: Let tracepoints have data passed to tracepoint callbacks
This patch adds data to be passed to tracepoint callbacks.
The created functions from DECLARE_TRACE() now need a mandatory data
parameter. For example:
DECLARE_TRACE(mytracepoint, int value, value)
Will create the register function:
int register_trace_mytracepoint((void(*)(void *data, int value))probe,
void *data);
As the first argument, all callbacks (probes) must take a (void *data)
parameter. So a callback for the above tracepoint will look like:
void myprobe(void *data, int value)
{
}
The callback may choose to ignore the data parameter.
This change allows callbacks to register a private data pointer along
with the function probe.
void mycallback(void *data, int value);
register_trace_mytracepoint(mycallback, mydata);
Then the mycallback() will receive the "mydata" as the first parameter
before the args.
A more detailed example:
DECLARE_TRACE(mytracepoint, TP_PROTO(int status), TP_ARGS(status));
/* In the C file */
DEFINE_TRACE(mytracepoint, TP_PROTO(int status), TP_ARGS(status));
[...]
trace_mytracepoint(status);
/* In a file registering this tracepoint */
int my_callback(void *data, int status)
{
struct my_struct my_data = data;
[...]
}
[...]
my_data = kmalloc(sizeof(*my_data), GFP_KERNEL);
init_my_data(my_data);
register_trace_mytracepoint(my_callback, my_data);
The same callback can also be registered to the same tracepoint as long
as the data registered is different. Note, the data must also be used
to unregister the callback:
unregister_trace_mytracepoint(my_callback, my_data);
Because of the data parameter, tracepoints declared this way can not have
no args. That is:
DECLARE_TRACE(mytracepoint, TP_PROTO(void), TP_ARGS());
will cause an error.
If no arguments are needed, a new macro can be used instead:
DECLARE_TRACE_NOARGS(mytracepoint);
Since there are no arguments, the proto and args fields are left out.
This is part of a series to make the tracepoint footprint smaller:
text data bss dec hex filename
4913961 1088356 861512 6863829 68bbd5 vmlinux.orig
4914025 1088868 861512 6864405 68be15 vmlinux.class
4918492 1084612 861512 6864616 68bee8 vmlinux.tracepoint
Again, this patch also increases the size of the kernel, but
lays the ground work for decreasing it.
v5: Fixed net/core/drop_monitor.c to handle these updates.
v4: Moved the DECLARE_TRACE() DECLARE_TRACE_NOARGS out of the
#ifdef CONFIG_TRACE_POINTS, since the two are the same in both
cases. The __DECLARE_TRACE() is what changes.
Thanks to Frederic Weisbecker for pointing this out.
v3: Made all register_* functions require data to be passed and
all callbacks to take a void * parameter as its first argument.
This makes the calling functions comply with C standards.
Also added more comments to the modifications of DECLARE_TRACE().
v2: Made the DECLARE_TRACE() have the ability to pass arguments
and added a new DECLARE_TRACE_NOARGS() for tracepoints that
do not need any arguments.
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/blktrace.c | 125 | ||||
-rw-r--r-- | kernel/trace/ftrace.c | 7 | ||||
-rw-r--r-- | kernel/trace/kmemtrace.c | 42 | ||||
-rw-r--r-- | kernel/trace/trace_sched_switch.c | 20 | ||||
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 28 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 24 | ||||
-rw-r--r-- | kernel/trace/trace_workqueue.c | 26 | ||||
-rw-r--r-- | kernel/tracepoint.c | 91 |
8 files changed, 201 insertions, 162 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index b3bc91a3f510..19d93f83e3c3 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -675,28 +675,33 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
675 | } | 675 | } |
676 | } | 676 | } |
677 | 677 | ||
678 | static void blk_add_trace_rq_abort(struct request_queue *q, struct request *rq) | 678 | static void blk_add_trace_rq_abort(void *ignore, |
679 | struct request_queue *q, struct request *rq) | ||
679 | { | 680 | { |
680 | blk_add_trace_rq(q, rq, BLK_TA_ABORT); | 681 | blk_add_trace_rq(q, rq, BLK_TA_ABORT); |
681 | } | 682 | } |
682 | 683 | ||
683 | static void blk_add_trace_rq_insert(struct request_queue *q, struct request *rq) | 684 | static void blk_add_trace_rq_insert(void *ignore, |
685 | struct request_queue *q, struct request *rq) | ||
684 | { | 686 | { |
685 | blk_add_trace_rq(q, rq, BLK_TA_INSERT); | 687 | blk_add_trace_rq(q, rq, BLK_TA_INSERT); |
686 | } | 688 | } |
687 | 689 | ||
688 | static void blk_add_trace_rq_issue(struct request_queue *q, struct request *rq) | 690 | static void blk_add_trace_rq_issue(void *ignore, |
691 | struct request_queue *q, struct request *rq) | ||
689 | { | 692 | { |
690 | blk_add_trace_rq(q, rq, BLK_TA_ISSUE); | 693 | blk_add_trace_rq(q, rq, BLK_TA_ISSUE); |
691 | } | 694 | } |
692 | 695 | ||
693 | static void blk_add_trace_rq_requeue(struct request_queue *q, | 696 | static void blk_add_trace_rq_requeue(void *ignore, |
697 | struct request_queue *q, | ||
694 | struct request *rq) | 698 | struct request *rq) |
695 | { | 699 | { |
696 | blk_add_trace_rq(q, rq, BLK_TA_REQUEUE); | 700 | blk_add_trace_rq(q, rq, BLK_TA_REQUEUE); |
697 | } | 701 | } |
698 | 702 | ||
699 | static void blk_add_trace_rq_complete(struct request_queue *q, | 703 | static void blk_add_trace_rq_complete(void *ignore, |
704 | struct request_queue *q, | ||
700 | struct request *rq) | 705 | struct request *rq) |
701 | { | 706 | { |
702 | blk_add_trace_rq(q, rq, BLK_TA_COMPLETE); | 707 | blk_add_trace_rq(q, rq, BLK_TA_COMPLETE); |
@@ -724,34 +729,40 @@ static void blk_add_trace_bio(struct request_queue *q, struct bio *bio, | |||
724 | !bio_flagged(bio, BIO_UPTODATE), 0, NULL); | 729 | !bio_flagged(bio, BIO_UPTODATE), 0, NULL); |
725 | } | 730 | } |
726 | 731 | ||
727 | static void blk_add_trace_bio_bounce(struct request_queue *q, struct bio *bio) | 732 | static void blk_add_trace_bio_bounce(void *ignore, |
733 | struct request_queue *q, struct bio *bio) | ||
728 | { | 734 | { |
729 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE); | 735 | blk_add_trace_bio(q, bio, BLK_TA_BOUNCE); |
730 | } | 736 | } |
731 | 737 | ||
732 | static void blk_add_trace_bio_complete(struct request_queue *q, struct bio *bio) | 738 | static void blk_add_trace_bio_complete(void *ignore, |
739 | struct request_queue *q, struct bio *bio) | ||
733 | { | 740 | { |
734 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE); | 741 | blk_add_trace_bio(q, bio, BLK_TA_COMPLETE); |
735 | } | 742 | } |
736 | 743 | ||
737 | static void blk_add_trace_bio_backmerge(struct request_queue *q, | 744 | static void blk_add_trace_bio_backmerge(void *ignore, |
745 | struct request_queue *q, | ||
738 | struct bio *bio) | 746 | struct bio *bio) |
739 | { | 747 | { |
740 | blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE); | 748 | blk_add_trace_bio(q, bio, BLK_TA_BACKMERGE); |
741 | } | 749 | } |
742 | 750 | ||
743 | static void blk_add_trace_bio_frontmerge(struct request_queue *q, | 751 | static void blk_add_trace_bio_frontmerge(void *ignore, |
752 | struct request_queue *q, | ||
744 | struct bio *bio) | 753 | struct bio *bio) |
745 | { | 754 | { |
746 | blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE); | 755 | blk_add_trace_bio(q, bio, BLK_TA_FRONTMERGE); |
747 | } | 756 | } |
748 | 757 | ||
749 | static void blk_add_trace_bio_queue(struct request_queue *q, struct bio *bio) | 758 | static void blk_add_trace_bio_queue(void *ignore, |
759 | struct request_queue *q, struct bio *bio) | ||
750 | { | 760 | { |
751 | blk_add_trace_bio(q, bio, BLK_TA_QUEUE); | 761 | blk_add_trace_bio(q, bio, BLK_TA_QUEUE); |
752 | } | 762 | } |
753 | 763 | ||
754 | static void blk_add_trace_getrq(struct request_queue *q, | 764 | static void blk_add_trace_getrq(void *ignore, |
765 | struct request_queue *q, | ||
755 | struct bio *bio, int rw) | 766 | struct bio *bio, int rw) |
756 | { | 767 | { |
757 | if (bio) | 768 | if (bio) |
@@ -765,7 +776,8 @@ static void blk_add_trace_getrq(struct request_queue *q, | |||
765 | } | 776 | } |
766 | 777 | ||
767 | 778 | ||
768 | static void blk_add_trace_sleeprq(struct request_queue *q, | 779 | static void blk_add_trace_sleeprq(void *ignore, |
780 | struct request_queue *q, | ||
769 | struct bio *bio, int rw) | 781 | struct bio *bio, int rw) |
770 | { | 782 | { |
771 | if (bio) | 783 | if (bio) |
@@ -779,7 +791,7 @@ static void blk_add_trace_sleeprq(struct request_queue *q, | |||
779 | } | 791 | } |
780 | } | 792 | } |
781 | 793 | ||
782 | static void blk_add_trace_plug(struct request_queue *q) | 794 | static void blk_add_trace_plug(void *ignore, struct request_queue *q) |
783 | { | 795 | { |
784 | struct blk_trace *bt = q->blk_trace; | 796 | struct blk_trace *bt = q->blk_trace; |
785 | 797 | ||
@@ -787,7 +799,7 @@ static void blk_add_trace_plug(struct request_queue *q) | |||
787 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL); | 799 | __blk_add_trace(bt, 0, 0, 0, BLK_TA_PLUG, 0, 0, NULL); |
788 | } | 800 | } |
789 | 801 | ||
790 | static void blk_add_trace_unplug_io(struct request_queue *q) | 802 | static void blk_add_trace_unplug_io(void *ignore, struct request_queue *q) |
791 | { | 803 | { |
792 | struct blk_trace *bt = q->blk_trace; | 804 | struct blk_trace *bt = q->blk_trace; |
793 | 805 | ||
@@ -800,7 +812,7 @@ static void blk_add_trace_unplug_io(struct request_queue *q) | |||
800 | } | 812 | } |
801 | } | 813 | } |
802 | 814 | ||
803 | static void blk_add_trace_unplug_timer(struct request_queue *q) | 815 | static void blk_add_trace_unplug_timer(void *ignore, struct request_queue *q) |
804 | { | 816 | { |
805 | struct blk_trace *bt = q->blk_trace; | 817 | struct blk_trace *bt = q->blk_trace; |
806 | 818 | ||
@@ -813,7 +825,8 @@ static void blk_add_trace_unplug_timer(struct request_queue *q) | |||
813 | } | 825 | } |
814 | } | 826 | } |
815 | 827 | ||
816 | static void blk_add_trace_split(struct request_queue *q, struct bio *bio, | 828 | static void blk_add_trace_split(void *ignore, |
829 | struct request_queue *q, struct bio *bio, | ||
817 | unsigned int pdu) | 830 | unsigned int pdu) |
818 | { | 831 | { |
819 | struct blk_trace *bt = q->blk_trace; | 832 | struct blk_trace *bt = q->blk_trace; |
@@ -839,8 +852,9 @@ static void blk_add_trace_split(struct request_queue *q, struct bio *bio, | |||
839 | * it spans a stripe (or similar). Add a trace for that action. | 852 | * it spans a stripe (or similar). Add a trace for that action. |
840 | * | 853 | * |
841 | **/ | 854 | **/ |
842 | static void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | 855 | static void blk_add_trace_remap(void *ignore, |
843 | dev_t dev, sector_t from) | 856 | struct request_queue *q, struct bio *bio, |
857 | dev_t dev, sector_t from) | ||
844 | { | 858 | { |
845 | struct blk_trace *bt = q->blk_trace; | 859 | struct blk_trace *bt = q->blk_trace; |
846 | struct blk_io_trace_remap r; | 860 | struct blk_io_trace_remap r; |
@@ -869,7 +883,8 @@ static void blk_add_trace_remap(struct request_queue *q, struct bio *bio, | |||
869 | * Add a trace for that action. | 883 | * Add a trace for that action. |
870 | * | 884 | * |
871 | **/ | 885 | **/ |
872 | static void blk_add_trace_rq_remap(struct request_queue *q, | 886 | static void blk_add_trace_rq_remap(void *ignore, |
887 | struct request_queue *q, | ||
873 | struct request *rq, dev_t dev, | 888 | struct request *rq, dev_t dev, |
874 | sector_t from) | 889 | sector_t from) |
875 | { | 890 | { |
@@ -921,64 +936,64 @@ static void blk_register_tracepoints(void) | |||
921 | { | 936 | { |
922 | int ret; | 937 | int ret; |
923 | 938 | ||
924 | ret = register_trace_block_rq_abort(blk_add_trace_rq_abort); | 939 | ret = register_trace_block_rq_abort(blk_add_trace_rq_abort, NULL); |
925 | WARN_ON(ret); | 940 | WARN_ON(ret); |
926 | ret = register_trace_block_rq_insert(blk_add_trace_rq_insert); | 941 | ret = register_trace_block_rq_insert(blk_add_trace_rq_insert, NULL); |
927 | WARN_ON(ret); | 942 | WARN_ON(ret); |
928 | ret = register_trace_block_rq_issue(blk_add_trace_rq_issue); | 943 | ret = register_trace_block_rq_issue(blk_add_trace_rq_issue, NULL); |
929 | WARN_ON(ret); | 944 | WARN_ON(ret); |
930 | ret = register_trace_block_rq_requeue(blk_add_trace_rq_requeue); | 945 | ret = register_trace_block_rq_requeue(blk_add_trace_rq_requeue, NULL); |
931 | WARN_ON(ret); | 946 | WARN_ON(ret); |
932 | ret = register_trace_block_rq_complete(blk_add_trace_rq_complete); | 947 | ret = register_trace_block_rq_complete(blk_add_trace_rq_complete, NULL); |
933 | WARN_ON(ret); | 948 | WARN_ON(ret); |
934 | ret = register_trace_block_bio_bounce(blk_add_trace_bio_bounce); | 949 | ret = register_trace_block_bio_bounce(blk_add_trace_bio_bounce, NULL); |
935 | WARN_ON(ret); | 950 | WARN_ON(ret); |
936 | ret = register_trace_block_bio_complete(blk_add_trace_bio_complete); | 951 | ret = register_trace_block_bio_complete(blk_add_trace_bio_complete, NULL); |
937 | WARN_ON(ret); | 952 | WARN_ON(ret); |
938 | ret = register_trace_block_bio_backmerge(blk_add_trace_bio_backmerge); | 953 | ret = register_trace_block_bio_backmerge(blk_add_trace_bio_backmerge, NULL); |
939 | WARN_ON(ret); | 954 | WARN_ON(ret); |
940 | ret = register_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge); | 955 | ret = register_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge, NULL); |
941 | WARN_ON(ret); | 956 | WARN_ON(ret); |
942 | ret = register_trace_block_bio_queue(blk_add_trace_bio_queue); | 957 | ret = register_trace_block_bio_queue(blk_add_trace_bio_queue, NULL); |
943 | WARN_ON(ret); | 958 | WARN_ON(ret); |
944 | ret = register_trace_block_getrq(blk_add_trace_getrq); | 959 | ret = register_trace_block_getrq(blk_add_trace_getrq, NULL); |
945 | WARN_ON(ret); | 960 | WARN_ON(ret); |
946 | ret = register_trace_block_sleeprq(blk_add_trace_sleeprq); | 961 | ret = register_trace_block_sleeprq(blk_add_trace_sleeprq, NULL); |
947 | WARN_ON(ret); | 962 | WARN_ON(ret); |
948 | ret = register_trace_block_plug(blk_add_trace_plug); | 963 | ret = register_trace_block_plug(blk_add_trace_plug, NULL); |
949 | WARN_ON(ret); | 964 | WARN_ON(ret); |
950 | ret = register_trace_block_unplug_timer(blk_add_trace_unplug_timer); | 965 | ret = register_trace_block_unplug_timer(blk_add_trace_unplug_timer, NULL); |
951 | WARN_ON(ret); | 966 | WARN_ON(ret); |
952 | ret = register_trace_block_unplug_io(blk_add_trace_unplug_io); | 967 | ret = register_trace_block_unplug_io(blk_add_trace_unplug_io, NULL); |
953 | WARN_ON(ret); | 968 | WARN_ON(ret); |
954 | ret = register_trace_block_split(blk_add_trace_split); | 969 | ret = register_trace_block_split(blk_add_trace_split, NULL); |
955 | WARN_ON(ret); | 970 | WARN_ON(ret); |
956 | ret = register_trace_block_remap(blk_add_trace_remap); | 971 | ret = register_trace_block_remap(blk_add_trace_remap, NULL); |
957 | WARN_ON(ret); | 972 | WARN_ON(ret); |
958 | ret = register_trace_block_rq_remap(blk_add_trace_rq_remap); | 973 | ret = register_trace_block_rq_remap(blk_add_trace_rq_remap, NULL); |
959 | WARN_ON(ret); | 974 | WARN_ON(ret); |
960 | } | 975 | } |
961 | 976 | ||
962 | static void blk_unregister_tracepoints(void) | 977 | static void blk_unregister_tracepoints(void) |
963 | { | 978 | { |
964 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap); | 979 | unregister_trace_block_rq_remap(blk_add_trace_rq_remap, NULL); |
965 | unregister_trace_block_remap(blk_add_trace_remap); | 980 | unregister_trace_block_remap(blk_add_trace_remap, NULL); |
966 | unregister_trace_block_split(blk_add_trace_split); | 981 | unregister_trace_block_split(blk_add_trace_split, NULL); |
967 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io); | 982 | unregister_trace_block_unplug_io(blk_add_trace_unplug_io, NULL); |
968 | unregister_trace_block_unplug_timer(blk_add_trace_unplug_timer); | 983 | unregister_trace_block_unplug_timer(blk_add_trace_unplug_timer, NULL); |
969 | unregister_trace_block_plug(blk_add_trace_plug); | 984 | unregister_trace_block_plug(blk_add_trace_plug, NULL); |
970 | unregister_trace_block_sleeprq(blk_add_trace_sleeprq); | 985 | unregister_trace_block_sleeprq(blk_add_trace_sleeprq, NULL); |
971 | unregister_trace_block_getrq(blk_add_trace_getrq); | 986 | unregister_trace_block_getrq(blk_add_trace_getrq, NULL); |
972 | unregister_trace_block_bio_queue(blk_add_trace_bio_queue); | 987 | unregister_trace_block_bio_queue(blk_add_trace_bio_queue, NULL); |
973 | unregister_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge); | 988 | unregister_trace_block_bio_frontmerge(blk_add_trace_bio_frontmerge, NULL); |
974 | unregister_trace_block_bio_backmerge(blk_add_trace_bio_backmerge); | 989 | unregister_trace_block_bio_backmerge(blk_add_trace_bio_backmerge, NULL); |
975 | unregister_trace_block_bio_complete(blk_add_trace_bio_complete); | 990 | unregister_trace_block_bio_complete(blk_add_trace_bio_complete, NULL); |
976 | unregister_trace_block_bio_bounce(blk_add_trace_bio_bounce); | 991 | unregister_trace_block_bio_bounce(blk_add_trace_bio_bounce, NULL); |
977 | unregister_trace_block_rq_complete(blk_add_trace_rq_complete); | 992 | unregister_trace_block_rq_complete(blk_add_trace_rq_complete, NULL); |
978 | unregister_trace_block_rq_requeue(blk_add_trace_rq_requeue); | 993 | unregister_trace_block_rq_requeue(blk_add_trace_rq_requeue, NULL); |
979 | unregister_trace_block_rq_issue(blk_add_trace_rq_issue); | 994 | unregister_trace_block_rq_issue(blk_add_trace_rq_issue, NULL); |
980 | unregister_trace_block_rq_insert(blk_add_trace_rq_insert); | 995 | unregister_trace_block_rq_insert(blk_add_trace_rq_insert, NULL); |
981 | unregister_trace_block_rq_abort(blk_add_trace_rq_abort); | 996 | unregister_trace_block_rq_abort(blk_add_trace_rq_abort, NULL); |
982 | 997 | ||
983 | tracepoint_synchronize_unregister(); | 998 | tracepoint_synchronize_unregister(); |
984 | } | 999 | } |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 32837e19e3bd..6d2cb14f9449 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3234,7 +3234,8 @@ free: | |||
3234 | } | 3234 | } |
3235 | 3235 | ||
3236 | static void | 3236 | static void |
3237 | ftrace_graph_probe_sched_switch(struct task_struct *prev, struct task_struct *next) | 3237 | ftrace_graph_probe_sched_switch(void *ignore, |
3238 | struct task_struct *prev, struct task_struct *next) | ||
3238 | { | 3239 | { |
3239 | unsigned long long timestamp; | 3240 | unsigned long long timestamp; |
3240 | int index; | 3241 | int index; |
@@ -3288,7 +3289,7 @@ static int start_graph_tracing(void) | |||
3288 | } while (ret == -EAGAIN); | 3289 | } while (ret == -EAGAIN); |
3289 | 3290 | ||
3290 | if (!ret) { | 3291 | if (!ret) { |
3291 | ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch); | 3292 | ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL); |
3292 | if (ret) | 3293 | if (ret) |
3293 | pr_info("ftrace_graph: Couldn't activate tracepoint" | 3294 | pr_info("ftrace_graph: Couldn't activate tracepoint" |
3294 | " probe to kernel_sched_switch\n"); | 3295 | " probe to kernel_sched_switch\n"); |
@@ -3364,7 +3365,7 @@ void unregister_ftrace_graph(void) | |||
3364 | ftrace_graph_entry = ftrace_graph_entry_stub; | 3365 | ftrace_graph_entry = ftrace_graph_entry_stub; |
3365 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); | 3366 | ftrace_shutdown(FTRACE_STOP_FUNC_RET); |
3366 | unregister_pm_notifier(&ftrace_suspend_notifier); | 3367 | unregister_pm_notifier(&ftrace_suspend_notifier); |
3367 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch); | 3368 | unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL); |
3368 | 3369 | ||
3369 | out: | 3370 | out: |
3370 | mutex_unlock(&ftrace_lock); | 3371 | mutex_unlock(&ftrace_lock); |
diff --git a/kernel/trace/kmemtrace.c b/kernel/trace/kmemtrace.c index a91da69f153a..7253d0c1c32f 100644 --- a/kernel/trace/kmemtrace.c +++ b/kernel/trace/kmemtrace.c | |||
@@ -95,7 +95,8 @@ static inline void kmemtrace_free(enum kmemtrace_type_id type_id, | |||
95 | trace_wake_up(); | 95 | trace_wake_up(); |
96 | } | 96 | } |
97 | 97 | ||
98 | static void kmemtrace_kmalloc(unsigned long call_site, | 98 | static void kmemtrace_kmalloc(void *ignore, |
99 | unsigned long call_site, | ||
99 | const void *ptr, | 100 | const void *ptr, |
100 | size_t bytes_req, | 101 | size_t bytes_req, |
101 | size_t bytes_alloc, | 102 | size_t bytes_alloc, |
@@ -105,7 +106,8 @@ static void kmemtrace_kmalloc(unsigned long call_site, | |||
105 | bytes_req, bytes_alloc, gfp_flags, -1); | 106 | bytes_req, bytes_alloc, gfp_flags, -1); |
106 | } | 107 | } |
107 | 108 | ||
108 | static void kmemtrace_kmem_cache_alloc(unsigned long call_site, | 109 | static void kmemtrace_kmem_cache_alloc(void *ignore, |
110 | unsigned long call_site, | ||
109 | const void *ptr, | 111 | const void *ptr, |
110 | size_t bytes_req, | 112 | size_t bytes_req, |
111 | size_t bytes_alloc, | 113 | size_t bytes_alloc, |
@@ -115,7 +117,8 @@ static void kmemtrace_kmem_cache_alloc(unsigned long call_site, | |||
115 | bytes_req, bytes_alloc, gfp_flags, -1); | 117 | bytes_req, bytes_alloc, gfp_flags, -1); |
116 | } | 118 | } |
117 | 119 | ||
118 | static void kmemtrace_kmalloc_node(unsigned long call_site, | 120 | static void kmemtrace_kmalloc_node(void *ignore, |
121 | unsigned long call_site, | ||
119 | const void *ptr, | 122 | const void *ptr, |
120 | size_t bytes_req, | 123 | size_t bytes_req, |
121 | size_t bytes_alloc, | 124 | size_t bytes_alloc, |
@@ -126,7 +129,8 @@ static void kmemtrace_kmalloc_node(unsigned long call_site, | |||
126 | bytes_req, bytes_alloc, gfp_flags, node); | 129 | bytes_req, bytes_alloc, gfp_flags, node); |
127 | } | 130 | } |
128 | 131 | ||
129 | static void kmemtrace_kmem_cache_alloc_node(unsigned long call_site, | 132 | static void kmemtrace_kmem_cache_alloc_node(void *ignore, |
133 | unsigned long call_site, | ||
130 | const void *ptr, | 134 | const void *ptr, |
131 | size_t bytes_req, | 135 | size_t bytes_req, |
132 | size_t bytes_alloc, | 136 | size_t bytes_alloc, |
@@ -137,12 +141,14 @@ static void kmemtrace_kmem_cache_alloc_node(unsigned long call_site, | |||
137 | bytes_req, bytes_alloc, gfp_flags, node); | 141 | bytes_req, bytes_alloc, gfp_flags, node); |
138 | } | 142 | } |
139 | 143 | ||
140 | static void kmemtrace_kfree(unsigned long call_site, const void *ptr) | 144 | static void |
145 | kmemtrace_kfree(void *ignore, unsigned long call_site, const void *ptr) | ||
141 | { | 146 | { |
142 | kmemtrace_free(KMEMTRACE_TYPE_KMALLOC, call_site, ptr); | 147 | kmemtrace_free(KMEMTRACE_TYPE_KMALLOC, call_site, ptr); |
143 | } | 148 | } |
144 | 149 | ||
145 | static void kmemtrace_kmem_cache_free(unsigned long call_site, const void *ptr) | 150 | static void kmemtrace_kmem_cache_free(void *ignore, |
151 | unsigned long call_site, const void *ptr) | ||
146 | { | 152 | { |
147 | kmemtrace_free(KMEMTRACE_TYPE_CACHE, call_site, ptr); | 153 | kmemtrace_free(KMEMTRACE_TYPE_CACHE, call_site, ptr); |
148 | } | 154 | } |
@@ -151,34 +157,34 @@ static int kmemtrace_start_probes(void) | |||
151 | { | 157 | { |
152 | int err; | 158 | int err; |
153 | 159 | ||
154 | err = register_trace_kmalloc(kmemtrace_kmalloc); | 160 | err = register_trace_kmalloc(kmemtrace_kmalloc, NULL); |
155 | if (err) | 161 | if (err) |
156 | return err; | 162 | return err; |
157 | err = register_trace_kmem_cache_alloc(kmemtrace_kmem_cache_alloc); | 163 | err = register_trace_kmem_cache_alloc(kmemtrace_kmem_cache_alloc, NULL); |
158 | if (err) | 164 | if (err) |
159 | return err; | 165 | return err; |
160 | err = register_trace_kmalloc_node(kmemtrace_kmalloc_node); | 166 | err = register_trace_kmalloc_node(kmemtrace_kmalloc_node, NULL); |
161 | if (err) | 167 | if (err) |
162 | return err; | 168 | return err; |
163 | err = register_trace_kmem_cache_alloc_node(kmemtrace_kmem_cache_alloc_node); | 169 | err = register_trace_kmem_cache_alloc_node(kmemtrace_kmem_cache_alloc_node, NULL); |
164 | if (err) | 170 | if (err) |
165 | return err; | 171 | return err; |
166 | err = register_trace_kfree(kmemtrace_kfree); | 172 | err = register_trace_kfree(kmemtrace_kfree, NULL); |
167 | if (err) | 173 | if (err) |
168 | return err; | 174 | return err; |
169 | err = register_trace_kmem_cache_free(kmemtrace_kmem_cache_free); | 175 | err = register_trace_kmem_cache_free(kmemtrace_kmem_cache_free, NULL); |
170 | 176 | ||
171 | return err; | 177 | return err; |
172 | } | 178 | } |
173 | 179 | ||
174 | static void kmemtrace_stop_probes(void) | 180 | static void kmemtrace_stop_probes(void) |
175 | { | 181 | { |
176 | unregister_trace_kmalloc(kmemtrace_kmalloc); | 182 | unregister_trace_kmalloc(kmemtrace_kmalloc, NULL); |
177 | unregister_trace_kmem_cache_alloc(kmemtrace_kmem_cache_alloc); | 183 | unregister_trace_kmem_cache_alloc(kmemtrace_kmem_cache_alloc, NULL); |
178 | unregister_trace_kmalloc_node(kmemtrace_kmalloc_node); | 184 | unregister_trace_kmalloc_node(kmemtrace_kmalloc_node, NULL); |
179 | unregister_trace_kmem_cache_alloc_node(kmemtrace_kmem_cache_alloc_node); | 185 | unregister_trace_kmem_cache_alloc_node(kmemtrace_kmem_cache_alloc_node, NULL); |
180 | unregister_trace_kfree(kmemtrace_kfree); | 186 | unregister_trace_kfree(kmemtrace_kfree, NULL); |
181 | unregister_trace_kmem_cache_free(kmemtrace_kmem_cache_free); | 187 | unregister_trace_kmem_cache_free(kmemtrace_kmem_cache_free, NULL); |
182 | } | 188 | } |
183 | 189 | ||
184 | static int kmem_trace_init(struct trace_array *tr) | 190 | static int kmem_trace_init(struct trace_array *tr) |
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c index a55fccfede5d..8f758d070c43 100644 --- a/kernel/trace/trace_sched_switch.c +++ b/kernel/trace/trace_sched_switch.c | |||
@@ -50,7 +50,7 @@ tracing_sched_switch_trace(struct trace_array *tr, | |||
50 | } | 50 | } |
51 | 51 | ||
52 | static void | 52 | static void |
53 | probe_sched_switch(struct task_struct *prev, struct task_struct *next) | 53 | probe_sched_switch(void *ignore, struct task_struct *prev, struct task_struct *next) |
54 | { | 54 | { |
55 | struct trace_array_cpu *data; | 55 | struct trace_array_cpu *data; |
56 | unsigned long flags; | 56 | unsigned long flags; |
@@ -108,7 +108,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr, | |||
108 | } | 108 | } |
109 | 109 | ||
110 | static void | 110 | static void |
111 | probe_sched_wakeup(struct task_struct *wakee, int success) | 111 | probe_sched_wakeup(void *ignore, struct task_struct *wakee, int success) |
112 | { | 112 | { |
113 | struct trace_array_cpu *data; | 113 | struct trace_array_cpu *data; |
114 | unsigned long flags; | 114 | unsigned long flags; |
@@ -138,21 +138,21 @@ static int tracing_sched_register(void) | |||
138 | { | 138 | { |
139 | int ret; | 139 | int ret; |
140 | 140 | ||
141 | ret = register_trace_sched_wakeup(probe_sched_wakeup); | 141 | ret = register_trace_sched_wakeup(probe_sched_wakeup, NULL); |
142 | if (ret) { | 142 | if (ret) { |
143 | pr_info("wakeup trace: Couldn't activate tracepoint" | 143 | pr_info("wakeup trace: Couldn't activate tracepoint" |
144 | " probe to kernel_sched_wakeup\n"); | 144 | " probe to kernel_sched_wakeup\n"); |
145 | return ret; | 145 | return ret; |
146 | } | 146 | } |
147 | 147 | ||
148 | ret = register_trace_sched_wakeup_new(probe_sched_wakeup); | 148 | ret = register_trace_sched_wakeup_new(probe_sched_wakeup, NULL); |
149 | if (ret) { | 149 | if (ret) { |
150 | pr_info("wakeup trace: Couldn't activate tracepoint" | 150 | pr_info("wakeup trace: Couldn't activate tracepoint" |
151 | " probe to kernel_sched_wakeup_new\n"); | 151 | " probe to kernel_sched_wakeup_new\n"); |
152 | goto fail_deprobe; | 152 | goto fail_deprobe; |
153 | } | 153 | } |
154 | 154 | ||
155 | ret = register_trace_sched_switch(probe_sched_switch); | 155 | ret = register_trace_sched_switch(probe_sched_switch, NULL); |
156 | if (ret) { | 156 | if (ret) { |
157 | pr_info("sched trace: Couldn't activate tracepoint" | 157 | pr_info("sched trace: Couldn't activate tracepoint" |
158 | " probe to kernel_sched_switch\n"); | 158 | " probe to kernel_sched_switch\n"); |
@@ -161,17 +161,17 @@ static int tracing_sched_register(void) | |||
161 | 161 | ||
162 | return ret; | 162 | return ret; |
163 | fail_deprobe_wake_new: | 163 | fail_deprobe_wake_new: |
164 | unregister_trace_sched_wakeup_new(probe_sched_wakeup); | 164 | unregister_trace_sched_wakeup_new(probe_sched_wakeup, NULL); |
165 | fail_deprobe: | 165 | fail_deprobe: |
166 | unregister_trace_sched_wakeup(probe_sched_wakeup); | 166 | unregister_trace_sched_wakeup(probe_sched_wakeup, NULL); |
167 | return ret; | 167 | return ret; |
168 | } | 168 | } |
169 | 169 | ||
170 | static void tracing_sched_unregister(void) | 170 | static void tracing_sched_unregister(void) |
171 | { | 171 | { |
172 | unregister_trace_sched_switch(probe_sched_switch); | 172 | unregister_trace_sched_switch(probe_sched_switch, NULL); |
173 | unregister_trace_sched_wakeup_new(probe_sched_wakeup); | 173 | unregister_trace_sched_wakeup_new(probe_sched_wakeup, NULL); |
174 | unregister_trace_sched_wakeup(probe_sched_wakeup); | 174 | unregister_trace_sched_wakeup(probe_sched_wakeup, NULL); |
175 | } | 175 | } |
176 | 176 | ||
177 | static void tracing_start_sched_switch(void) | 177 | static void tracing_start_sched_switch(void) |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 8052446ceeaa..0e73bc2ef8c5 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -98,7 +98,8 @@ static int report_latency(cycle_t delta) | |||
98 | return 1; | 98 | return 1; |
99 | } | 99 | } |
100 | 100 | ||
101 | static void probe_wakeup_migrate_task(struct task_struct *task, int cpu) | 101 | static void |
102 | probe_wakeup_migrate_task(void *ignore, struct task_struct *task, int cpu) | ||
102 | { | 103 | { |
103 | if (task != wakeup_task) | 104 | if (task != wakeup_task) |
104 | return; | 105 | return; |
@@ -107,7 +108,8 @@ static void probe_wakeup_migrate_task(struct task_struct *task, int cpu) | |||
107 | } | 108 | } |
108 | 109 | ||
109 | static void notrace | 110 | static void notrace |
110 | probe_wakeup_sched_switch(struct task_struct *prev, struct task_struct *next) | 111 | probe_wakeup_sched_switch(void *ignore, |
112 | struct task_struct *prev, struct task_struct *next) | ||
111 | { | 113 | { |
112 | struct trace_array_cpu *data; | 114 | struct trace_array_cpu *data; |
113 | cycle_t T0, T1, delta; | 115 | cycle_t T0, T1, delta; |
@@ -199,7 +201,7 @@ static void wakeup_reset(struct trace_array *tr) | |||
199 | } | 201 | } |
200 | 202 | ||
201 | static void | 203 | static void |
202 | probe_wakeup(struct task_struct *p, int success) | 204 | probe_wakeup(void *ignore, struct task_struct *p, int success) |
203 | { | 205 | { |
204 | struct trace_array_cpu *data; | 206 | struct trace_array_cpu *data; |
205 | int cpu = smp_processor_id(); | 207 | int cpu = smp_processor_id(); |
@@ -263,28 +265,28 @@ static void start_wakeup_tracer(struct trace_array *tr) | |||
263 | { | 265 | { |
264 | int ret; | 266 | int ret; |
265 | 267 | ||
266 | ret = register_trace_sched_wakeup(probe_wakeup); | 268 | ret = register_trace_sched_wakeup(probe_wakeup, NULL); |
267 | if (ret) { | 269 | if (ret) { |
268 | pr_info("wakeup trace: Couldn't activate tracepoint" | 270 | pr_info("wakeup trace: Couldn't activate tracepoint" |
269 | " probe to kernel_sched_wakeup\n"); | 271 | " probe to kernel_sched_wakeup\n"); |
270 | return; | 272 | return; |
271 | } | 273 | } |
272 | 274 | ||
273 | ret = register_trace_sched_wakeup_new(probe_wakeup); | 275 | ret = register_trace_sched_wakeup_new(probe_wakeup, NULL); |
274 | if (ret) { | 276 | if (ret) { |
275 | pr_info("wakeup trace: Couldn't activate tracepoint" | 277 | pr_info("wakeup trace: Couldn't activate tracepoint" |
276 | " probe to kernel_sched_wakeup_new\n"); | 278 | " probe to kernel_sched_wakeup_new\n"); |
277 | goto fail_deprobe; | 279 | goto fail_deprobe; |
278 | } | 280 | } |
279 | 281 | ||
280 | ret = register_trace_sched_switch(probe_wakeup_sched_switch); | 282 | ret = register_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
281 | if (ret) { | 283 | if (ret) { |
282 | pr_info("sched trace: Couldn't activate tracepoint" | 284 | pr_info("sched trace: Couldn't activate tracepoint" |
283 | " probe to kernel_sched_switch\n"); | 285 | " probe to kernel_sched_switch\n"); |
284 | goto fail_deprobe_wake_new; | 286 | goto fail_deprobe_wake_new; |
285 | } | 287 | } |
286 | 288 | ||
287 | ret = register_trace_sched_migrate_task(probe_wakeup_migrate_task); | 289 | ret = register_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL); |
288 | if (ret) { | 290 | if (ret) { |
289 | pr_info("wakeup trace: Couldn't activate tracepoint" | 291 | pr_info("wakeup trace: Couldn't activate tracepoint" |
290 | " probe to kernel_sched_migrate_task\n"); | 292 | " probe to kernel_sched_migrate_task\n"); |
@@ -311,19 +313,19 @@ static void start_wakeup_tracer(struct trace_array *tr) | |||
311 | 313 | ||
312 | return; | 314 | return; |
313 | fail_deprobe_wake_new: | 315 | fail_deprobe_wake_new: |
314 | unregister_trace_sched_wakeup_new(probe_wakeup); | 316 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
315 | fail_deprobe: | 317 | fail_deprobe: |
316 | unregister_trace_sched_wakeup(probe_wakeup); | 318 | unregister_trace_sched_wakeup(probe_wakeup, NULL); |
317 | } | 319 | } |
318 | 320 | ||
319 | static void stop_wakeup_tracer(struct trace_array *tr) | 321 | static void stop_wakeup_tracer(struct trace_array *tr) |
320 | { | 322 | { |
321 | tracer_enabled = 0; | 323 | tracer_enabled = 0; |
322 | unregister_ftrace_function(&trace_ops); | 324 | unregister_ftrace_function(&trace_ops); |
323 | unregister_trace_sched_switch(probe_wakeup_sched_switch); | 325 | unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); |
324 | unregister_trace_sched_wakeup_new(probe_wakeup); | 326 | unregister_trace_sched_wakeup_new(probe_wakeup, NULL); |
325 | unregister_trace_sched_wakeup(probe_wakeup); | 327 | unregister_trace_sched_wakeup(probe_wakeup, NULL); |
326 | unregister_trace_sched_migrate_task(probe_wakeup_migrate_task); | 328 | unregister_trace_sched_migrate_task(probe_wakeup_migrate_task, NULL); |
327 | } | 329 | } |
328 | 330 | ||
329 | static int __wakeup_tracer_init(struct trace_array *tr) | 331 | static int __wakeup_tracer_init(struct trace_array *tr) |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index d036a74a64f3..b8d30e7ecd05 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -247,7 +247,7 @@ int syscall_exit_define_fields(struct ftrace_event_call *call) | |||
247 | return ret; | 247 | return ret; |
248 | } | 248 | } |
249 | 249 | ||
250 | void ftrace_syscall_enter(struct pt_regs *regs, long id) | 250 | void ftrace_syscall_enter(void *ignore, struct pt_regs *regs, long id) |
251 | { | 251 | { |
252 | struct syscall_trace_enter *entry; | 252 | struct syscall_trace_enter *entry; |
253 | struct syscall_metadata *sys_data; | 253 | struct syscall_metadata *sys_data; |
@@ -282,7 +282,7 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) | |||
282 | trace_current_buffer_unlock_commit(buffer, event, 0, 0); | 282 | trace_current_buffer_unlock_commit(buffer, event, 0, 0); |
283 | } | 283 | } |
284 | 284 | ||
285 | void ftrace_syscall_exit(struct pt_regs *regs, long ret) | 285 | void ftrace_syscall_exit(void *ignore, struct pt_regs *regs, long ret) |
286 | { | 286 | { |
287 | struct syscall_trace_exit *entry; | 287 | struct syscall_trace_exit *entry; |
288 | struct syscall_metadata *sys_data; | 288 | struct syscall_metadata *sys_data; |
@@ -324,7 +324,7 @@ int reg_event_syscall_enter(struct ftrace_event_call *call) | |||
324 | return -ENOSYS; | 324 | return -ENOSYS; |
325 | mutex_lock(&syscall_trace_lock); | 325 | mutex_lock(&syscall_trace_lock); |
326 | if (!sys_refcount_enter) | 326 | if (!sys_refcount_enter) |
327 | ret = register_trace_sys_enter(ftrace_syscall_enter); | 327 | ret = register_trace_sys_enter(ftrace_syscall_enter, NULL); |
328 | if (!ret) { | 328 | if (!ret) { |
329 | set_bit(num, enabled_enter_syscalls); | 329 | set_bit(num, enabled_enter_syscalls); |
330 | sys_refcount_enter++; | 330 | sys_refcount_enter++; |
@@ -344,7 +344,7 @@ void unreg_event_syscall_enter(struct ftrace_event_call *call) | |||
344 | sys_refcount_enter--; | 344 | sys_refcount_enter--; |
345 | clear_bit(num, enabled_enter_syscalls); | 345 | clear_bit(num, enabled_enter_syscalls); |
346 | if (!sys_refcount_enter) | 346 | if (!sys_refcount_enter) |
347 | unregister_trace_sys_enter(ftrace_syscall_enter); | 347 | unregister_trace_sys_enter(ftrace_syscall_enter, NULL); |
348 | mutex_unlock(&syscall_trace_lock); | 348 | mutex_unlock(&syscall_trace_lock); |
349 | } | 349 | } |
350 | 350 | ||
@@ -358,7 +358,7 @@ int reg_event_syscall_exit(struct ftrace_event_call *call) | |||
358 | return -ENOSYS; | 358 | return -ENOSYS; |
359 | mutex_lock(&syscall_trace_lock); | 359 | mutex_lock(&syscall_trace_lock); |
360 | if (!sys_refcount_exit) | 360 | if (!sys_refcount_exit) |
361 | ret = register_trace_sys_exit(ftrace_syscall_exit); | 361 | ret = register_trace_sys_exit(ftrace_syscall_exit, NULL); |
362 | if (!ret) { | 362 | if (!ret) { |
363 | set_bit(num, enabled_exit_syscalls); | 363 | set_bit(num, enabled_exit_syscalls); |
364 | sys_refcount_exit++; | 364 | sys_refcount_exit++; |
@@ -378,7 +378,7 @@ void unreg_event_syscall_exit(struct ftrace_event_call *call) | |||
378 | sys_refcount_exit--; | 378 | sys_refcount_exit--; |
379 | clear_bit(num, enabled_exit_syscalls); | 379 | clear_bit(num, enabled_exit_syscalls); |
380 | if (!sys_refcount_exit) | 380 | if (!sys_refcount_exit) |
381 | unregister_trace_sys_exit(ftrace_syscall_exit); | 381 | unregister_trace_sys_exit(ftrace_syscall_exit, NULL); |
382 | mutex_unlock(&syscall_trace_lock); | 382 | mutex_unlock(&syscall_trace_lock); |
383 | } | 383 | } |
384 | 384 | ||
@@ -438,7 +438,7 @@ static DECLARE_BITMAP(enabled_perf_exit_syscalls, NR_syscalls); | |||
438 | static int sys_perf_refcount_enter; | 438 | static int sys_perf_refcount_enter; |
439 | static int sys_perf_refcount_exit; | 439 | static int sys_perf_refcount_exit; |
440 | 440 | ||
441 | static void perf_syscall_enter(struct pt_regs *regs, long id) | 441 | static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) |
442 | { | 442 | { |
443 | struct syscall_metadata *sys_data; | 443 | struct syscall_metadata *sys_data; |
444 | struct syscall_trace_enter *rec; | 444 | struct syscall_trace_enter *rec; |
@@ -484,7 +484,7 @@ int perf_sysenter_enable(struct ftrace_event_call *call) | |||
484 | 484 | ||
485 | mutex_lock(&syscall_trace_lock); | 485 | mutex_lock(&syscall_trace_lock); |
486 | if (!sys_perf_refcount_enter) | 486 | if (!sys_perf_refcount_enter) |
487 | ret = register_trace_sys_enter(perf_syscall_enter); | 487 | ret = register_trace_sys_enter(perf_syscall_enter, NULL); |
488 | if (ret) { | 488 | if (ret) { |
489 | pr_info("event trace: Could not activate" | 489 | pr_info("event trace: Could not activate" |
490 | "syscall entry trace point"); | 490 | "syscall entry trace point"); |
@@ -506,11 +506,11 @@ void perf_sysenter_disable(struct ftrace_event_call *call) | |||
506 | sys_perf_refcount_enter--; | 506 | sys_perf_refcount_enter--; |
507 | clear_bit(num, enabled_perf_enter_syscalls); | 507 | clear_bit(num, enabled_perf_enter_syscalls); |
508 | if (!sys_perf_refcount_enter) | 508 | if (!sys_perf_refcount_enter) |
509 | unregister_trace_sys_enter(perf_syscall_enter); | 509 | unregister_trace_sys_enter(perf_syscall_enter, NULL); |
510 | mutex_unlock(&syscall_trace_lock); | 510 | mutex_unlock(&syscall_trace_lock); |
511 | } | 511 | } |
512 | 512 | ||
513 | static void perf_syscall_exit(struct pt_regs *regs, long ret) | 513 | static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) |
514 | { | 514 | { |
515 | struct syscall_metadata *sys_data; | 515 | struct syscall_metadata *sys_data; |
516 | struct syscall_trace_exit *rec; | 516 | struct syscall_trace_exit *rec; |
@@ -559,7 +559,7 @@ int perf_sysexit_enable(struct ftrace_event_call *call) | |||
559 | 559 | ||
560 | mutex_lock(&syscall_trace_lock); | 560 | mutex_lock(&syscall_trace_lock); |
561 | if (!sys_perf_refcount_exit) | 561 | if (!sys_perf_refcount_exit) |
562 | ret = register_trace_sys_exit(perf_syscall_exit); | 562 | ret = register_trace_sys_exit(perf_syscall_exit, NULL); |
563 | if (ret) { | 563 | if (ret) { |
564 | pr_info("event trace: Could not activate" | 564 | pr_info("event trace: Could not activate" |
565 | "syscall exit trace point"); | 565 | "syscall exit trace point"); |
@@ -581,7 +581,7 @@ void perf_sysexit_disable(struct ftrace_event_call *call) | |||
581 | sys_perf_refcount_exit--; | 581 | sys_perf_refcount_exit--; |
582 | clear_bit(num, enabled_perf_exit_syscalls); | 582 | clear_bit(num, enabled_perf_exit_syscalls); |
583 | if (!sys_perf_refcount_exit) | 583 | if (!sys_perf_refcount_exit) |
584 | unregister_trace_sys_exit(perf_syscall_exit); | 584 | unregister_trace_sys_exit(perf_syscall_exit, NULL); |
585 | mutex_unlock(&syscall_trace_lock); | 585 | mutex_unlock(&syscall_trace_lock); |
586 | } | 586 | } |
587 | 587 | ||
diff --git a/kernel/trace/trace_workqueue.c b/kernel/trace/trace_workqueue.c index cc2d2faa7d9e..a7cc3793baf6 100644 --- a/kernel/trace/trace_workqueue.c +++ b/kernel/trace/trace_workqueue.c | |||
@@ -49,7 +49,8 @@ static void cpu_workqueue_stat_free(struct kref *kref) | |||
49 | 49 | ||
50 | /* Insertion of a work */ | 50 | /* Insertion of a work */ |
51 | static void | 51 | static void |
52 | probe_workqueue_insertion(struct task_struct *wq_thread, | 52 | probe_workqueue_insertion(void *ignore, |
53 | struct task_struct *wq_thread, | ||
53 | struct work_struct *work) | 54 | struct work_struct *work) |
54 | { | 55 | { |
55 | int cpu = cpumask_first(&wq_thread->cpus_allowed); | 56 | int cpu = cpumask_first(&wq_thread->cpus_allowed); |
@@ -70,7 +71,8 @@ found: | |||
70 | 71 | ||
71 | /* Execution of a work */ | 72 | /* Execution of a work */ |
72 | static void | 73 | static void |
73 | probe_workqueue_execution(struct task_struct *wq_thread, | 74 | probe_workqueue_execution(void *ignore, |
75 | struct task_struct *wq_thread, | ||
74 | struct work_struct *work) | 76 | struct work_struct *work) |
75 | { | 77 | { |
76 | int cpu = cpumask_first(&wq_thread->cpus_allowed); | 78 | int cpu = cpumask_first(&wq_thread->cpus_allowed); |
@@ -90,7 +92,8 @@ found: | |||
90 | } | 92 | } |
91 | 93 | ||
92 | /* Creation of a cpu workqueue thread */ | 94 | /* Creation of a cpu workqueue thread */ |
93 | static void probe_workqueue_creation(struct task_struct *wq_thread, int cpu) | 95 | static void probe_workqueue_creation(void *ignore, |
96 | struct task_struct *wq_thread, int cpu) | ||
94 | { | 97 | { |
95 | struct cpu_workqueue_stats *cws; | 98 | struct cpu_workqueue_stats *cws; |
96 | unsigned long flags; | 99 | unsigned long flags; |
@@ -114,7 +117,8 @@ static void probe_workqueue_creation(struct task_struct *wq_thread, int cpu) | |||
114 | } | 117 | } |
115 | 118 | ||
116 | /* Destruction of a cpu workqueue thread */ | 119 | /* Destruction of a cpu workqueue thread */ |
117 | static void probe_workqueue_destruction(struct task_struct *wq_thread) | 120 | static void |
121 | probe_workqueue_destruction(void *ignore, struct task_struct *wq_thread) | ||
118 | { | 122 | { |
119 | /* Workqueue only execute on one cpu */ | 123 | /* Workqueue only execute on one cpu */ |
120 | int cpu = cpumask_first(&wq_thread->cpus_allowed); | 124 | int cpu = cpumask_first(&wq_thread->cpus_allowed); |
@@ -259,19 +263,19 @@ int __init trace_workqueue_early_init(void) | |||
259 | { | 263 | { |
260 | int ret, cpu; | 264 | int ret, cpu; |
261 | 265 | ||
262 | ret = register_trace_workqueue_insertion(probe_workqueue_insertion); | 266 | ret = register_trace_workqueue_insertion(probe_workqueue_insertion, NULL); |
263 | if (ret) | 267 | if (ret) |
264 | goto out; | 268 | goto out; |
265 | 269 | ||
266 | ret = register_trace_workqueue_execution(probe_workqueue_execution); | 270 | ret = register_trace_workqueue_execution(probe_workqueue_execution, NULL); |
267 | if (ret) | 271 | if (ret) |
268 | goto no_insertion; | 272 | goto no_insertion; |
269 | 273 | ||
270 | ret = register_trace_workqueue_creation(probe_workqueue_creation); | 274 | ret = register_trace_workqueue_creation(probe_workqueue_creation, NULL); |
271 | if (ret) | 275 | if (ret) |
272 | goto no_execution; | 276 | goto no_execution; |
273 | 277 | ||
274 | ret = register_trace_workqueue_destruction(probe_workqueue_destruction); | 278 | ret = register_trace_workqueue_destruction(probe_workqueue_destruction, NULL); |
275 | if (ret) | 279 | if (ret) |
276 | goto no_creation; | 280 | goto no_creation; |
277 | 281 | ||
@@ -283,11 +287,11 @@ int __init trace_workqueue_early_init(void) | |||
283 | return 0; | 287 | return 0; |
284 | 288 | ||
285 | no_creation: | 289 | no_creation: |
286 | unregister_trace_workqueue_creation(probe_workqueue_creation); | 290 | unregister_trace_workqueue_creation(probe_workqueue_creation, NULL); |
287 | no_execution: | 291 | no_execution: |
288 | unregister_trace_workqueue_execution(probe_workqueue_execution); | 292 | unregister_trace_workqueue_execution(probe_workqueue_execution, NULL); |
289 | no_insertion: | 293 | no_insertion: |
290 | unregister_trace_workqueue_insertion(probe_workqueue_insertion); | 294 | unregister_trace_workqueue_insertion(probe_workqueue_insertion, NULL); |
291 | out: | 295 | out: |
292 | pr_warning("trace_workqueue: unable to trace workqueues\n"); | 296 | pr_warning("trace_workqueue: unable to trace workqueues\n"); |
293 | 297 | ||
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index cc89be5bc0f8..c77f3eceea25 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c | |||
@@ -54,7 +54,7 @@ static struct hlist_head tracepoint_table[TRACEPOINT_TABLE_SIZE]; | |||
54 | */ | 54 | */ |
55 | struct tracepoint_entry { | 55 | struct tracepoint_entry { |
56 | struct hlist_node hlist; | 56 | struct hlist_node hlist; |
57 | void **funcs; | 57 | struct tracepoint_func *funcs; |
58 | int refcount; /* Number of times armed. 0 if disarmed. */ | 58 | int refcount; /* Number of times armed. 0 if disarmed. */ |
59 | char name[0]; | 59 | char name[0]; |
60 | }; | 60 | }; |
@@ -64,12 +64,12 @@ struct tp_probes { | |||
64 | struct rcu_head rcu; | 64 | struct rcu_head rcu; |
65 | struct list_head list; | 65 | struct list_head list; |
66 | } u; | 66 | } u; |
67 | void *probes[0]; | 67 | struct tracepoint_func probes[0]; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static inline void *allocate_probes(int count) | 70 | static inline void *allocate_probes(int count) |
71 | { | 71 | { |
72 | struct tp_probes *p = kmalloc(count * sizeof(void *) | 72 | struct tp_probes *p = kmalloc(count * sizeof(struct tracepoint_func) |
73 | + sizeof(struct tp_probes), GFP_KERNEL); | 73 | + sizeof(struct tp_probes), GFP_KERNEL); |
74 | return p == NULL ? NULL : p->probes; | 74 | return p == NULL ? NULL : p->probes; |
75 | } | 75 | } |
@@ -79,7 +79,7 @@ static void rcu_free_old_probes(struct rcu_head *head) | |||
79 | kfree(container_of(head, struct tp_probes, u.rcu)); | 79 | kfree(container_of(head, struct tp_probes, u.rcu)); |
80 | } | 80 | } |
81 | 81 | ||
82 | static inline void release_probes(void *old) | 82 | static inline void release_probes(struct tracepoint_func *old) |
83 | { | 83 | { |
84 | if (old) { | 84 | if (old) { |
85 | struct tp_probes *tp_probes = container_of(old, | 85 | struct tp_probes *tp_probes = container_of(old, |
@@ -95,15 +95,16 @@ static void debug_print_probes(struct tracepoint_entry *entry) | |||
95 | if (!tracepoint_debug || !entry->funcs) | 95 | if (!tracepoint_debug || !entry->funcs) |
96 | return; | 96 | return; |
97 | 97 | ||
98 | for (i = 0; entry->funcs[i]; i++) | 98 | for (i = 0; entry->funcs[i].func; i++) |
99 | printk(KERN_DEBUG "Probe %d : %p\n", i, entry->funcs[i]); | 99 | printk(KERN_DEBUG "Probe %d : %p\n", i, entry->funcs[i].func); |
100 | } | 100 | } |
101 | 101 | ||
102 | static void * | 102 | static struct tracepoint_func * |
103 | tracepoint_entry_add_probe(struct tracepoint_entry *entry, void *probe) | 103 | tracepoint_entry_add_probe(struct tracepoint_entry *entry, |
104 | void *probe, void *data) | ||
104 | { | 105 | { |
105 | int nr_probes = 0; | 106 | int nr_probes = 0; |
106 | void **old, **new; | 107 | struct tracepoint_func *old, *new; |
107 | 108 | ||
108 | WARN_ON(!probe); | 109 | WARN_ON(!probe); |
109 | 110 | ||
@@ -111,8 +112,9 @@ tracepoint_entry_add_probe(struct tracepoint_entry *entry, void *probe) | |||
111 | old = entry->funcs; | 112 | old = entry->funcs; |
112 | if (old) { | 113 | if (old) { |
113 | /* (N -> N+1), (N != 0, 1) probes */ | 114 | /* (N -> N+1), (N != 0, 1) probes */ |
114 | for (nr_probes = 0; old[nr_probes]; nr_probes++) | 115 | for (nr_probes = 0; old[nr_probes].func; nr_probes++) |
115 | if (old[nr_probes] == probe) | 116 | if (old[nr_probes].func == probe && |
117 | old[nr_probes].data == data) | ||
116 | return ERR_PTR(-EEXIST); | 118 | return ERR_PTR(-EEXIST); |
117 | } | 119 | } |
118 | /* + 2 : one for new probe, one for NULL func */ | 120 | /* + 2 : one for new probe, one for NULL func */ |
@@ -120,9 +122,10 @@ tracepoint_entry_add_probe(struct tracepoint_entry *entry, void *probe) | |||
120 | if (new == NULL) | 122 | if (new == NULL) |
121 | return ERR_PTR(-ENOMEM); | 123 | return ERR_PTR(-ENOMEM); |
122 | if (old) | 124 | if (old) |
123 | memcpy(new, old, nr_probes * sizeof(void *)); | 125 | memcpy(new, old, nr_probes * sizeof(struct tracepoint_func)); |
124 | new[nr_probes] = probe; | 126 | new[nr_probes].func = probe; |
125 | new[nr_probes + 1] = NULL; | 127 | new[nr_probes].data = data; |
128 | new[nr_probes + 1].func = NULL; | ||
126 | entry->refcount = nr_probes + 1; | 129 | entry->refcount = nr_probes + 1; |
127 | entry->funcs = new; | 130 | entry->funcs = new; |
128 | debug_print_probes(entry); | 131 | debug_print_probes(entry); |
@@ -130,10 +133,11 @@ tracepoint_entry_add_probe(struct tracepoint_entry *entry, void *probe) | |||
130 | } | 133 | } |
131 | 134 | ||
132 | static void * | 135 | static void * |
133 | tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe) | 136 | tracepoint_entry_remove_probe(struct tracepoint_entry *entry, |
137 | void *probe, void *data) | ||
134 | { | 138 | { |
135 | int nr_probes = 0, nr_del = 0, i; | 139 | int nr_probes = 0, nr_del = 0, i; |
136 | void **old, **new; | 140 | struct tracepoint_func *old, *new; |
137 | 141 | ||
138 | old = entry->funcs; | 142 | old = entry->funcs; |
139 | 143 | ||
@@ -142,8 +146,10 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe) | |||
142 | 146 | ||
143 | debug_print_probes(entry); | 147 | debug_print_probes(entry); |
144 | /* (N -> M), (N > 1, M >= 0) probes */ | 148 | /* (N -> M), (N > 1, M >= 0) probes */ |
145 | for (nr_probes = 0; old[nr_probes]; nr_probes++) { | 149 | for (nr_probes = 0; old[nr_probes].func; nr_probes++) { |
146 | if ((!probe || old[nr_probes] == probe)) | 150 | if (!probe || |
151 | (old[nr_probes].func == probe && | ||
152 | old[nr_probes].data == data)) | ||
147 | nr_del++; | 153 | nr_del++; |
148 | } | 154 | } |
149 | 155 | ||
@@ -160,10 +166,11 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe) | |||
160 | new = allocate_probes(nr_probes - nr_del + 1); | 166 | new = allocate_probes(nr_probes - nr_del + 1); |
161 | if (new == NULL) | 167 | if (new == NULL) |
162 | return ERR_PTR(-ENOMEM); | 168 | return ERR_PTR(-ENOMEM); |
163 | for (i = 0; old[i]; i++) | 169 | for (i = 0; old[i].func; i++) |
164 | if ((probe && old[i] != probe)) | 170 | if (probe && |
171 | (old[i].func != probe || old[i].data != data)) | ||
165 | new[j++] = old[i]; | 172 | new[j++] = old[i]; |
166 | new[nr_probes - nr_del] = NULL; | 173 | new[nr_probes - nr_del].func = NULL; |
167 | entry->refcount = nr_probes - nr_del; | 174 | entry->refcount = nr_probes - nr_del; |
168 | entry->funcs = new; | 175 | entry->funcs = new; |
169 | } | 176 | } |
@@ -315,18 +322,19 @@ static void tracepoint_update_probes(void) | |||
315 | module_update_tracepoints(); | 322 | module_update_tracepoints(); |
316 | } | 323 | } |
317 | 324 | ||
318 | static void *tracepoint_add_probe(const char *name, void *probe) | 325 | static struct tracepoint_func * |
326 | tracepoint_add_probe(const char *name, void *probe, void *data) | ||
319 | { | 327 | { |
320 | struct tracepoint_entry *entry; | 328 | struct tracepoint_entry *entry; |
321 | void *old; | 329 | struct tracepoint_func *old; |
322 | 330 | ||
323 | entry = get_tracepoint(name); | 331 | entry = get_tracepoint(name); |
324 | if (!entry) { | 332 | if (!entry) { |
325 | entry = add_tracepoint(name); | 333 | entry = add_tracepoint(name); |
326 | if (IS_ERR(entry)) | 334 | if (IS_ERR(entry)) |
327 | return entry; | 335 | return (struct tracepoint_func *)entry; |
328 | } | 336 | } |
329 | old = tracepoint_entry_add_probe(entry, probe); | 337 | old = tracepoint_entry_add_probe(entry, probe, data); |
330 | if (IS_ERR(old) && !entry->refcount) | 338 | if (IS_ERR(old) && !entry->refcount) |
331 | remove_tracepoint(entry); | 339 | remove_tracepoint(entry); |
332 | return old; | 340 | return old; |
@@ -340,12 +348,12 @@ static void *tracepoint_add_probe(const char *name, void *probe) | |||
340 | * Returns 0 if ok, error value on error. | 348 | * Returns 0 if ok, error value on error. |
341 | * The probe address must at least be aligned on the architecture pointer size. | 349 | * The probe address must at least be aligned on the architecture pointer size. |
342 | */ | 350 | */ |
343 | int tracepoint_probe_register(const char *name, void *probe) | 351 | int tracepoint_probe_register(const char *name, void *probe, void *data) |
344 | { | 352 | { |
345 | void *old; | 353 | struct tracepoint_func *old; |
346 | 354 | ||
347 | mutex_lock(&tracepoints_mutex); | 355 | mutex_lock(&tracepoints_mutex); |
348 | old = tracepoint_add_probe(name, probe); | 356 | old = tracepoint_add_probe(name, probe, data); |
349 | mutex_unlock(&tracepoints_mutex); | 357 | mutex_unlock(&tracepoints_mutex); |
350 | if (IS_ERR(old)) | 358 | if (IS_ERR(old)) |
351 | return PTR_ERR(old); | 359 | return PTR_ERR(old); |
@@ -356,15 +364,16 @@ int tracepoint_probe_register(const char *name, void *probe) | |||
356 | } | 364 | } |
357 | EXPORT_SYMBOL_GPL(tracepoint_probe_register); | 365 | EXPORT_SYMBOL_GPL(tracepoint_probe_register); |
358 | 366 | ||
359 | static void *tracepoint_remove_probe(const char *name, void *probe) | 367 | static struct tracepoint_func * |
368 | tracepoint_remove_probe(const char *name, void *probe, void *data) | ||
360 | { | 369 | { |
361 | struct tracepoint_entry *entry; | 370 | struct tracepoint_entry *entry; |
362 | void *old; | 371 | struct tracepoint_func *old; |
363 | 372 | ||
364 | entry = get_tracepoint(name); | 373 | entry = get_tracepoint(name); |
365 | if (!entry) | 374 | if (!entry) |
366 | return ERR_PTR(-ENOENT); | 375 | return ERR_PTR(-ENOENT); |
367 | old = tracepoint_entry_remove_probe(entry, probe); | 376 | old = tracepoint_entry_remove_probe(entry, probe, data); |
368 | if (IS_ERR(old)) | 377 | if (IS_ERR(old)) |
369 | return old; | 378 | return old; |
370 | if (!entry->refcount) | 379 | if (!entry->refcount) |
@@ -382,12 +391,12 @@ static void *tracepoint_remove_probe(const char *name, void *probe) | |||
382 | * itself uses stop_machine(), which insures that every preempt disabled section | 391 | * itself uses stop_machine(), which insures that every preempt disabled section |
383 | * have finished. | 392 | * have finished. |
384 | */ | 393 | */ |
385 | int tracepoint_probe_unregister(const char *name, void *probe) | 394 | int tracepoint_probe_unregister(const char *name, void *probe, void *data) |
386 | { | 395 | { |
387 | void *old; | 396 | struct tracepoint_func *old; |
388 | 397 | ||
389 | mutex_lock(&tracepoints_mutex); | 398 | mutex_lock(&tracepoints_mutex); |
390 | old = tracepoint_remove_probe(name, probe); | 399 | old = tracepoint_remove_probe(name, probe, data); |
391 | mutex_unlock(&tracepoints_mutex); | 400 | mutex_unlock(&tracepoints_mutex); |
392 | if (IS_ERR(old)) | 401 | if (IS_ERR(old)) |
393 | return PTR_ERR(old); | 402 | return PTR_ERR(old); |
@@ -418,12 +427,13 @@ static void tracepoint_add_old_probes(void *old) | |||
418 | * | 427 | * |
419 | * caller must call tracepoint_probe_update_all() | 428 | * caller must call tracepoint_probe_update_all() |
420 | */ | 429 | */ |
421 | int tracepoint_probe_register_noupdate(const char *name, void *probe) | 430 | int tracepoint_probe_register_noupdate(const char *name, void *probe, |
431 | void *data) | ||
422 | { | 432 | { |
423 | void *old; | 433 | struct tracepoint_func *old; |
424 | 434 | ||
425 | mutex_lock(&tracepoints_mutex); | 435 | mutex_lock(&tracepoints_mutex); |
426 | old = tracepoint_add_probe(name, probe); | 436 | old = tracepoint_add_probe(name, probe, data); |
427 | if (IS_ERR(old)) { | 437 | if (IS_ERR(old)) { |
428 | mutex_unlock(&tracepoints_mutex); | 438 | mutex_unlock(&tracepoints_mutex); |
429 | return PTR_ERR(old); | 439 | return PTR_ERR(old); |
@@ -441,12 +451,13 @@ EXPORT_SYMBOL_GPL(tracepoint_probe_register_noupdate); | |||
441 | * | 451 | * |
442 | * caller must call tracepoint_probe_update_all() | 452 | * caller must call tracepoint_probe_update_all() |
443 | */ | 453 | */ |
444 | int tracepoint_probe_unregister_noupdate(const char *name, void *probe) | 454 | int tracepoint_probe_unregister_noupdate(const char *name, void *probe, |
455 | void *data) | ||
445 | { | 456 | { |
446 | void *old; | 457 | struct tracepoint_func *old; |
447 | 458 | ||
448 | mutex_lock(&tracepoints_mutex); | 459 | mutex_lock(&tracepoints_mutex); |
449 | old = tracepoint_remove_probe(name, probe); | 460 | old = tracepoint_remove_probe(name, probe, data); |
450 | if (IS_ERR(old)) { | 461 | if (IS_ERR(old)) { |
451 | mutex_unlock(&tracepoints_mutex); | 462 | mutex_unlock(&tracepoints_mutex); |
452 | return PTR_ERR(old); | 463 | return PTR_ERR(old); |