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

Pull more tracing updates from Steven Rostedt:
"Tracing fixes and clean ups:

- Replace strlcpy() with strscpy()

- Initialize the pipe cpumask to zero on allocation

- Use within_module() instead of open coding it

- Remove extra space in hwlat_detectory/mode output

- Use LIST_HEAD() instead of open coding it

- A bunch of clean ups and fixes for the cpumask filter

- Set local da_mon_##name to static

- Fix race in snapshot buffer between cpu write and swap"

* tag 'trace-v6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tracing/filters: Fix coding style issues
tracing/filters: Change parse_pred() cpulist ternary into an if block
tracing/filters: Fix double-free of struct filter_pred.mask
tracing/filters: Fix error-handling of cpulist parsing buffer
tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY
ftrace: Use LIST_HEAD to initialize clear_hash
ftrace: Use within_module to check rec->ip within specified module.
tracing: Replace strlcpy with strscpy in trace/events/task.h
tracing: Fix race issue between cpu buffer write and swap
tracing: Remove extra space at the end of hwlat_detector/mode
rv: Set variable 'da_mon_##name' to static

+41 -25
+1 -1
include/rv/da_monitor.h
··· 262 262 /* \ 263 263 * per-cpu monitor variables \ 264 264 */ \ 265 - DEFINE_PER_CPU(struct da_monitor, da_mon_##name); \ 265 + static DEFINE_PER_CPU(struct da_monitor, da_mon_##name); \ 266 266 \ 267 267 /* \ 268 268 * da_get_monitor_##name - return current CPU monitor address \
+1 -1
include/trace/events/task.h
··· 47 47 TP_fast_assign( 48 48 __entry->pid = task->pid; 49 49 memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN); 50 - strlcpy(entry->newcomm, comm, TASK_COMM_LEN); 50 + strscpy(entry->newcomm, comm, TASK_COMM_LEN); 51 51 __entry->oom_score_adj = task->signal->oom_score_adj; 52 52 ), 53 53
+3 -7
kernel/trace/ftrace.c
··· 6779 6779 last_pg = &ftrace_pages_start; 6780 6780 for (pg = ftrace_pages_start; pg; pg = *last_pg) { 6781 6781 rec = &pg->records[0]; 6782 - if (within_module_core(rec->ip, mod) || 6783 - within_module_init(rec->ip, mod)) { 6782 + if (within_module(rec->ip, mod)) { 6784 6783 /* 6785 6784 * As core pages are first, the first 6786 6785 * page should never be a module page. ··· 6851 6852 * not part of this module, then skip this pg, 6852 6853 * which the "break" will do. 6853 6854 */ 6854 - if (!within_module_core(rec->ip, mod) && 6855 - !within_module_init(rec->ip, mod)) 6855 + if (!within_module(rec->ip, mod)) 6856 6856 break; 6857 6857 6858 6858 /* Weak functions should still be ignored */ ··· 7140 7142 struct dyn_ftrace key; 7141 7143 struct ftrace_mod_map *mod_map = NULL; 7142 7144 struct ftrace_init_func *func, *func_next; 7143 - struct list_head clear_hash; 7144 - 7145 - INIT_LIST_HEAD(&clear_hash); 7145 + LIST_HEAD(clear_hash); 7146 7146 7147 7147 key.ip = start; 7148 7148 key.flags = end; /* overload flags, as it is unsigned long */
+14 -7
kernel/trace/trace.c
··· 7599 7599 return ret; 7600 7600 } 7601 7601 7602 + static void tracing_swap_cpu_buffer(void *tr) 7603 + { 7604 + update_max_tr_single((struct trace_array *)tr, current, smp_processor_id()); 7605 + } 7606 + 7602 7607 static ssize_t 7603 7608 tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, 7604 7609 loff_t *ppos) ··· 7662 7657 ret = tracing_alloc_snapshot_instance(tr); 7663 7658 if (ret < 0) 7664 7659 break; 7665 - local_irq_disable(); 7666 7660 /* Now, we're going to swap */ 7667 - if (iter->cpu_file == RING_BUFFER_ALL_CPUS) 7661 + if (iter->cpu_file == RING_BUFFER_ALL_CPUS) { 7662 + local_irq_disable(); 7668 7663 update_max_tr(tr, current, smp_processor_id(), NULL); 7669 - else 7670 - update_max_tr_single(tr, current, iter->cpu_file); 7671 - local_irq_enable(); 7664 + local_irq_enable(); 7665 + } else { 7666 + smp_call_function_single(iter->cpu_file, tracing_swap_cpu_buffer, 7667 + (void *)tr, 1); 7668 + } 7672 7669 break; 7673 7670 default: 7674 7671 if (tr->allocated_snapshot) { ··· 9474 9467 if (!alloc_cpumask_var(&tr->tracing_cpumask, GFP_KERNEL)) 9475 9468 goto out_free_tr; 9476 9469 9477 - if (!alloc_cpumask_var(&tr->pipe_cpumask, GFP_KERNEL)) 9470 + if (!zalloc_cpumask_var(&tr->pipe_cpumask, GFP_KERNEL)) 9478 9471 goto out_free_tr; 9479 9472 9480 9473 tr->trace_flags = global_trace.trace_flags & ~ZEROED_TRACE_FLAGS; ··· 10419 10412 if (trace_create_savedcmd() < 0) 10420 10413 goto out_free_temp_buffer; 10421 10414 10422 - if (!alloc_cpumask_var(&global_trace.pipe_cpumask, GFP_KERNEL)) 10415 + if (!zalloc_cpumask_var(&global_trace.pipe_cpumask, GFP_KERNEL)) 10423 10416 goto out_free_savedcmd; 10424 10417 10425 10418 /* TODO: make the number of buffers hot pluggable with CPUS */
+21 -8
kernel/trace/trace_events_filter.c
··· 1360 1360 return FILTER_DYN_STRING; 1361 1361 if (strstr(type, "cpumask_t")) 1362 1362 return FILTER_CPUMASK; 1363 - } 1363 + } 1364 1364 1365 1365 if (strstr(type, "__rel_loc") && strstr(type, "char")) 1366 1366 return FILTER_RDYN_STRING; ··· 1731 1731 maskstart = i; 1732 1732 1733 1733 /* Walk the cpulist until closing } */ 1734 - for (; str[i] && str[i] != '}'; i++); 1734 + for (; str[i] && str[i] != '}'; i++) 1735 + ; 1736 + 1735 1737 if (str[i] != '}') { 1736 1738 parse_error(pe, FILT_ERR_MISSING_BRACE_CLOSE, pos + i); 1737 1739 goto err_free; ··· 1746 1744 1747 1745 /* Copy the cpulist between { and } */ 1748 1746 tmp = kmalloc((i - maskstart) + 1, GFP_KERNEL); 1749 - strscpy(tmp, str + maskstart, (i - maskstart) + 1); 1750 - 1751 - pred->mask = kzalloc(cpumask_size(), GFP_KERNEL); 1752 - if (!pred->mask) 1747 + if (!tmp) 1753 1748 goto err_mem; 1749 + 1750 + strscpy(tmp, str + maskstart, (i - maskstart) + 1); 1751 + pred->mask = kzalloc(cpumask_size(), GFP_KERNEL); 1752 + if (!pred->mask) { 1753 + kfree(tmp); 1754 + goto err_mem; 1755 + } 1754 1756 1755 1757 /* Now parse it */ 1756 1758 if (cpulist_parse(tmp, pred->mask)) { 1759 + kfree(tmp); 1757 1760 parse_error(pe, FILT_ERR_INVALID_CPULIST, pos + i); 1758 1761 goto err_free; 1759 1762 } 1763 + kfree(tmp); 1760 1764 1761 1765 /* Move along */ 1762 1766 i++; ··· 1775 1767 if (single) { 1776 1768 pred->val = cpumask_first(pred->mask); 1777 1769 kfree(pred->mask); 1770 + pred->mask = NULL; 1778 1771 } 1779 1772 1780 1773 if (field->filter_type == FILTER_CPUMASK) { ··· 1784 1775 FILTER_PRED_FN_CPUMASK; 1785 1776 } else if (field->filter_type == FILTER_CPU) { 1786 1777 if (single) { 1787 - pred->op = pred->op == OP_BAND ? OP_EQ : pred->op; 1778 + if (pred->op == OP_BAND) 1779 + pred->op = OP_EQ; 1780 + 1788 1781 pred->fn_num = FILTER_PRED_FN_CPU; 1789 1782 } else { 1790 1783 pred->fn_num = FILTER_PRED_FN_CPU_CPUMASK; 1791 1784 } 1792 1785 } else if (single) { 1793 - pred->op = pred->op == OP_BAND ? OP_EQ : pred->op; 1786 + if (pred->op == OP_BAND) 1787 + pred->op = OP_EQ; 1788 + 1794 1789 pred->fn_num = select_comparison_fn(pred->op, field->size, false); 1795 1790 if (pred->op == OP_NE) 1796 1791 pred->not = 1;
+1 -1
kernel/trace/trace_hwlat.c
··· 635 635 else 636 636 seq_printf(s, "%s", thread_mode_str[mode]); 637 637 638 - if (mode != MODE_MAX) 638 + if (mode < MODE_MAX - 1) /* if mode is any but last */ 639 639 seq_puts(s, " "); 640 640 641 641 return 0;