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

Pull tracing fixes from Steven Rostedt:

- Swapping the ring buffer for snapshotting (for things like irqsoff)
can crash if the ring buffer is being resized. Disable swapping when
this happens. The missed swap will be reported to the tracer

- Report error if the histogram fails to be created due to an error in
adding a histogram variable, in event_hist_trigger_parse()

- Remove unused declaration of tracing_map_set_field_descr()

* tag 'trace-v6.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tracing/histograms: Return an error if we fail to add histogram to hist_vars list
ring-buffer: Do not swap cpu_buffer during resize process
tracing: Remove unused extern declaration tracing_map_set_field_descr()

+17 -7
+13 -1
kernel/trace/ring_buffer.c
··· 536 unsigned flags; 537 int cpus; 538 atomic_t record_disabled; 539 cpumask_var_t cpumask; 540 541 struct lock_class_key *reader_lock_key; ··· 2168 2169 /* prevent another thread from changing buffer sizes */ 2170 mutex_lock(&buffer->mutex); 2171 - 2172 2173 if (cpu_id == RING_BUFFER_ALL_CPUS) { 2174 /* ··· 2323 atomic_dec(&buffer->record_disabled); 2324 } 2325 2326 mutex_unlock(&buffer->mutex); 2327 return 0; 2328 ··· 2344 } 2345 } 2346 out_err_unlock: 2347 mutex_unlock(&buffer->mutex); 2348 return err; 2349 } ··· 5542 if (local_read(&cpu_buffer_a->committing)) 5543 goto out_dec; 5544 if (local_read(&cpu_buffer_b->committing)) 5545 goto out_dec; 5546 5547 buffer_a->buffers[cpu] = cpu_buffer_b;
··· 536 unsigned flags; 537 int cpus; 538 atomic_t record_disabled; 539 + atomic_t resizing; 540 cpumask_var_t cpumask; 541 542 struct lock_class_key *reader_lock_key; ··· 2167 2168 /* prevent another thread from changing buffer sizes */ 2169 mutex_lock(&buffer->mutex); 2170 + atomic_inc(&buffer->resizing); 2171 2172 if (cpu_id == RING_BUFFER_ALL_CPUS) { 2173 /* ··· 2322 atomic_dec(&buffer->record_disabled); 2323 } 2324 2325 + atomic_dec(&buffer->resizing); 2326 mutex_unlock(&buffer->mutex); 2327 return 0; 2328 ··· 2342 } 2343 } 2344 out_err_unlock: 2345 + atomic_dec(&buffer->resizing); 2346 mutex_unlock(&buffer->mutex); 2347 return err; 2348 } ··· 5539 if (local_read(&cpu_buffer_a->committing)) 5540 goto out_dec; 5541 if (local_read(&cpu_buffer_b->committing)) 5542 + goto out_dec; 5543 + 5544 + /* 5545 + * When resize is in progress, we cannot swap it because 5546 + * it will mess the state of the cpu buffer. 5547 + */ 5548 + if (atomic_read(&buffer_a->resizing)) 5549 + goto out_dec; 5550 + if (atomic_read(&buffer_b->resizing)) 5551 goto out_dec; 5552 5553 buffer_a->buffers[cpu] = cpu_buffer_b;
+2 -1
kernel/trace/trace.c
··· 1928 * place on this CPU. We fail to record, but we reset 1929 * the max trace buffer (no one writes directly to it) 1930 * and flag that it failed. 1931 */ 1932 trace_array_printk_buf(tr->max_buffer.buffer, _THIS_IP_, 1933 - "Failed to swap buffers due to commit in progress\n"); 1934 } 1935 1936 WARN_ON_ONCE(ret && ret != -EAGAIN && ret != -EBUSY);
··· 1928 * place on this CPU. We fail to record, but we reset 1929 * the max trace buffer (no one writes directly to it) 1930 * and flag that it failed. 1931 + * Another reason is resize is in progress. 1932 */ 1933 trace_array_printk_buf(tr->max_buffer.buffer, _THIS_IP_, 1934 + "Failed to swap buffers due to commit or resize in progress\n"); 1935 } 1936 1937 WARN_ON_ONCE(ret && ret != -EAGAIN && ret != -EBUSY);
+2 -1
kernel/trace/trace_events_hist.c
··· 6668 goto out_unreg; 6669 6670 if (has_hist_vars(hist_data) || hist_data->n_var_refs) { 6671 - if (save_hist_vars(hist_data)) 6672 goto out_unreg; 6673 } 6674
··· 6668 goto out_unreg; 6669 6670 if (has_hist_vars(hist_data) || hist_data->n_var_refs) { 6671 + ret = save_hist_vars(hist_data); 6672 + if (ret) 6673 goto out_unreg; 6674 } 6675
-4
kernel/trace/tracing_map.h
··· 272 extern u64 tracing_map_read_var(struct tracing_map_elt *elt, unsigned int i); 273 extern u64 tracing_map_read_var_once(struct tracing_map_elt *elt, unsigned int i); 274 275 - extern void tracing_map_set_field_descr(struct tracing_map *map, 276 - unsigned int i, 277 - unsigned int key_offset, 278 - tracing_map_cmp_fn_t cmp_fn); 279 extern int 280 tracing_map_sort_entries(struct tracing_map *map, 281 struct tracing_map_sort_key *sort_keys,
··· 272 extern u64 tracing_map_read_var(struct tracing_map_elt *elt, unsigned int i); 273 extern u64 tracing_map_read_var_once(struct tracing_map_elt *elt, unsigned int i); 274 275 extern int 276 tracing_map_sort_entries(struct tracing_map *map, 277 struct tracing_map_sort_key *sort_keys,