diff options
| author | Namhyung Kim <namhyung.kim@lge.com> | 2013-07-03 02:42:53 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2014-01-02 16:17:36 -0500 |
| commit | 14577c39927f86e3dba967f9b511f4a876b7f8bb (patch) | |
| tree | ee08e2d02b094b68bfa02878e1f4f017183a5f46 /kernel/trace | |
| parent | c31ffb3ff633109e8b7b438a9e1815b919f5e32d (diff) | |
tracing/uprobes: Convert to struct trace_probe
Convert struct trace_uprobe to make use of the common trace_probe
structure.
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'kernel/trace')
| -rw-r--r-- | kernel/trace/trace_uprobe.c | 159 |
1 files changed, 79 insertions, 80 deletions
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index c77b92d61551..afda3726f288 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
| @@ -51,22 +51,17 @@ struct trace_uprobe_filter { | |||
| 51 | */ | 51 | */ |
| 52 | struct trace_uprobe { | 52 | struct trace_uprobe { |
| 53 | struct list_head list; | 53 | struct list_head list; |
| 54 | struct ftrace_event_class class; | ||
| 55 | struct ftrace_event_call call; | ||
| 56 | struct trace_uprobe_filter filter; | 54 | struct trace_uprobe_filter filter; |
| 57 | struct uprobe_consumer consumer; | 55 | struct uprobe_consumer consumer; |
| 58 | struct inode *inode; | 56 | struct inode *inode; |
| 59 | char *filename; | 57 | char *filename; |
| 60 | unsigned long offset; | 58 | unsigned long offset; |
| 61 | unsigned long nhit; | 59 | unsigned long nhit; |
| 62 | unsigned int flags; /* For TP_FLAG_* */ | 60 | struct trace_probe tp; |
| 63 | ssize_t size; /* trace entry size */ | ||
| 64 | unsigned int nr_args; | ||
| 65 | struct probe_arg args[]; | ||
| 66 | }; | 61 | }; |
| 67 | 62 | ||
| 68 | #define SIZEOF_TRACE_UPROBE(n) \ | 63 | #define SIZEOF_TRACE_UPROBE(n) \ |
| 69 | (offsetof(struct trace_uprobe, args) + \ | 64 | (offsetof(struct trace_uprobe, tp.args) + \ |
| 70 | (sizeof(struct probe_arg) * (n))) | 65 | (sizeof(struct probe_arg) * (n))) |
| 71 | 66 | ||
| 72 | static int register_uprobe_event(struct trace_uprobe *tu); | 67 | static int register_uprobe_event(struct trace_uprobe *tu); |
| @@ -114,13 +109,13 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) | |||
| 114 | if (!tu) | 109 | if (!tu) |
| 115 | return ERR_PTR(-ENOMEM); | 110 | return ERR_PTR(-ENOMEM); |
| 116 | 111 | ||
| 117 | tu->call.class = &tu->class; | 112 | tu->tp.call.class = &tu->tp.class; |
| 118 | tu->call.name = kstrdup(event, GFP_KERNEL); | 113 | tu->tp.call.name = kstrdup(event, GFP_KERNEL); |
| 119 | if (!tu->call.name) | 114 | if (!tu->tp.call.name) |
| 120 | goto error; | 115 | goto error; |
| 121 | 116 | ||
| 122 | tu->class.system = kstrdup(group, GFP_KERNEL); | 117 | tu->tp.class.system = kstrdup(group, GFP_KERNEL); |
| 123 | if (!tu->class.system) | 118 | if (!tu->tp.class.system) |
| 124 | goto error; | 119 | goto error; |
| 125 | 120 | ||
| 126 | INIT_LIST_HEAD(&tu->list); | 121 | INIT_LIST_HEAD(&tu->list); |
| @@ -128,11 +123,11 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret) | |||
| 128 | if (is_ret) | 123 | if (is_ret) |
| 129 | tu->consumer.ret_handler = uretprobe_dispatcher; | 124 | tu->consumer.ret_handler = uretprobe_dispatcher; |
| 130 | init_trace_uprobe_filter(&tu->filter); | 125 | init_trace_uprobe_filter(&tu->filter); |
| 131 | tu->call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER; | 126 | tu->tp.call.flags |= TRACE_EVENT_FL_USE_CALL_FILTER; |
| 132 | return tu; | 127 | return tu; |
| 133 | 128 | ||
| 134 | error: | 129 | error: |
| 135 | kfree(tu->call.name); | 130 | kfree(tu->tp.call.name); |
| 136 | kfree(tu); | 131 | kfree(tu); |
| 137 | 132 | ||
| 138 | return ERR_PTR(-ENOMEM); | 133 | return ERR_PTR(-ENOMEM); |
| @@ -142,12 +137,12 @@ static void free_trace_uprobe(struct trace_uprobe *tu) | |||
| 142 | { | 137 | { |
| 143 | int i; | 138 | int i; |
| 144 | 139 | ||
| 145 | for (i = 0; i < tu->nr_args; i++) | 140 | for (i = 0; i < tu->tp.nr_args; i++) |
| 146 | traceprobe_free_probe_arg(&tu->args[i]); | 141 | traceprobe_free_probe_arg(&tu->tp.args[i]); |
| 147 | 142 | ||
| 148 | iput(tu->inode); | 143 | iput(tu->inode); |
| 149 | kfree(tu->call.class->system); | 144 | kfree(tu->tp.call.class->system); |
| 150 | kfree(tu->call.name); | 145 | kfree(tu->tp.call.name); |
| 151 | kfree(tu->filename); | 146 | kfree(tu->filename); |
| 152 | kfree(tu); | 147 | kfree(tu); |
| 153 | } | 148 | } |
| @@ -157,8 +152,8 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *grou | |||
| 157 | struct trace_uprobe *tu; | 152 | struct trace_uprobe *tu; |
| 158 | 153 | ||
| 159 | list_for_each_entry(tu, &uprobe_list, list) | 154 | list_for_each_entry(tu, &uprobe_list, list) |
| 160 | if (strcmp(tu->call.name, event) == 0 && | 155 | if (strcmp(tu->tp.call.name, event) == 0 && |
| 161 | strcmp(tu->call.class->system, group) == 0) | 156 | strcmp(tu->tp.call.class->system, group) == 0) |
| 162 | return tu; | 157 | return tu; |
| 163 | 158 | ||
| 164 | return NULL; | 159 | return NULL; |
| @@ -181,16 +176,16 @@ static int unregister_trace_uprobe(struct trace_uprobe *tu) | |||
| 181 | /* Register a trace_uprobe and probe_event */ | 176 | /* Register a trace_uprobe and probe_event */ |
| 182 | static int register_trace_uprobe(struct trace_uprobe *tu) | 177 | static int register_trace_uprobe(struct trace_uprobe *tu) |
| 183 | { | 178 | { |
| 184 | struct trace_uprobe *old_tp; | 179 | struct trace_uprobe *old_tu; |
| 185 | int ret; | 180 | int ret; |
| 186 | 181 | ||
| 187 | mutex_lock(&uprobe_lock); | 182 | mutex_lock(&uprobe_lock); |
| 188 | 183 | ||
| 189 | /* register as an event */ | 184 | /* register as an event */ |
| 190 | old_tp = find_probe_event(tu->call.name, tu->call.class->system); | 185 | old_tu = find_probe_event(tu->tp.call.name, tu->tp.call.class->system); |
| 191 | if (old_tp) { | 186 | if (old_tu) { |
| 192 | /* delete old event */ | 187 | /* delete old event */ |
| 193 | ret = unregister_trace_uprobe(old_tp); | 188 | ret = unregister_trace_uprobe(old_tu); |
| 194 | if (ret) | 189 | if (ret) |
| 195 | goto end; | 190 | goto end; |
| 196 | } | 191 | } |
| @@ -360,34 +355,36 @@ static int create_trace_uprobe(int argc, char **argv) | |||
| 360 | /* parse arguments */ | 355 | /* parse arguments */ |
| 361 | ret = 0; | 356 | ret = 0; |
| 362 | for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) { | 357 | for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) { |
| 358 | struct probe_arg *parg = &tu->tp.args[i]; | ||
| 359 | |||
| 363 | /* Increment count for freeing args in error case */ | 360 | /* Increment count for freeing args in error case */ |
| 364 | tu->nr_args++; | 361 | tu->tp.nr_args++; |
| 365 | 362 | ||
| 366 | /* Parse argument name */ | 363 | /* Parse argument name */ |
| 367 | arg = strchr(argv[i], '='); | 364 | arg = strchr(argv[i], '='); |
| 368 | if (arg) { | 365 | if (arg) { |
| 369 | *arg++ = '\0'; | 366 | *arg++ = '\0'; |
| 370 | tu->args[i].name = kstrdup(argv[i], GFP_KERNEL); | 367 | parg->name = kstrdup(argv[i], GFP_KERNEL); |
| 371 | } else { | 368 | } else { |
| 372 | arg = argv[i]; | 369 | arg = argv[i]; |
| 373 | /* If argument name is omitted, set "argN" */ | 370 | /* If argument name is omitted, set "argN" */ |
| 374 | snprintf(buf, MAX_EVENT_NAME_LEN, "arg%d", i + 1); | 371 | snprintf(buf, MAX_EVENT_NAME_LEN, "arg%d", i + 1); |
| 375 | tu->args[i].name = kstrdup(buf, GFP_KERNEL); | 372 | parg->name = kstrdup(buf, GFP_KERNEL); |
| 376 | } | 373 | } |
| 377 | 374 | ||
| 378 | if (!tu->args[i].name) { | 375 | if (!parg->name) { |
| 379 | pr_info("Failed to allocate argument[%d] name.\n", i); | 376 | pr_info("Failed to allocate argument[%d] name.\n", i); |
| 380 | ret = -ENOMEM; | 377 | ret = -ENOMEM; |
| 381 | goto error; | 378 | goto error; |
| 382 | } | 379 | } |
| 383 | 380 | ||
| 384 | if (!is_good_name(tu->args[i].name)) { | 381 | if (!is_good_name(parg->name)) { |
| 385 | pr_info("Invalid argument[%d] name: %s\n", i, tu->args[i].name); | 382 | pr_info("Invalid argument[%d] name: %s\n", i, parg->name); |
| 386 | ret = -EINVAL; | 383 | ret = -EINVAL; |
| 387 | goto error; | 384 | goto error; |
| 388 | } | 385 | } |
| 389 | 386 | ||
| 390 | if (traceprobe_conflict_field_name(tu->args[i].name, tu->args, i)) { | 387 | if (traceprobe_conflict_field_name(parg->name, tu->tp.args, i)) { |
| 391 | pr_info("Argument[%d] name '%s' conflicts with " | 388 | pr_info("Argument[%d] name '%s' conflicts with " |
| 392 | "another field.\n", i, argv[i]); | 389 | "another field.\n", i, argv[i]); |
| 393 | ret = -EINVAL; | 390 | ret = -EINVAL; |
| @@ -395,7 +392,8 @@ static int create_trace_uprobe(int argc, char **argv) | |||
| 395 | } | 392 | } |
| 396 | 393 | ||
| 397 | /* Parse fetch argument */ | 394 | /* Parse fetch argument */ |
| 398 | ret = traceprobe_parse_probe_arg(arg, &tu->size, &tu->args[i], false, false); | 395 | ret = traceprobe_parse_probe_arg(arg, &tu->tp.size, parg, |
| 396 | false, false); | ||
| 399 | if (ret) { | 397 | if (ret) { |
| 400 | pr_info("Parse error at argument[%d]. (%d)\n", i, ret); | 398 | pr_info("Parse error at argument[%d]. (%d)\n", i, ret); |
| 401 | goto error; | 399 | goto error; |
| @@ -459,11 +457,11 @@ static int probes_seq_show(struct seq_file *m, void *v) | |||
| 459 | char c = is_ret_probe(tu) ? 'r' : 'p'; | 457 | char c = is_ret_probe(tu) ? 'r' : 'p'; |
| 460 | int i; | 458 | int i; |
| 461 | 459 | ||
| 462 | seq_printf(m, "%c:%s/%s", c, tu->call.class->system, tu->call.name); | 460 | seq_printf(m, "%c:%s/%s", c, tu->tp.call.class->system, tu->tp.call.name); |
| 463 | seq_printf(m, " %s:0x%p", tu->filename, (void *)tu->offset); | 461 | seq_printf(m, " %s:0x%p", tu->filename, (void *)tu->offset); |
| 464 | 462 | ||
| 465 | for (i = 0; i < tu->nr_args; i++) | 463 | for (i = 0; i < tu->tp.nr_args; i++) |
| 466 | seq_printf(m, " %s=%s", tu->args[i].name, tu->args[i].comm); | 464 | seq_printf(m, " %s=%s", tu->tp.args[i].name, tu->tp.args[i].comm); |
| 467 | 465 | ||
| 468 | seq_printf(m, "\n"); | 466 | seq_printf(m, "\n"); |
| 469 | return 0; | 467 | return 0; |
| @@ -509,7 +507,7 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) | |||
| 509 | { | 507 | { |
| 510 | struct trace_uprobe *tu = v; | 508 | struct trace_uprobe *tu = v; |
| 511 | 509 | ||
| 512 | seq_printf(m, " %s %-44s %15lu\n", tu->filename, tu->call.name, tu->nhit); | 510 | seq_printf(m, " %s %-44s %15lu\n", tu->filename, tu->tp.call.name, tu->nhit); |
| 513 | return 0; | 511 | return 0; |
| 514 | } | 512 | } |
| 515 | 513 | ||
| @@ -541,11 +539,11 @@ static void uprobe_trace_print(struct trace_uprobe *tu, | |||
| 541 | struct ring_buffer *buffer; | 539 | struct ring_buffer *buffer; |
| 542 | void *data; | 540 | void *data; |
| 543 | int size, i; | 541 | int size, i; |
| 544 | struct ftrace_event_call *call = &tu->call; | 542 | struct ftrace_event_call *call = &tu->tp.call; |
| 545 | 543 | ||
| 546 | size = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); | 544 | size = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); |
| 547 | event = trace_current_buffer_lock_reserve(&buffer, call->event.type, | 545 | event = trace_current_buffer_lock_reserve(&buffer, call->event.type, |
| 548 | size + tu->size, 0, 0); | 546 | size + tu->tp.size, 0, 0); |
| 549 | if (!event) | 547 | if (!event) |
| 550 | return; | 548 | return; |
| 551 | 549 | ||
| @@ -559,8 +557,10 @@ static void uprobe_trace_print(struct trace_uprobe *tu, | |||
| 559 | data = DATAOF_TRACE_ENTRY(entry, false); | 557 | data = DATAOF_TRACE_ENTRY(entry, false); |
| 560 | } | 558 | } |
| 561 | 559 | ||
| 562 | for (i = 0; i < tu->nr_args; i++) | 560 | for (i = 0; i < tu->tp.nr_args; i++) { |
| 563 | call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset); | 561 | call_fetch(&tu->tp.args[i].fetch, regs, |
| 562 | data + tu->tp.args[i].offset); | ||
| 563 | } | ||
| 564 | 564 | ||
| 565 | if (!call_filter_check_discard(call, entry, buffer, event)) | 565 | if (!call_filter_check_discard(call, entry, buffer, event)) |
| 566 | trace_buffer_unlock_commit(buffer, event, 0, 0); | 566 | trace_buffer_unlock_commit(buffer, event, 0, 0); |
| @@ -591,23 +591,24 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e | |||
| 591 | int i; | 591 | int i; |
| 592 | 592 | ||
| 593 | entry = (struct uprobe_trace_entry_head *)iter->ent; | 593 | entry = (struct uprobe_trace_entry_head *)iter->ent; |
| 594 | tu = container_of(event, struct trace_uprobe, call.event); | 594 | tu = container_of(event, struct trace_uprobe, tp.call.event); |
| 595 | 595 | ||
| 596 | if (is_ret_probe(tu)) { | 596 | if (is_ret_probe(tu)) { |
| 597 | if (!trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)", tu->call.name, | 597 | if (!trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)", tu->tp.call.name, |
| 598 | entry->vaddr[1], entry->vaddr[0])) | 598 | entry->vaddr[1], entry->vaddr[0])) |
| 599 | goto partial; | 599 | goto partial; |
| 600 | data = DATAOF_TRACE_ENTRY(entry, true); | 600 | data = DATAOF_TRACE_ENTRY(entry, true); |
| 601 | } else { | 601 | } else { |
| 602 | if (!trace_seq_printf(s, "%s: (0x%lx)", tu->call.name, | 602 | if (!trace_seq_printf(s, "%s: (0x%lx)", tu->tp.call.name, |
| 603 | entry->vaddr[0])) | 603 | entry->vaddr[0])) |
| 604 | goto partial; | 604 | goto partial; |
| 605 | data = DATAOF_TRACE_ENTRY(entry, false); | 605 | data = DATAOF_TRACE_ENTRY(entry, false); |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | for (i = 0; i < tu->nr_args; i++) { | 608 | for (i = 0; i < tu->tp.nr_args; i++) { |
| 609 | if (!tu->args[i].type->print(s, tu->args[i].name, | 609 | struct probe_arg *parg = &tu->tp.args[i]; |
| 610 | data + tu->args[i].offset, entry)) | 610 | |
| 611 | if (!parg->type->print(s, parg->name, data + parg->offset, entry)) | ||
| 611 | goto partial; | 612 | goto partial; |
| 612 | } | 613 | } |
| 613 | 614 | ||
| @@ -618,11 +619,6 @@ partial: | |||
| 618 | return TRACE_TYPE_PARTIAL_LINE; | 619 | return TRACE_TYPE_PARTIAL_LINE; |
| 619 | } | 620 | } |
| 620 | 621 | ||
| 621 | static inline bool is_trace_uprobe_enabled(struct trace_uprobe *tu) | ||
| 622 | { | ||
| 623 | return tu->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE); | ||
| 624 | } | ||
| 625 | |||
| 626 | typedef bool (*filter_func_t)(struct uprobe_consumer *self, | 622 | typedef bool (*filter_func_t)(struct uprobe_consumer *self, |
| 627 | enum uprobe_filter_ctx ctx, | 623 | enum uprobe_filter_ctx ctx, |
| 628 | struct mm_struct *mm); | 624 | struct mm_struct *mm); |
| @@ -632,29 +628,29 @@ probe_event_enable(struct trace_uprobe *tu, int flag, filter_func_t filter) | |||
| 632 | { | 628 | { |
| 633 | int ret = 0; | 629 | int ret = 0; |
| 634 | 630 | ||
| 635 | if (is_trace_uprobe_enabled(tu)) | 631 | if (trace_probe_is_enabled(&tu->tp)) |
| 636 | return -EINTR; | 632 | return -EINTR; |
| 637 | 633 | ||
| 638 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); | 634 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); |
| 639 | 635 | ||
| 640 | tu->flags |= flag; | 636 | tu->tp.flags |= flag; |
| 641 | tu->consumer.filter = filter; | 637 | tu->consumer.filter = filter; |
| 642 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); | 638 | ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); |
| 643 | if (ret) | 639 | if (ret) |
| 644 | tu->flags &= ~flag; | 640 | tu->tp.flags &= ~flag; |
| 645 | 641 | ||
| 646 | return ret; | 642 | return ret; |
| 647 | } | 643 | } |
| 648 | 644 | ||
| 649 | static void probe_event_disable(struct trace_uprobe *tu, int flag) | 645 | static void probe_event_disable(struct trace_uprobe *tu, int flag) |
| 650 | { | 646 | { |
| 651 | if (!is_trace_uprobe_enabled(tu)) | 647 | if (!trace_probe_is_enabled(&tu->tp)) |
| 652 | return; | 648 | return; |
| 653 | 649 | ||
| 654 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); | 650 | WARN_ON(!uprobe_filter_is_empty(&tu->filter)); |
| 655 | 651 | ||
| 656 | uprobe_unregister(tu->inode, tu->offset, &tu->consumer); | 652 | uprobe_unregister(tu->inode, tu->offset, &tu->consumer); |
| 657 | tu->flags &= ~flag; | 653 | tu->tp.flags &= ~flag; |
| 658 | } | 654 | } |
| 659 | 655 | ||
| 660 | static int uprobe_event_define_fields(struct ftrace_event_call *event_call) | 656 | static int uprobe_event_define_fields(struct ftrace_event_call *event_call) |
| @@ -672,12 +668,12 @@ static int uprobe_event_define_fields(struct ftrace_event_call *event_call) | |||
| 672 | size = SIZEOF_TRACE_ENTRY(false); | 668 | size = SIZEOF_TRACE_ENTRY(false); |
| 673 | } | 669 | } |
| 674 | /* Set argument names as fields */ | 670 | /* Set argument names as fields */ |
| 675 | for (i = 0; i < tu->nr_args; i++) { | 671 | for (i = 0; i < tu->tp.nr_args; i++) { |
| 676 | ret = trace_define_field(event_call, tu->args[i].type->fmttype, | 672 | struct probe_arg *parg = &tu->tp.args[i]; |
| 677 | tu->args[i].name, | 673 | |
| 678 | size + tu->args[i].offset, | 674 | ret = trace_define_field(event_call, parg->type->fmttype, |
| 679 | tu->args[i].type->size, | 675 | parg->name, size + parg->offset, |
| 680 | tu->args[i].type->is_signed, | 676 | parg->type->size, parg->type->is_signed, |
| 681 | FILTER_OTHER); | 677 | FILTER_OTHER); |
| 682 | 678 | ||
| 683 | if (ret) | 679 | if (ret) |
| @@ -705,16 +701,16 @@ static int __set_print_fmt(struct trace_uprobe *tu, char *buf, int len) | |||
| 705 | 701 | ||
| 706 | pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt); | 702 | pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", fmt); |
| 707 | 703 | ||
| 708 | for (i = 0; i < tu->nr_args; i++) { | 704 | for (i = 0; i < tu->tp.nr_args; i++) { |
| 709 | pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%s", | 705 | pos += snprintf(buf + pos, LEN_OR_ZERO, " %s=%s", |
| 710 | tu->args[i].name, tu->args[i].type->fmt); | 706 | tu->tp.args[i].name, tu->tp.args[i].type->fmt); |
| 711 | } | 707 | } |
| 712 | 708 | ||
| 713 | pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg); | 709 | pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg); |
| 714 | 710 | ||
| 715 | for (i = 0; i < tu->nr_args; i++) { | 711 | for (i = 0; i < tu->tp.nr_args; i++) { |
| 716 | pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s", | 712 | pos += snprintf(buf + pos, LEN_OR_ZERO, ", REC->%s", |
| 717 | tu->args[i].name); | 713 | tu->tp.args[i].name); |
| 718 | } | 714 | } |
| 719 | 715 | ||
| 720 | return pos; /* return the length of print_fmt */ | 716 | return pos; /* return the length of print_fmt */ |
| @@ -734,7 +730,7 @@ static int set_print_fmt(struct trace_uprobe *tu) | |||
| 734 | 730 | ||
| 735 | /* Second: actually write the @print_fmt */ | 731 | /* Second: actually write the @print_fmt */ |
| 736 | __set_print_fmt(tu, print_fmt, len + 1); | 732 | __set_print_fmt(tu, print_fmt, len + 1); |
| 737 | tu->call.print_fmt = print_fmt; | 733 | tu->tp.call.print_fmt = print_fmt; |
| 738 | 734 | ||
| 739 | return 0; | 735 | return 0; |
| 740 | } | 736 | } |
| @@ -831,14 +827,14 @@ static bool uprobe_perf_filter(struct uprobe_consumer *uc, | |||
| 831 | static void uprobe_perf_print(struct trace_uprobe *tu, | 827 | static void uprobe_perf_print(struct trace_uprobe *tu, |
| 832 | unsigned long func, struct pt_regs *regs) | 828 | unsigned long func, struct pt_regs *regs) |
| 833 | { | 829 | { |
| 834 | struct ftrace_event_call *call = &tu->call; | 830 | struct ftrace_event_call *call = &tu->tp.call; |
| 835 | struct uprobe_trace_entry_head *entry; | 831 | struct uprobe_trace_entry_head *entry; |
| 836 | struct hlist_head *head; | 832 | struct hlist_head *head; |
| 837 | void *data; | 833 | void *data; |
| 838 | int size, rctx, i; | 834 | int size, rctx, i; |
| 839 | 835 | ||
| 840 | size = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); | 836 | size = SIZEOF_TRACE_ENTRY(is_ret_probe(tu)); |
| 841 | size = ALIGN(size + tu->size + sizeof(u32), sizeof(u64)) - sizeof(u32); | 837 | size = ALIGN(size + tu->tp.size + sizeof(u32), sizeof(u64)) - sizeof(u32); |
| 842 | 838 | ||
| 843 | preempt_disable(); | 839 | preempt_disable(); |
| 844 | head = this_cpu_ptr(call->perf_events); | 840 | head = this_cpu_ptr(call->perf_events); |
| @@ -858,8 +854,11 @@ static void uprobe_perf_print(struct trace_uprobe *tu, | |||
| 858 | data = DATAOF_TRACE_ENTRY(entry, false); | 854 | data = DATAOF_TRACE_ENTRY(entry, false); |
| 859 | } | 855 | } |
| 860 | 856 | ||
| 861 | for (i = 0; i < tu->nr_args; i++) | 857 | for (i = 0; i < tu->tp.nr_args; i++) { |
| 862 | call_fetch(&tu->args[i].fetch, regs, data + tu->args[i].offset); | 858 | struct probe_arg *parg = &tu->tp.args[i]; |
| 859 | |||
| 860 | call_fetch(&parg->fetch, regs, data + parg->offset); | ||
| 861 | } | ||
| 863 | 862 | ||
| 864 | perf_trace_buf_submit(entry, size, rctx, 0, 1, regs, head, NULL); | 863 | perf_trace_buf_submit(entry, size, rctx, 0, 1, regs, head, NULL); |
| 865 | out: | 864 | out: |
| @@ -926,11 +925,11 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs) | |||
| 926 | tu = container_of(con, struct trace_uprobe, consumer); | 925 | tu = container_of(con, struct trace_uprobe, consumer); |
| 927 | tu->nhit++; | 926 | tu->nhit++; |
| 928 | 927 | ||
| 929 | if (tu->flags & TP_FLAG_TRACE) | 928 | if (tu->tp.flags & TP_FLAG_TRACE) |
| 930 | ret |= uprobe_trace_func(tu, regs); | 929 | ret |= uprobe_trace_func(tu, regs); |
| 931 | 930 | ||
| 932 | #ifdef CONFIG_PERF_EVENTS | 931 | #ifdef CONFIG_PERF_EVENTS |
| 933 | if (tu->flags & TP_FLAG_PROFILE) | 932 | if (tu->tp.flags & TP_FLAG_PROFILE) |
| 934 | ret |= uprobe_perf_func(tu, regs); | 933 | ret |= uprobe_perf_func(tu, regs); |
| 935 | #endif | 934 | #endif |
| 936 | return ret; | 935 | return ret; |
| @@ -943,11 +942,11 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con, | |||
| 943 | 942 | ||
| 944 | tu = container_of(con, struct trace_uprobe, consumer); | 943 | tu = container_of(con, struct trace_uprobe, consumer); |
| 945 | 944 | ||
| 946 | if (tu->flags & TP_FLAG_TRACE) | 945 | if (tu->tp.flags & TP_FLAG_TRACE) |
| 947 | uretprobe_trace_func(tu, func, regs); | 946 | uretprobe_trace_func(tu, func, regs); |
| 948 | 947 | ||
| 949 | #ifdef CONFIG_PERF_EVENTS | 948 | #ifdef CONFIG_PERF_EVENTS |
| 950 | if (tu->flags & TP_FLAG_PROFILE) | 949 | if (tu->tp.flags & TP_FLAG_PROFILE) |
| 951 | uretprobe_perf_func(tu, func, regs); | 950 | uretprobe_perf_func(tu, func, regs); |
| 952 | #endif | 951 | #endif |
| 953 | return 0; | 952 | return 0; |
| @@ -959,7 +958,7 @@ static struct trace_event_functions uprobe_funcs = { | |||
| 959 | 958 | ||
| 960 | static int register_uprobe_event(struct trace_uprobe *tu) | 959 | static int register_uprobe_event(struct trace_uprobe *tu) |
| 961 | { | 960 | { |
| 962 | struct ftrace_event_call *call = &tu->call; | 961 | struct ftrace_event_call *call = &tu->tp.call; |
| 963 | int ret; | 962 | int ret; |
| 964 | 963 | ||
| 965 | /* Initialize ftrace_event_call */ | 964 | /* Initialize ftrace_event_call */ |
| @@ -994,11 +993,11 @@ static int unregister_uprobe_event(struct trace_uprobe *tu) | |||
| 994 | int ret; | 993 | int ret; |
| 995 | 994 | ||
| 996 | /* tu->event is unregistered in trace_remove_event_call() */ | 995 | /* tu->event is unregistered in trace_remove_event_call() */ |
| 997 | ret = trace_remove_event_call(&tu->call); | 996 | ret = trace_remove_event_call(&tu->tp.call); |
| 998 | if (ret) | 997 | if (ret) |
| 999 | return ret; | 998 | return ret; |
| 1000 | kfree(tu->call.print_fmt); | 999 | kfree(tu->tp.call.print_fmt); |
| 1001 | tu->call.print_fmt = NULL; | 1000 | tu->tp.call.print_fmt = NULL; |
| 1002 | return 0; | 1001 | return 0; |
| 1003 | } | 1002 | } |
| 1004 | 1003 | ||
