Skip to content

Commit b88e123

Browse files
committed
Merge tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fixes from Steven Rostedt: - Fix to /sys/kernel/tracing/per_cpu/cpu*/stats read and entries. If a resize shrinks the buffer it clears the read count to notify readers that they need to reset. But the read count is also used for accounting and this causes the numbers to be off. Instead, create a separate variable to use to notify readers to reset. - Fix the ref counts of the "soft disable" mode. The wrong value was used for testing if soft disable mode should be enabled or disable, but instead, just change the logic to do the enable and disable in place when the SOFT_MODE is set or cleared. - Several kernel-doc fixes - Removal of unused external declarations * tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: tracing: Fix warning in trace_buffered_event_disable() ftrace: Remove unused extern declarations tracing: Fix kernel-doc warnings in trace_seq.c tracing: Fix kernel-doc warnings in trace_events_trigger.c tracing/synthetic: Fix kernel-doc warnings in trace_events_synth.c ring-buffer: Fix kernel-doc warnings in ring_buffer.c ring-buffer: Fix wrong stat of cpu_buffer->read
2 parents 1f2190d + dea4997 commit b88e123

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

include/linux/ftrace.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ void __init
684684
ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
685685

686686
/* defined in arch */
687-
extern int ftrace_ip_converted(unsigned long ip);
688687
extern int ftrace_dyn_arch_init(void);
689688
extern void ftrace_replace_code(int enable);
690689
extern int ftrace_update_ftrace_func(ftrace_func_t func);
@@ -859,9 +858,6 @@ static inline int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_a
859858
}
860859
#endif
861860

862-
/* May be defined in arch */
863-
extern int ftrace_arch_read_dyn_info(char *buf, int size);
864-
865861
extern int skip_trace(unsigned long ip);
866862
extern void ftrace_module_init(struct module *mod);
867863
extern void ftrace_module_enable(struct module *mod);

kernel/trace/ring_buffer.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,8 @@ struct ring_buffer_per_cpu {
523523
rb_time_t before_stamp;
524524
u64 event_stamp[MAX_NEST];
525525
u64 read_stamp;
526+
/* pages removed since last reset */
527+
unsigned long pages_removed;
526528
/* ring buffer pages to update, > 0 to add, < 0 to remove */
527529
long nr_pages_to_update;
528530
struct list_head new_pages; /* new pages to add */
@@ -559,6 +561,7 @@ struct ring_buffer_iter {
559561
struct buffer_page *head_page;
560562
struct buffer_page *cache_reader_page;
561563
unsigned long cache_read;
564+
unsigned long cache_pages_removed;
562565
u64 read_stamp;
563566
u64 page_stamp;
564567
struct ring_buffer_event *event;
@@ -947,6 +950,7 @@ static void rb_wake_up_waiters(struct irq_work *work)
947950
/**
948951
* ring_buffer_wake_waiters - wake up any waiters on this ring buffer
949952
* @buffer: The ring buffer to wake waiters on
953+
* @cpu: The CPU buffer to wake waiters on
950954
*
951955
* In the case of a file that represents a ring buffer is closing,
952956
* it is prudent to wake up any waiters that are on this.
@@ -1957,6 +1961,8 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
19571961
to_remove = rb_list_head(to_remove)->next;
19581962
head_bit |= (unsigned long)to_remove & RB_PAGE_HEAD;
19591963
}
1964+
/* Read iterators need to reset themselves when some pages removed */
1965+
cpu_buffer->pages_removed += nr_removed;
19601966

19611967
next_page = rb_list_head(to_remove)->next;
19621968

@@ -1978,12 +1984,6 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
19781984
cpu_buffer->head_page = list_entry(next_page,
19791985
struct buffer_page, list);
19801986

1981-
/*
1982-
* change read pointer to make sure any read iterators reset
1983-
* themselves
1984-
*/
1985-
cpu_buffer->read = 0;
1986-
19871987
/* pages are removed, resume tracing and then free the pages */
19881988
atomic_dec(&cpu_buffer->record_disabled);
19891989
raw_spin_unlock_irq(&cpu_buffer->reader_lock);
@@ -3376,7 +3376,6 @@ void ring_buffer_nest_end(struct trace_buffer *buffer)
33763376
/**
33773377
* ring_buffer_unlock_commit - commit a reserved
33783378
* @buffer: The buffer to commit to
3379-
* @event: The event pointer to commit.
33803379
*
33813380
* This commits the data to the ring buffer, and releases any locks held.
33823381
*
@@ -4395,6 +4394,7 @@ static void rb_iter_reset(struct ring_buffer_iter *iter)
43954394

43964395
iter->cache_reader_page = iter->head_page;
43974396
iter->cache_read = cpu_buffer->read;
4397+
iter->cache_pages_removed = cpu_buffer->pages_removed;
43984398

43994399
if (iter->head) {
44004400
iter->read_stamp = cpu_buffer->read_stamp;
@@ -4849,12 +4849,13 @@ rb_iter_peek(struct ring_buffer_iter *iter, u64 *ts)
48494849
buffer = cpu_buffer->buffer;
48504850

48514851
/*
4852-
* Check if someone performed a consuming read to
4853-
* the buffer. A consuming read invalidates the iterator
4854-
* and we need to reset the iterator in this case.
4852+
* Check if someone performed a consuming read to the buffer
4853+
* or removed some pages from the buffer. In these cases,
4854+
* iterator was invalidated and we need to reset it.
48554855
*/
48564856
if (unlikely(iter->cache_read != cpu_buffer->read ||
4857-
iter->cache_reader_page != cpu_buffer->reader_page))
4857+
iter->cache_reader_page != cpu_buffer->reader_page ||
4858+
iter->cache_pages_removed != cpu_buffer->pages_removed))
48584859
rb_iter_reset(iter);
48594860

48604861
again:
@@ -5298,6 +5299,7 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
52985299
cpu_buffer->last_overrun = 0;
52995300

53005301
rb_head_page_activate(cpu_buffer);
5302+
cpu_buffer->pages_removed = 0;
53015303
}
53025304

53035305
/* Must have disabled the cpu buffer then done a synchronize_rcu */
@@ -5356,7 +5358,6 @@ EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu);
53565358
/**
53575359
* ring_buffer_reset_online_cpus - reset a ring buffer per CPU buffer
53585360
* @buffer: The ring buffer to reset a per cpu buffer of
5359-
* @cpu: The CPU buffer to be reset
53605361
*/
53615362
void ring_buffer_reset_online_cpus(struct trace_buffer *buffer)
53625363
{

kernel/trace/trace_events.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,
611611
{
612612
struct trace_event_call *call = file->event_call;
613613
struct trace_array *tr = file->tr;
614-
unsigned long file_flags = file->flags;
615614
int ret = 0;
616615
int disable;
617616

@@ -635,6 +634,8 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,
635634
break;
636635
disable = file->flags & EVENT_FILE_FL_SOFT_DISABLED;
637636
clear_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags);
637+
/* Disable use of trace_buffered_event */
638+
trace_buffered_event_disable();
638639
} else
639640
disable = !(file->flags & EVENT_FILE_FL_SOFT_MODE);
640641

@@ -673,6 +674,8 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,
673674
if (atomic_inc_return(&file->sm_ref) > 1)
674675
break;
675676
set_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags);
677+
/* Enable use of trace_buffered_event */
678+
trace_buffered_event_enable();
676679
}
677680

678681
if (!(file->flags & EVENT_FILE_FL_ENABLED)) {
@@ -712,15 +715,6 @@ static int __ftrace_event_enable_disable(struct trace_event_file *file,
712715
break;
713716
}
714717

715-
/* Enable or disable use of trace_buffered_event */
716-
if ((file_flags & EVENT_FILE_FL_SOFT_DISABLED) !=
717-
(file->flags & EVENT_FILE_FL_SOFT_DISABLED)) {
718-
if (file->flags & EVENT_FILE_FL_SOFT_DISABLED)
719-
trace_buffered_event_enable();
720-
else
721-
trace_buffered_event_disable();
722-
}
723-
724718
return ret;
725719
}
726720

kernel/trace/trace_events_synth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,7 @@ EXPORT_SYMBOL_GPL(__synth_event_gen_cmd_start);
12301230
* synth_event_gen_cmd_array_start - Start synthetic event command from an array
12311231
* @cmd: A pointer to the dynevent_cmd struct representing the new event
12321232
* @name: The name of the synthetic event
1233+
* @mod: The module creating the event, NULL if not created from a module
12331234
* @fields: An array of type/name field descriptions
12341235
* @n_fields: The number of field descriptions contained in the fields array
12351236
*

kernel/trace/trace_events_trigger.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ void trigger_data_free(struct event_trigger_data *data)
3131
/**
3232
* event_triggers_call - Call triggers associated with a trace event
3333
* @file: The trace_event_file associated with the event
34+
* @buffer: The ring buffer that the event is being written to
3435
* @rec: The trace entry for the event, NULL for unconditional invocation
36+
* @event: The event meta data in the ring buffer
3537
*
3638
* For each trigger associated with an event, invoke the trigger
3739
* function registered with the associated trigger command. If rec is

kernel/trace/trace_seq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ EXPORT_SYMBOL_GPL(trace_seq_bitmask);
131131
* trace_seq_vprintf - sequence printing of trace information
132132
* @s: trace sequence descriptor
133133
* @fmt: printf format string
134+
* @args: Arguments for the format string
134135
*
135136
* The tracer may use either sequence operations or its own
136137
* copy to user routines. To simplify formatting of a trace

0 commit comments

Comments
 (0)