Skip to content

Commit 5939d45

Browse files
committed
Merge tag 'trace-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fixes from Steven Rostedt: - Fix the buffer_percent accounting as it is dependent on three variables: 1) pages_read - number of subbuffers read 2) pages_lost - number of subbuffers lost due to overwrite 3) pages_touched - number of pages that a writer entered These three counters only increment, and to know how many active pages there are on the buffer at any given time, the pages_read and pages_lost are subtracted from pages_touched. But the pages touched was incremented whenever any writer went to the next subbuffer even if it wasn't the only one, so it was incremented more than it should be causing the counter for how many subbuffers currently have content incorrect, which caused the buffer_percent that holds waiters until the ring buffer is filled to a given percentage to wake up early. - Fix warning of unused functions when PERF_EVENTS is not configured in - Replace bad tab with space in Kconfig for FTRACE_RECORD_RECURSION_SIZE - Fix to some kerneldoc function comments in eventfs code. * tag 'trace-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: ring-buffer: Only update pages_touched when a new page is touched tracing: hide unused ftrace_event_id_fops tracing: Fix FTRACE_RECORD_RECURSION_SIZE Kconfig entry eventfs: Fix kernel-doc comments to functions
2 parents e00011a + ffe3986 commit 5939d45

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

fs/tracefs/event_inode.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ static void update_inode_attr(struct dentry *dentry, struct inode *inode,
336336

337337
/**
338338
* lookup_file - look up a file in the tracefs filesystem
339+
* @parent_ei: Pointer to the eventfs_inode that represents parent of the file
339340
* @dentry: the dentry to look up
340341
* @mode: the permission that the file should have.
341342
* @attr: saved attributes changed by user
@@ -389,6 +390,7 @@ static struct dentry *lookup_file(struct eventfs_inode *parent_ei,
389390
/**
390391
* lookup_dir_entry - look up a dir in the tracefs filesystem
391392
* @dentry: the directory to look up
393+
* @pei: Pointer to the parent eventfs_inode if available
392394
* @ei: the eventfs_inode that represents the directory to create
393395
*
394396
* This function will look up a dentry for a directory represented by
@@ -478,16 +480,20 @@ void eventfs_d_release(struct dentry *dentry)
478480

479481
/**
480482
* lookup_file_dentry - create a dentry for a file of an eventfs_inode
483+
* @dentry: The parent dentry under which the new file's dentry will be created
481484
* @ei: the eventfs_inode that the file will be created under
482485
* @idx: the index into the entry_attrs[] of the @ei
483-
* @parent: The parent dentry of the created file.
484-
* @name: The name of the file to create
485486
* @mode: The mode of the file.
486487
* @data: The data to use to set the inode of the file with on open()
487488
* @fops: The fops of the file to be created.
488489
*
489-
* Create a dentry for a file of an eventfs_inode @ei and place it into the
490-
* address located at @e_dentry.
490+
* This function creates a dentry for a file associated with an
491+
* eventfs_inode @ei. It uses the entry attributes specified by @idx,
492+
* if available. The file will have the specified @mode and its inode will be
493+
* set up with @data upon open. The file operations will be set to @fops.
494+
*
495+
* Return: Returns a pointer to the newly created file's dentry or an error
496+
* pointer.
491497
*/
492498
static struct dentry *
493499
lookup_file_dentry(struct dentry *dentry,

kernel/trace/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ config FTRACE_RECORD_RECURSION
965965

966966
config FTRACE_RECORD_RECURSION_SIZE
967967
int "Max number of recursed functions to record"
968-
default 128
968+
default 128
969969
depends on FTRACE_RECORD_RECURSION
970970
help
971971
This defines the limit of number of functions that can be

kernel/trace/ring_buffer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,6 @@ static void rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,
13931393
old_write = local_add_return(RB_WRITE_INTCNT, &next_page->write);
13941394
old_entries = local_add_return(RB_WRITE_INTCNT, &next_page->entries);
13951395

1396-
local_inc(&cpu_buffer->pages_touched);
13971396
/*
13981397
* Just make sure we have seen our old_write and synchronize
13991398
* with any interrupts that come in.
@@ -1430,8 +1429,9 @@ static void rb_tail_page_update(struct ring_buffer_per_cpu *cpu_buffer,
14301429
*/
14311430
local_set(&next_page->page->commit, 0);
14321431

1433-
/* Again, either we update tail_page or an interrupt does */
1434-
(void)cmpxchg(&cpu_buffer->tail_page, tail_page, next_page);
1432+
/* Either we update tail_page or an interrupt does */
1433+
if (try_cmpxchg(&cpu_buffer->tail_page, &tail_page, next_page))
1434+
local_inc(&cpu_buffer->pages_touched);
14351435
}
14361436
}
14371437

kernel/trace/trace_events.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, struct file *file)
16701670
return 0;
16711671
}
16721672

1673+
#ifdef CONFIG_PERF_EVENTS
16731674
static ssize_t
16741675
event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
16751676
{
@@ -1684,6 +1685,7 @@ event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos)
16841685

16851686
return simple_read_from_buffer(ubuf, cnt, ppos, buf, len);
16861687
}
1688+
#endif
16871689

16881690
static ssize_t
16891691
event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
@@ -2152,10 +2154,12 @@ static const struct file_operations ftrace_event_format_fops = {
21522154
.release = seq_release,
21532155
};
21542156

2157+
#ifdef CONFIG_PERF_EVENTS
21552158
static const struct file_operations ftrace_event_id_fops = {
21562159
.read = event_id_read,
21572160
.llseek = default_llseek,
21582161
};
2162+
#endif
21592163

21602164
static const struct file_operations ftrace_event_filter_fops = {
21612165
.open = tracing_open_file_tr,

0 commit comments

Comments
 (0)