From nobody Mon Feb 9 07:18:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4F85824A8 for ; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; cv=none; b=HC1eNa1jR9ZHWjYG7TtF6+EC9fIUYeP/6ujKkAlz2RzWmI2DRMC4bGn7oGlw5l8eeeyFInxj5WUfUiXuF/2zS08IJKKpEJud2hjrYy2XNqn/paTlXqbveUw2zvKHTFM9/esxFC+QaEHakVC0ux48Fzmwdrwdgk1NtPRriyUzr5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; c=relaxed/simple; bh=ANIJRUlQz6LQ5jbf92Mbu1AsZcgEwSE3Z9aKa1ZENwQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=eIxFOhPNv5enKx+utBLljNLKoJIwuSi5Nl3GdBMIEeJLqPzLkslAOP8k3nAC1KHeet0v/7hoeZ9MLq1jTjQiP+yAY2q/En8mg0sgYyhSXQK2hAIjH/u+A8vBHxX3gk11DUEs1uPf+fpTpT2Dpcp33zL4tU1F8wi7Wy26iMrIovk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DE99C3277B; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rvH0n-000000012pR-45QV; Fri, 12 Apr 2024 09:32:13 -0400 Message-ID: <20240412133213.834390718@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 12 Apr 2024 09:31:53 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Yang Li Subject: [for-linus][PATCH 1/4] eventfs: Fix kernel-doc comments to functions References: <20240412133152.723632549@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yang Li This commit fix kernel-doc style comments with complete parameter descriptions for the lookup_file(),lookup_dir_entry() and lookup_file_dentry(). Link: https://lore.kernel.org/linux-trace-kernel/20240322062604.28862-1-yan= g.lee@linux.alibaba.com Signed-off-by: Yang Li Signed-off-by: Steven Rostedt (Google) --- fs/tracefs/event_inode.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c index dc067eeb6387..894c6ca1e500 100644 --- a/fs/tracefs/event_inode.c +++ b/fs/tracefs/event_inode.c @@ -336,6 +336,7 @@ static void update_inode_attr(struct dentry *dentry, st= ruct inode *inode, =20 /** * lookup_file - look up a file in the tracefs filesystem + * @parent_ei: Pointer to the eventfs_inode that represents parent of the = file * @dentry: the dentry to look up * @mode: the permission that the file should have. * @attr: saved attributes changed by user @@ -389,6 +390,7 @@ static struct dentry *lookup_file(struct eventfs_inode = *parent_ei, /** * lookup_dir_entry - look up a dir in the tracefs filesystem * @dentry: the directory to look up + * @pei: Pointer to the parent eventfs_inode if available * @ei: the eventfs_inode that represents the directory to create * * This function will look up a dentry for a directory represented by @@ -478,16 +480,20 @@ void eventfs_d_release(struct dentry *dentry) =20 /** * lookup_file_dentry - create a dentry for a file of an eventfs_inode + * @dentry: The parent dentry under which the new file's dentry will be cr= eated * @ei: the eventfs_inode that the file will be created under * @idx: the index into the entry_attrs[] of the @ei - * @parent: The parent dentry of the created file. - * @name: The name of the file to create * @mode: The mode of the file. * @data: The data to use to set the inode of the file with on open() * @fops: The fops of the file to be created. * - * Create a dentry for a file of an eventfs_inode @ei and place it into the - * address located at @e_dentry. + * This function creates a dentry for a file associated with an + * eventfs_inode @ei. It uses the entry attributes specified by @idx, + * if available. The file will have the specified @mode and its inode will= be + * set up with @data upon open. The file operations will be set to @fops. + * + * Return: Returns a pointer to the newly created file's dentry or an error + * pointer. */ static struct dentry * lookup_file_dentry(struct dentry *dentry, --=20 2.43.0 From nobody Mon Feb 9 07:18:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2B13824A7 for ; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; cv=none; b=AUg6CKsza3Ez4LCCDl/z+67sH1f20kyy+JbsjAswCk8Woquu1oBRpcgs6tu4mciacFup3qKyBaRcmdoayqESAq7d3RK02/bcLQ9j4W4/Z29PLNUXdL/NMR6zB9Zmkk8AekOiFTQ6bNz6SxKd8xkEX7Lv1uPBQuHOPrOOTYnuilA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; c=relaxed/simple; bh=0TOkjBaTj5it68Im/6giqJjimq/460uMEJuzqUrd+Zk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Vnmuyvt6uvaE9JdTjDJ/2xnoA83Of/pYhw+prKWzK1s79JWAFrpWaCn4Y2QxwCeXM+WNSV3PDnkmvz/SyDRboBhLiH48rE+R4d6tearFkMN+61k4sijcWDSANxSzQURpZY8p2P0QItd+JY6vfn0LJk1obITm6MfH3W4HR9WsD58= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4851BC2BD10; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rvH0o-000000012pu-0YH3; Fri, 12 Apr 2024 09:32:14 -0400 Message-ID: <20240412133213.994663842@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 12 Apr 2024 09:31:54 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Prasad Pandit , Randy Dunlap Subject: [for-linus][PATCH 2/4] tracing: Fix FTRACE_RECORD_RECURSION_SIZE Kconfig entry References: <20240412133152.723632549@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Prasad Pandit Fix FTRACE_RECORD_RECURSION_SIZE entry, replace tab with a space character. It helps Kconfig parsers to read file without error. Link: https://lore.kernel.org/linux-trace-kernel/20240322121801.1803948-1-p= pandit@redhat.com Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Fixes: 773c16705058 ("ftrace: Add recording of functions that caused recurs= ion") Signed-off-by: Prasad Pandit Reviewed-by: Randy Dunlap Signed-off-by: Steven Rostedt (Google) --- kernel/trace/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 61c541c36596..47345bf1d4a9 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -965,7 +965,7 @@ config FTRACE_RECORD_RECURSION =20 config FTRACE_RECORD_RECURSION_SIZE int "Max number of recursed functions to record" - default 128 + default 128 depends on FTRACE_RECORD_RECURSION help This defines the limit of number of functions that can be --=20 2.43.0 From nobody Mon Feb 9 07:18:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C22EB824AD for ; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; cv=none; b=um5pHqbknU1XRa8Wh6TtKPK7HyNowDGIl9xfKKn2HCCEfucqzKk9kN73UscDAqkkB/ov99YwGATZVsGqcMXME+VRy9OSel9N7Lf9PH5mr3qEL5n9a6Yu+J9x70Oq/TmKShERSpxCSXLTZhCMrLuw5JA+UfK/tddkrmQNwwhAhtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; c=relaxed/simple; bh=s92Y7fSnYxp/hAB13hJr+ejV7YBDYEZNITD0UOK91uE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=DaqwizNwwrpRfQc3wWRjF2yg9dnExiY9okh+l0bu/nhh/wczuv/sryDjnCeYLddz3UMTw5cKesihN+CR1Wv7t27ORtlWzidb8H8jGdGupiy0NFxqGtZ4+nugfkGej979hT3+uefFbdOZih53a508CPzGZrKdfOvzYRcrFjdG7Iw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 633EFC32786; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rvH0o-000000012qQ-1Czq; Fri, 12 Apr 2024 09:32:14 -0400 Message-ID: <20240412133214.151885304@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 12 Apr 2024 09:31:55 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Oleg Nesterov , Zheng Yejian , Kees Cook , Ajay Kaher , Jinjie Ruan , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Dan Carpenter , "Tzvetomir Stoyanov (VMware)" , Arnd Bergmann Subject: [for-linus][PATCH 3/4] tracing: hide unused ftrace_event_id_fops References: <20240412133152.723632549@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Arnd Bergmann When CONFIG_PERF_EVENTS, a 'make W=3D1' build produces a warning about the unused ftrace_event_id_fops variable: kernel/trace/trace_events.c:2155:37: error: 'ftrace_event_id_fops' defined = but not used [-Werror=3Dunused-const-variable=3D] 2155 | static const struct file_operations ftrace_event_id_fops =3D { Hide this in the same #ifdef as the reference to it. Link: https://lore.kernel.org/linux-trace-kernel/20240403080702.3509288-7-a= rnd@kernel.org Cc: Masami Hiramatsu Cc: Oleg Nesterov Cc: Mathieu Desnoyers Cc: Zheng Yejian Cc: Kees Cook Cc: Ajay Kaher Cc: Jinjie Ruan Cc: Cl=C3=A9ment L=C3=A9ger Cc: Dan Carpenter Cc: "Tzvetomir Stoyanov (VMware)" Fixes: 620a30e97feb ("tracing: Don't pass file_operations array to event_cr= eate_dir()") Signed-off-by: Arnd Bergmann Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 7c364b87352e..52f75c36bbca 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -1670,6 +1670,7 @@ static int trace_format_open(struct inode *inode, str= uct file *file) return 0; } =20 +#ifdef CONFIG_PERF_EVENTS static ssize_t event_id_read(struct file *filp, char __user *ubuf, size_t cnt, loff_t *pp= os) { @@ -1684,6 +1685,7 @@ event_id_read(struct file *filp, char __user *ubuf, s= ize_t cnt, loff_t *ppos) =20 return simple_read_from_buffer(ubuf, cnt, ppos, buf, len); } +#endif =20 static ssize_t event_filter_read(struct file *filp, char __user *ubuf, size_t cnt, @@ -2152,10 +2154,12 @@ static const struct file_operations ftrace_event_fo= rmat_fops =3D { .release =3D seq_release, }; =20 +#ifdef CONFIG_PERF_EVENTS static const struct file_operations ftrace_event_id_fops =3D { .read =3D event_id_read, .llseek =3D default_llseek, }; +#endif =20 static const struct file_operations ftrace_event_filter_fops =3D { .open =3D tracing_open_file_tr, --=20 2.43.0 From nobody Mon Feb 9 07:18:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1386824B3; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; cv=none; b=nhydOyVvhSK3ecvIdtpvFqXCebYqroD0iHlb29F7uvp4snknKzJUTBhxEWq9d2fYejElllXm8N+cbliZOanJBizkq71dnMCBiPyFXKL+jn8oT9kwLzE2FcmRxNC/yQFFMSIOBGBBGdwSmhnHAZaVGzbJ1yewAjgM8CqtG0FT8yc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712928572; c=relaxed/simple; bh=u8dMeeeKnX/l6l8EK0qzPoKX+NXDcA9+9DlJCRADEYA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=MsGnacRSfQqEDLfrJACznESvKKDLG8bMq7ZmLTOTBcaLpwgRZ+3SgWIoCH8hTC7kpcUxyvOfLaW/AlTZBrMy+1JF2RINpazhiePUBeg/6DPpZ7dawgcFCPCEEcS6IwAjQFN90RGyC4BIrg4tZGpqMU6nPFNCc+4vP+1n8iNdy3w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A7FCC4AF07; Fri, 12 Apr 2024 13:29:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rvH0o-000000012qu-1r4T; Fri, 12 Apr 2024 09:32:14 -0400 Message-ID: <20240412133214.307818654@goodmis.org> User-Agent: quilt/0.67 Date: Fri, 12 Apr 2024 09:31:56 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org Subject: [for-linus][PATCH 4/4] ring-buffer: Only update pages_touched when a new page is touched References: <20240412133152.723632549@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" The "buffer_percent" logic that is used by the ring buffer splice code to only wake up the tasks when there's no data after the buffer is filled to the percentage of the "buffer_percent" file is dependent on three variables that determine the amount of data that is in the ring buffer: 1) pages_read - incremented whenever a new sub-buffer is consumed 2) pages_lost - incremented every time a writer overwrites a sub-buffer 3) pages_touched - incremented when a write goes to a new sub-buffer The percentage is the calculation of: (pages_touched - (pages_lost + pages_read)) / nr_pages Basically, the amount of data is the total number of sub-bufs that have been touched, minus the number of sub-bufs lost and sub-bufs consumed. This is divided by the total count to give the buffer percentage. When the percentage is greater than the value in the "buffer_percent" file, it wakes up splice readers waiting for that amount. It was observed that over time, the amount read from the splice was constantly decreasing the longer the trace was running. That is, if one asked for 60%, it would read over 60% when it first starts tracing, but then it would be woken up at under 60% and would slowly decrease the amount of data read after being woken up, where the amount becomes much less than the buffer percent. This was due to an accounting of the pages_touched incrementation. This value is incremented whenever a writer transfers to a new sub-buffer. But the place where it was incremented was incorrect. If a writer overflowed the current sub-buffer it would go to the next one. If it gets preempted by an interrupt at that time, and the interrupt performs a trace, it too will end up going to the next sub-buffer. But only one should increment the counter. Unfortunately, that was not the case. Change the cmpxchg() that does the real switch of the tail-page into a try_cmpxchg(), and on success, perform the increment of pages_touched. This will only increment the counter once for when the writer moves to a new sub-buffer, and not when there's a race and is incremented for when a writer and its preempting writer both move to the same new sub-buffer. Link: https://lore.kernel.org/linux-trace-kernel/20240409151309.0d0e5056@ga= ndalf.local.home Cc: stable@vger.kernel.org Cc: Mathieu Desnoyers Fixes: 2c2b0a78b3739 ("ring-buffer: Add percentage of ring buffer full to w= ake up reader") Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ring_buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 25476ead681b..6511dc3a00da 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -1393,7 +1393,6 @@ static void rb_tail_page_update(struct ring_buffer_pe= r_cpu *cpu_buffer, old_write =3D local_add_return(RB_WRITE_INTCNT, &next_page->write); old_entries =3D local_add_return(RB_WRITE_INTCNT, &next_page->entries); =20 - local_inc(&cpu_buffer->pages_touched); /* * Just make sure we have seen our old_write and synchronize * with any interrupts that come in. @@ -1430,8 +1429,9 @@ static void rb_tail_page_update(struct ring_buffer_pe= r_cpu *cpu_buffer, */ local_set(&next_page->page->commit, 0); =20 - /* Again, either we update tail_page or an interrupt does */ - (void)cmpxchg(&cpu_buffer->tail_page, tail_page, next_page); + /* Either we update tail_page or an interrupt does */ + if (try_cmpxchg(&cpu_buffer->tail_page, &tail_page, next_page)) + local_inc(&cpu_buffer->pages_touched); } } =20 --=20 2.43.0