Tracing fixes for 5.15: - Fix defined but not use warning/error for osnoise function - Fix memory leak in event probe - Fix memblock leak in bootconfig - Fix the API of event probes to be like kprobes - Added test to check removal of event probe API - Fix recordmcount.pl for nds32 failed build * tag 'trace-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^' selftests/ftrace: Update test for more eprobe removal process tracing: Fix event probe removal from dynamic events tracing: Fix missing * in comment block bootconfig: init: Fix memblock leak in xbc_make_cmdline() tracing: Fix memory leak in eprobe_register() tracing: Fix missing osnoise tracer on max_latency
Unified · Split
| @@ -382,6 +382,7 @@ static char * __init xbc_make_cmdline(const char *key) · 381 unmodified lines | |||
| 382 | ret = xbc_snprint_cmdline(new_cmdline, len + 1, root); | 382 | ret = xbc_snprint_cmdline(new_cmdline, len + 1, root); |
| 383 | if (ret < 0 || ret > len) { | 383 | if (ret < 0 || ret > len) { |
| 384 | pr_err("Failed to print extra kernel cmdline.\n"); | 384 | pr_err("Failed to print extra kernel cmdline.\n"); |
| 385 | memblock_free_ptr(new_cmdline, len + 1); | ||
| 385 | return NULL; | 386 | return NULL; |
| 386 | } | 387 | } |
| 387 | 388 | ||
| @@ -1744,16 +1744,15 @@ void latency_fsnotify(struct trace_array *tr) · 1743 unmodified lines | |||
| 1744 | irq_work_queue(&tr->fsnotify_irqwork); | 1744 | irq_work_queue(&tr->fsnotify_irqwork); |
| 1745 | } | 1745 | } |
| 1746 | 1746 | ||
| 1747 | /* | 1747 | #elif defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) \ |
| 1748 | * (defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)) && \ | 1748 | || defined(CONFIG_OSNOISE_TRACER) |
| 1749 | * defined(CONFIG_FSNOTIFY) | ||
| 1750 | */ | ||
| 1751 | #else | ||
| 1752 | 1749 | ||
| 1753 | #define trace_create_maxlat_file(tr, d_tracer) \ | 1750 | #define trace_create_maxlat_file(tr, d_tracer) \ |
| 1754 | trace_create_file("tracing_max_latency", 0644, d_tracer, \ | 1751 | trace_create_file("tracing_max_latency", 0644, d_tracer, \ |
| 1755 | &tr->max_latency, &tracing_max_lat_fops) | 1752 | &tr->max_latency, &tracing_max_lat_fops) |
| 1756 | 1753 | ||
| 1754 | #else | ||
| 1755 | #define trace_create_maxlat_file(tr, d_tracer) do { } while (0) | ||
| 1757 | #endif | 1756 | #endif |
| 1758 | 1757 | ||
| 1759 | #ifdef CONFIG_TRACER_MAX_TRACE | 1758 | #ifdef CONFIG_TRACER_MAX_TRACE |
| @@ -9473,9 +9472,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer) · 7713 unmodified lines | |||
| 9473 | 9472 | ||
| 9474 | create_trace_options_dir(tr); | 9473 | create_trace_options_dir(tr); |
| 9475 | 9474 | ||
| 9476 | #if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER) | ||
| 9477 | trace_create_maxlat_file(tr, d_tracer); | 9475 | trace_create_maxlat_file(tr, d_tracer); |
| 9478 | #endif | ||
| 9479 | 9476 | ||
| 9480 | if (ftrace_create_function_files(tr, d_tracer)) | 9477 | if (ftrace_create_function_files(tr, d_tracer)) |
| 9481 | MEM_FAIL(1, "Could not allocate function filter files"); | 9478 | MEM_FAIL(1, "Could not allocate function filter files"); |
| @@ -119,10 +119,58 @@ static bool eprobe_dyn_event_match(const char *system, const char *event, · 118 unmodified lines | |||
| 119 | int argc, const char **argv, struct dyn_event *ev) | 119 | int argc, const char **argv, struct dyn_event *ev) |
| 120 | { | 120 | { |
| 121 | struct trace_eprobe *ep = to_trace_eprobe(ev); | 121 | struct trace_eprobe *ep = to_trace_eprobe(ev); |
| 122 | const char *slash; | ||
| 122 | 123 | ||
| 123 | return strcmp(trace_probe_name(&ep->tp), event) == 0 && | 124 | /* |
| 124 | (!system || strcmp(trace_probe_group_name(&ep->tp), system) == 0) && | 125 | * We match the following: |
| 125 | trace_probe_match_command_args(&ep->tp, argc, argv); | 126 | * event only - match all eprobes with event name |
| 127 | * system and event only - match all system/event probes | ||
| 128 | * | ||
| 129 | * The below has the above satisfied with more arguments: | ||
| 130 | * | ||
| 131 | * attached system/event - If the arg has the system and event | ||
| 132 | * the probe is attached to, match | ||
| 133 | * probes with the attachment. | ||
| 134 | * | ||
| 135 | * If any more args are given, then it requires a full match. | ||
| 136 | */ | ||
| 137 | |||
| 138 | /* | ||
| 139 | * If system exists, but this probe is not part of that system | ||
| 140 | * do not match. | ||
| 141 | */ | ||
| 142 | if (system && strcmp(trace_probe_group_name(&ep->tp), system) != 0) | ||
| 143 | return false; | ||
| 144 | |||
| 145 | /* Must match the event name */ | ||
| 146 | if (strcmp(trace_probe_name(&ep->tp), event) != 0) | ||
| 147 | return false; | ||
| 148 | |||
| 149 | /* No arguments match all */ | ||
| 150 | if (argc < 1) | ||
| 151 | return true; | ||
| 152 | |||
| 153 | /* First argument is the system/event the probe is attached to */ | ||
| 154 | |||
| 155 | slash = strchr(argv[0], '/'); | ||
| 156 | if (!slash) | ||
| 157 | slash = strchr(argv[0], '.'); | ||
| 158 | if (!slash) | ||
| 159 | return false; | ||
| 160 | |||
| 161 | if (strncmp(ep->event_system, argv[0], slash - argv[0])) | ||
| 162 | return false; | ||
| 163 | if (strcmp(ep->event_name, slash + 1)) | ||
| 164 | return false; | ||
| 165 | |||
| 166 | argc--; | ||
| 167 | argv++; | ||
| 168 | |||
| 169 | /* If there are no other args, then match */ | ||
| 170 | if (argc < 1) | ||
| 171 | return true; | ||
| 172 | |||
| 173 | return trace_probe_match_command_args(&ep->tp, argc, argv); | ||
| 126 | } | 174 | } |
| 127 | 175 | ||
| 128 | static struct dyn_event_operations eprobe_dyn_event_ops = { | 176 | static struct dyn_event_operations eprobe_dyn_event_ops = { |
| @@ -632,6 +680,13 @@ static int disable_eprobe(struct trace_eprobe *ep, · 503 unmodified lines | |||
| 632 | 680 | ||
| 633 | trace_event_trigger_enable_disable(file, 0); | 681 | trace_event_trigger_enable_disable(file, 0); |
| 634 | update_cond_flag(file); | 682 | update_cond_flag(file); |
| 683 | |||
| 684 | /* Make sure nothing is using the edata or trigger */ | ||
| 685 | tracepoint_synchronize_unregister(); | ||
| 686 | |||
| 687 | kfree(edata); | ||
| 688 | kfree(trigger); | ||
| 689 | |||
| 635 | return 0; | 690 | return 0; |
| 636 | } | 691 | } |
| 637 | 692 | ||
| @@ -2506,7 +2506,7 @@ find_synthetic_field_var(struct hist_trigger_data *target_hist_data, · 2505 unmodified lines | |||
| 2506 | * events. However, for convenience, users are allowed to directly | 2506 | * events. However, for convenience, users are allowed to directly |
| 2507 | * specify an event field in an action, which will be automatically | 2507 | * specify an event field in an action, which will be automatically |
| 2508 | * converted into a variable on their behalf. | 2508 | * converted into a variable on their behalf. |
| 2509 | 2509 | * | |
| 2510 | * If a user specifies a field on an event that isn't the event the | 2510 | * If a user specifies a field on an event that isn't the event the |
| 2511 | * histogram currently being defined (the target event histogram), the | 2511 | * histogram currently being defined (the target event histogram), the |
| 2512 | * only way that can be accomplished is if a new hist trigger is | 2512 | * only way that can be accomplished is if a new hist trigger is |
| @@ -189,7 +189,7 @@ if ($arch =~ /(x86(_64)?)|(i386)/) { · 188 unmodified lines | |||
| 189 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; | 189 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; |
| 190 | $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; | 190 | $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; |
| 191 | $section_regex = "Disassembly of section\\s+(\\S+):"; | 191 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
| 192 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 192 | $function_regex = "^([0-9a-fA-F]+)\\s+<([^^]*?)>:"; |
| 193 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; | 193 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; |
| 194 | $section_type = '@progbits'; | 194 | $section_type = '@progbits'; |
| 195 | $mcount_adjust = 0; | 195 | $mcount_adjust = 0; |
| @@ -11,8 +11,8 @@ SYSTEM="syscalls" · 10 unmodified lines | |||
| 11 | EVENT="sys_enter_openat" | 11 | EVENT="sys_enter_openat" |
| 12 | FIELD="filename" | 12 | FIELD="filename" |
| 13 | EPROBE="eprobe_open" | 13 | EPROBE="eprobe_open" |
| 14 | 14 | OPTIONS="file=+0(\$filename):ustring" | |
| 15 | echo "e:$EPROBE $SYSTEM/$EVENT file=+0(\$filename):ustring" >> dynamic_events | 15 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events |
| 16 | 16 | ||
| 17 | grep -q "$EPROBE" dynamic_events | 17 | grep -q "$EPROBE" dynamic_events |
| 18 | test -d events/eprobes/$EPROBE | 18 | test -d events/eprobes/$EPROBE |
| @@ -37,4 +37,54 @@ echo "-:$EPROBE" >> dynamic_events · 18 unmodified lines | |||
| 37 | ! grep -q "$EPROBE" dynamic_events | 37 | ! grep -q "$EPROBE" dynamic_events |
| 38 | ! test -d events/eprobes/$EPROBE | 38 | ! test -d events/eprobes/$EPROBE |
| 39 | 39 | ||
| 40 | # test various ways to remove the probe (already tested with just event name) | ||
| 41 | |||
| 42 | # With group name | ||
| 43 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 44 | grep -q "$EPROBE" dynamic_events | ||
| 45 | test -d events/eprobes/$EPROBE | ||
| 46 | echo "-:eprobes/$EPROBE" >> dynamic_events | ||
| 47 | ! grep -q "$EPROBE" dynamic_events | ||
| 48 | ! test -d events/eprobes/$EPROBE | ||
| 49 | |||
| 50 | # With group name and system/event | ||
| 51 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 52 | grep -q "$EPROBE" dynamic_events | ||
| 53 | test -d events/eprobes/$EPROBE | ||
| 54 | echo "-:eprobes/$EPROBE $SYSTEM/$EVENT" >> dynamic_events | ||
| 55 | ! grep -q "$EPROBE" dynamic_events | ||
| 56 | ! test -d events/eprobes/$EPROBE | ||
| 57 | |||
| 58 | # With just event name and system/event | ||
| 59 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 60 | grep -q "$EPROBE" dynamic_events | ||
| 61 | test -d events/eprobes/$EPROBE | ||
| 62 | echo "-:$EPROBE $SYSTEM/$EVENT" >> dynamic_events | ||
| 63 | ! grep -q "$EPROBE" dynamic_events | ||
| 64 | ! test -d events/eprobes/$EPROBE | ||
| 65 | |||
| 66 | # With just event name and system/event and options | ||
| 67 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 68 | grep -q "$EPROBE" dynamic_events | ||
| 69 | test -d events/eprobes/$EPROBE | ||
| 70 | echo "-:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 71 | ! grep -q "$EPROBE" dynamic_events | ||
| 72 | ! test -d events/eprobes/$EPROBE | ||
| 73 | |||
| 74 | # With group name and system/event and options | ||
| 75 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 76 | grep -q "$EPROBE" dynamic_events | ||
| 77 | test -d events/eprobes/$EPROBE | ||
| 78 | echo "-:eprobes/$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 79 | ! grep -q "$EPROBE" dynamic_events | ||
| 80 | ! test -d events/eprobes/$EPROBE | ||
| 81 | |||
| 82 | # Finally make sure what is in the dynamic_events file clears it too | ||
| 83 | echo "e:$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 84 | LINE=`sed -e '/$EPROBE/s/^e/-/' < dynamic_events` | ||
| 85 | test -d events/eprobes/$EPROBE | ||
| 86 | echo "-:eprobes/$EPROBE $SYSTEM/$EVENT $OPTIONS" >> dynamic_events | ||
| 87 | ! grep -q "$EPROBE" dynamic_events | ||
| 88 | ! test -d events/eprobes/$EPROBE | ||
| 89 | |||
| 40 | clear_trace | 90 | clear_trace |