Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:

- Fix memory leak on error path of process_system_preds()

- Lock inversion fix with updating tgid recording option

- Fix histogram compare function on big endian machines

- Fix histogram trigger function on big endian machines

- Make trace_printk() irq sync on init for kprobe selftest correctness

* tag 'trace-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Fix endianness bug in histogram trigger
samples/trace_printk: Wait for IRQ work to finish
tracing: Fix lock inversion in trace_event_enable_tgid_record()
tracing: Have the histogram compare functions convert to u64 first
tracing: Avoid memory leak in process_system_preds()

+36 -8
+8
kernel/trace/trace.c
··· 4685 4685 4686 4686 int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) 4687 4687 { 4688 + if ((mask == TRACE_ITER_RECORD_TGID) || 4689 + (mask == TRACE_ITER_RECORD_CMD)) 4690 + lockdep_assert_held(&event_mutex); 4691 + 4688 4692 /* do nothing if flag is already set */ 4689 4693 if (!!(tr->trace_flags & mask) == !!enabled) 4690 4694 return 0; ··· 4756 4752 4757 4753 cmp += len; 4758 4754 4755 + mutex_lock(&event_mutex); 4759 4756 mutex_lock(&trace_types_lock); 4760 4757 4761 4758 ret = match_string(trace_options, -1, cmp); ··· 4767 4762 ret = set_tracer_flag(tr, 1 << ret, !neg); 4768 4763 4769 4764 mutex_unlock(&trace_types_lock); 4765 + mutex_unlock(&event_mutex); 4770 4766 4771 4767 /* 4772 4768 * If the first trailing whitespace is replaced with '\0' by strstrip, ··· 8082 8076 if (val != 0 && val != 1) 8083 8077 return -EINVAL; 8084 8078 8079 + mutex_lock(&event_mutex); 8085 8080 mutex_lock(&trace_types_lock); 8086 8081 ret = set_tracer_flag(tr, 1 << index, val); 8087 8082 mutex_unlock(&trace_types_lock); 8083 + mutex_unlock(&event_mutex); 8088 8084 8089 8085 if (ret < 0) 8090 8086 return ret;
+4 -4
kernel/trace/trace_events.c
··· 320 320 struct trace_event_file *file; 321 321 struct trace_array *tr; 322 322 323 - mutex_lock(&event_mutex); 323 + lockdep_assert_held(&event_mutex); 324 + 324 325 do_for_each_event_file(tr, file) { 325 326 326 327 if (!(file->flags & EVENT_FILE_FL_ENABLED)) ··· 335 334 clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); 336 335 } 337 336 } while_for_each_event_file(); 338 - mutex_unlock(&event_mutex); 339 337 } 340 338 341 339 void trace_event_enable_tgid_record(bool enable) ··· 342 342 struct trace_event_file *file; 343 343 struct trace_array *tr; 344 344 345 - mutex_lock(&event_mutex); 345 + lockdep_assert_held(&event_mutex); 346 + 346 347 do_for_each_event_file(tr, file) { 347 348 if (!(file->flags & EVENT_FILE_FL_ENABLED)) 348 349 continue; ··· 357 356 &file->flags); 358 357 } 359 358 } while_for_each_event_file(); 360 - mutex_unlock(&event_mutex); 361 359 } 362 360 363 361 static int __ftrace_event_enable_disable(struct trace_event_file *file,
+1 -1
kernel/trace/trace_events_filter.c
··· 1662 1662 parse_error(pe, FILT_ERR_BAD_SUBSYS_FILTER, 0); 1663 1663 return -EINVAL; 1664 1664 fail_mem: 1665 - kfree(filter); 1665 + __free_filter(filter); 1666 1666 /* If any call succeeded, we still need to sync */ 1667 1667 if (!fail) 1668 1668 tracepoint_synchronize_unregister();
+20 -1
kernel/trace/trace_events_hist.c
··· 911 911 strscpy(str_field, str_val, STR_VAR_LEN_MAX); 912 912 n_u64 += STR_VAR_LEN_MAX / sizeof(u64); 913 913 } else { 914 - entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; 914 + struct synth_field *field = event->fields[i]; 915 + u64 val = var_ref_vals[var_ref_idx + i]; 916 + 917 + switch (field->size) { 918 + case 1: 919 + *(u8 *)&entry->fields[n_u64] = (u8)val; 920 + break; 921 + 922 + case 2: 923 + *(u16 *)&entry->fields[n_u64] = (u16)val; 924 + break; 925 + 926 + case 4: 927 + *(u32 *)&entry->fields[n_u64] = (u32)val; 928 + break; 929 + 930 + default: 931 + entry->fields[n_u64] = val; 932 + break; 933 + } 915 934 n_u64++; 916 935 } 917 936 }
+2 -2
kernel/trace/tracing_map.c
··· 148 148 #define DEFINE_TRACING_MAP_CMP_FN(type) \ 149 149 static int tracing_map_cmp_##type(void *val_a, void *val_b) \ 150 150 { \ 151 - type a = *(type *)val_a; \ 152 - type b = *(type *)val_b; \ 151 + type a = (type)(*(u64 *)val_a); \ 152 + type b = (type)(*(u64 *)val_b); \ 153 153 \ 154 154 return (a > b) ? 1 : ((a < b) ? -1 : 0); \ 155 155 }
+1
samples/trace_printk/trace-printk.c
··· 36 36 37 37 /* Kick off printing in irq context */ 38 38 irq_work_queue(&irqwork); 39 + irq_work_sync(&irqwork); 39 40 40 41 trace_printk("This is a %s that will use trace_bprintk()\n", 41 42 "static string");