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-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

- Fix filter memory leak by calling ftrace_free_filter()

- Initialize trace_printk() earlier so that ftrace_dump_on_oops shows
data on early crashes.

- Update the outdated instructions in scripts/tracing/ftrace-bisect.sh

- Add lockdep_is_held() to fix lockdep warning

- Add allocation failure check in create_hist_field()

- Don't initialize pointer that gets set right away in enabled_monitors_write()

- Update MAINTAINER entries

- Fix help messages in Kconfigs

- Fix kernel-doc header for update_preds()

* tag 'trace-v6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
bootconfig: Update MAINTAINERS file to add tree and mailing list
rv: remove redundant initialization of pointer ptr
ftrace: Maintain samples/ftrace
tracing/filter: fix kernel-doc warnings
lib: Kconfig: fix spellos
trace_events_hist: add check for return value of 'create_hist_field'
tracing/osnoise: Use built-in RCU list checking
tracing: Kconfig: Fix spelling/grammar/punctuation
ftrace/scripts: Update the instructions for ftrace-bisect.sh
tracing: Make sure trace_printk() can output as soon as it can be used
ftrace: Export ftrace_free_filter() to modules

+74 -25
+5
MAINTAINERS
··· 7893 7893 7894 7894 EXTRA BOOT CONFIG 7895 7895 M: Masami Hiramatsu <mhiramat@kernel.org> 7896 + L: linux-kernel@vger.kernel.org 7897 + L: linux-trace-kernel@vger.kernel.org 7898 + Q: https://patchwork.kernel.org/project/linux-trace-kernel/list/ 7896 7899 S: Maintained 7900 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git 7897 7901 F: Documentation/admin-guide/bootconfig.rst 7898 7902 F: fs/proc/bootconfig.c 7899 7903 F: include/linux/bootconfig.h ··· 8573 8569 F: arch/*/*/*/*ftrace* 8574 8570 F: arch/*/*/*ftrace* 8575 8571 F: include/*/ftrace.h 8572 + F: samples/ftrace 8576 8573 8577 8574 FUNGIBLE ETHERNET DRIVERS 8578 8575 M: Dimitris Michailidis <dmichail@fungible.com>
+4 -4
kernel/trace/Kconfig
··· 933 933 default y 934 934 help 935 935 The ring buffer has its own internal recursion. Although when 936 - recursion happens it wont cause harm because of the protection, 937 - but it does cause an unwanted overhead. Enabling this option will 936 + recursion happens it won't cause harm because of the protection, 937 + but it does cause unwanted overhead. Enabling this option will 938 938 place where recursion was detected into the ftrace "recursed_functions" 939 939 file. 940 940 ··· 1017 1017 The test runs for 10 seconds. This will slow your boot time 1018 1018 by at least 10 more seconds. 1019 1019 1020 - At the end of the test, statics and more checks are done. 1021 - It will output the stats of each per cpu buffer. What 1020 + At the end of the test, statistics and more checks are done. 1021 + It will output the stats of each per cpu buffer: What 1022 1022 was written, the sizes, what was read, what was lost, and 1023 1023 other similar details. 1024 1024
+22 -1
kernel/trace/ftrace.c
··· 1248 1248 call_rcu(&hash->rcu, __free_ftrace_hash_rcu); 1249 1249 } 1250 1250 1251 + /** 1252 + * ftrace_free_filter - remove all filters for an ftrace_ops 1253 + * @ops - the ops to remove the filters from 1254 + */ 1251 1255 void ftrace_free_filter(struct ftrace_ops *ops) 1252 1256 { 1253 1257 ftrace_ops_init(ops); 1254 1258 free_ftrace_hash(ops->func_hash->filter_hash); 1255 1259 free_ftrace_hash(ops->func_hash->notrace_hash); 1256 1260 } 1261 + EXPORT_SYMBOL_GPL(ftrace_free_filter); 1257 1262 1258 1263 static struct ftrace_hash *alloc_ftrace_hash(int size_bits) 1259 1264 { ··· 5844 5839 * 5845 5840 * Filters denote which functions should be enabled when tracing is enabled 5846 5841 * If @ip is NULL, it fails to update filter. 5842 + * 5843 + * This can allocate memory which must be freed before @ops can be freed, 5844 + * either by removing each filtered addr or by using 5845 + * ftrace_free_filter(@ops). 5847 5846 */ 5848 5847 int ftrace_set_filter_ip(struct ftrace_ops *ops, unsigned long ip, 5849 5848 int remove, int reset) ··· 5867 5858 * 5868 5859 * Filters denote which functions should be enabled when tracing is enabled 5869 5860 * If @ips array or any ip specified within is NULL , it fails to update filter. 5870 - */ 5861 + * 5862 + * This can allocate memory which must be freed before @ops can be freed, 5863 + * either by removing each filtered addr or by using 5864 + * ftrace_free_filter(@ops). 5865 + */ 5871 5866 int ftrace_set_filter_ips(struct ftrace_ops *ops, unsigned long *ips, 5872 5867 unsigned int cnt, int remove, int reset) 5873 5868 { ··· 5913 5900 * 5914 5901 * Filters denote which functions should be enabled when tracing is enabled. 5915 5902 * If @buf is NULL and reset is set, all functions will be enabled for tracing. 5903 + * 5904 + * This can allocate memory which must be freed before @ops can be freed, 5905 + * either by removing each filtered addr or by using 5906 + * ftrace_free_filter(@ops). 5916 5907 */ 5917 5908 int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, 5918 5909 int len, int reset) ··· 5936 5919 * Notrace Filters denote which functions should not be enabled when tracing 5937 5920 * is enabled. If @buf is NULL and reset is set, all functions will be enabled 5938 5921 * for tracing. 5922 + * 5923 + * This can allocate memory which must be freed before @ops can be freed, 5924 + * either by removing each filtered addr or by using 5925 + * ftrace_free_filter(@ops). 5939 5926 */ 5940 5927 int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, 5941 5928 int len, int reset)
+1 -1
kernel/trace/rv/rv.c
··· 516 516 struct rv_monitor_def *mdef; 517 517 int retval = -EINVAL; 518 518 bool enable = true; 519 - char *ptr = buff; 519 + char *ptr; 520 520 int len; 521 521 522 522 if (count < 1 || count > MAX_RV_MONITOR_NAME_SIZE + 1)
+2
kernel/trace/trace.c
··· 10295 10295 static_key_enable(&tracepoint_printk_key.key); 10296 10296 } 10297 10297 tracer_alloc_buffers(); 10298 + 10299 + init_events(); 10298 10300 } 10299 10301 10300 10302 void __init trace_init(void)
+1
kernel/trace/trace.h
··· 1490 1490 extern void trace_event_enable_tgid_record(bool enable); 1491 1491 1492 1492 extern int event_trace_init(void); 1493 + extern int init_events(void); 1493 1494 extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr); 1494 1495 extern int event_trace_del_tracer(struct trace_array *tr); 1495 1496 extern void __trace_early_add_events(struct trace_array *tr);
+4 -4
kernel/trace/trace_events_filter.c
··· 128 128 } 129 129 130 130 /** 131 - * prog_entry - a singe entry in the filter program 131 + * struct prog_entry - a singe entry in the filter program 132 132 * @target: Index to jump to on a branch (actually one minus the index) 133 133 * @when_to_branch: The value of the result of the predicate to do a branch 134 134 * @pred: The predicate to execute. ··· 140 140 }; 141 141 142 142 /** 143 - * update_preds- assign a program entry a label target 143 + * update_preds - assign a program entry a label target 144 144 * @prog: The program array 145 145 * @N: The index of the current entry in @prog 146 - * @when_to_branch: What to assign a program entry for its branch condition 146 + * @invert: What to assign a program entry for its branch condition 147 147 * 148 148 * The program entry at @N has a target that points to the index of a program 149 149 * entry that can have its target and when_to_branch fields updated. 150 150 * Update the current program entry denoted by index @N target field to be 151 151 * that of the updated entry. This will denote the entry to update if 152 - * we are processing an "||" after an "&&" 152 + * we are processing an "||" after an "&&". 153 153 */ 154 154 static void update_preds(struct prog_entry *prog, int N, int invert) 155 155 {
+2
kernel/trace/trace_events_hist.c
··· 1988 1988 hist_field->fn_num = flags & HIST_FIELD_FL_LOG2 ? HIST_FIELD_FN_LOG2 : 1989 1989 HIST_FIELD_FN_BUCKET; 1990 1990 hist_field->operands[0] = create_hist_field(hist_data, field, fl, NULL); 1991 + if (!hist_field->operands[0]) 1992 + goto free; 1991 1993 hist_field->size = hist_field->operands[0]->size; 1992 1994 hist_field->type = kstrdup_const(hist_field->operands[0]->type, GFP_KERNEL); 1993 1995 if (!hist_field->type)
+2 -3
kernel/trace/trace_osnoise.c
··· 147 147 * register/unregister serialization is provided by trace's 148 148 * trace_types_lock. 149 149 */ 150 - lockdep_assert_held(&trace_types_lock); 151 - 152 - list_for_each_entry_rcu(inst, &osnoise_instances, list) { 150 + list_for_each_entry_rcu(inst, &osnoise_instances, list, 151 + lockdep_is_held(&trace_types_lock)) { 153 152 if (inst->tr == tr) { 154 153 list_del_rcu(&inst->list); 155 154 found = 1;
+1 -2
kernel/trace/trace_output.c
··· 1535 1535 NULL 1536 1536 }; 1537 1537 1538 - __init static int init_events(void) 1538 + __init int init_events(void) 1539 1539 { 1540 1540 struct trace_event *event; 1541 1541 int i, ret; ··· 1548 1548 1549 1549 return 0; 1550 1550 } 1551 - early_initcall(init_events);
+1 -1
lib/Kconfig.debug
··· 1917 1917 help 1918 1918 Add fault injections into various functions that are annotated with 1919 1919 ALLOW_ERROR_INJECTION() in the kernel. BPF may also modify the return 1920 - value of theses functions. This is useful to test error paths of code. 1920 + value of these functions. This is useful to test error paths of code. 1921 1921 1922 1922 If unsure, say N 1923 1923
+1 -1
lib/Kconfig.kcsan
··· 194 194 Enable support for modeling a subset of weak memory, which allows 195 195 detecting a subset of data races due to missing memory barriers. 196 196 197 - Depends on KCSAN_STRICT, because the options strenghtening certain 197 + Depends on KCSAN_STRICT, because the options strengthening certain 198 198 plain accesses by default (depending on !KCSAN_STRICT) reduce the 199 199 ability to detect any data races invoving reordered accesses, in 200 200 particular reordered writes.
+1
samples/ftrace/ftrace-direct-multi-modify.c
··· 152 152 { 153 153 kthread_stop(simple_tsk); 154 154 unregister_ftrace_direct_multi(&direct, my_tramp); 155 + ftrace_free_filter(&direct); 155 156 } 156 157 157 158 module_init(ftrace_direct_multi_init);
+1
samples/ftrace/ftrace-direct-multi.c
··· 79 79 static void __exit ftrace_direct_multi_exit(void) 80 80 { 81 81 unregister_ftrace_direct_multi(&direct, (unsigned long) my_tramp); 82 + ftrace_free_filter(&direct); 82 83 } 83 84 84 85 module_init(ftrace_direct_multi_init);
+26 -8
scripts/tracing/ftrace-bisect.sh
··· 12 12 # (note, if this is a problem with function_graph tracing, then simply 13 13 # replace "function" with "function_graph" in the following steps). 14 14 # 15 - # # cd /sys/kernel/debug/tracing 15 + # # cd /sys/kernel/tracing 16 16 # # echo schedule > set_ftrace_filter 17 17 # # echo function > current_tracer 18 18 # ··· 20 20 # 21 21 # # echo nop > current_tracer 22 22 # 23 - # # cat available_filter_functions > ~/full-file 23 + # Starting with v5.1 this can be done with numbers, making it much faster: 24 + # 25 + # The old (slow) way, for kernels before v5.1. 26 + # 27 + # [old-way] # cat available_filter_functions > ~/full-file 28 + # 29 + # [old-way] *** Note *** this process will take several minutes to update the 30 + # [old-way] filters. Setting multiple functions is an O(n^2) operation, and we 31 + # [old-way] are dealing with thousands of functions. So go have coffee, talk 32 + # [old-way] with your coworkers, read facebook. And eventually, this operation 33 + # [old-way] will end. 34 + # 35 + # The new way (using numbers) is an O(n) operation, and usually takes less than a second. 36 + # 37 + # seq `wc -l available_filter_functions | cut -d' ' -f1` > ~/full-file 38 + # 39 + # This will create a sequence of numbers that match the functions in 40 + # available_filter_functions, and when echoing in a number into the 41 + # set_ftrace_filter file, it will enable the corresponding function in 42 + # O(1) time. Making enabling all functions O(n) where n is the number of 43 + # functions to enable. 44 + # 45 + # For either the new or old way, the rest of the operations remain the same. 46 + # 24 47 # # ftrace-bisect ~/full-file ~/test-file ~/non-test-file 25 48 # # cat ~/test-file > set_ftrace_filter 26 - # 27 - # *** Note *** this will take several minutes. Setting multiple functions is 28 - # an O(n^2) operation, and we are dealing with thousands of functions. So go 29 - # have coffee, talk with your coworkers, read facebook. And eventually, this 30 - # operation will end. 31 49 # 32 50 # # echo function > current_tracer 33 51 # ··· 53 35 # 54 36 # Reboot back to test kernel. 55 37 # 56 - # # cd /sys/kernel/debug/tracing 38 + # # cd /sys/kernel/tracing 57 39 # # mv ~/test-file ~/full-file 58 40 # 59 41 # If it didn't crash.