public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ring-buffer: report header_page overwrite as signed char
@ 2026-04-06 16:28 CaoRuichuang
  2026-04-06 16:45 ` Steven Rostedt
  2026-04-06 16:53 ` [PATCH v2] ring-buffer: report header_page overwrite as char Cao Ruichuang
  0 siblings, 2 replies; 3+ messages in thread
From: CaoRuichuang @ 2026-04-06 16:28 UTC (permalink / raw)
  To: rostedt; +Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel

The header_page tracefs metadata currently reports overwrite as an
int field with size 1. That makes parsers warn about a type and
size mismatch even though the field is only used as a one-byte flag
within commit.

Keep the shared offset with commit as-is, but report overwrite as
signed char so the declared type matches the hardcoded size and the
emitted signedness.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216999
Signed-off-by: CaoRuichuang <create0818@163.com>
---
 kernel/trace/ring_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 170170bd8..c4c2361b0 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -627,11 +627,11 @@ int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq
 			 (unsigned int)sizeof(field.commit),
 			 (unsigned int)is_signed_type(long));
 
-	trace_seq_printf(s, "\tfield: int overwrite;\t"
+	trace_seq_printf(s, "\tfield: signed char overwrite;\t"
 			 "offset:%u;\tsize:%u;\tsigned:%u;\n",
 			 (unsigned int)offsetof(typeof(field), commit),
 			 1,
-			 (unsigned int)is_signed_type(long));
+			 (unsigned int)is_signed_type(signed char));
 
 	trace_seq_printf(s, "\tfield: char data;\t"
 			 "offset:%u;\tsize:%u;\tsigned:%u;\n",
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ring-buffer: report header_page overwrite as signed char
  2026-04-06 16:28 [PATCH] ring-buffer: report header_page overwrite as signed char CaoRuichuang
@ 2026-04-06 16:45 ` Steven Rostedt
  2026-04-06 16:53 ` [PATCH v2] ring-buffer: report header_page overwrite as char Cao Ruichuang
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2026-04-06 16:45 UTC (permalink / raw)
  To: CaoRuichuang
  Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel

On Tue,  7 Apr 2026 00:28:43 +0800
CaoRuichuang <create0818@163.com> wrote:

> The header_page tracefs metadata currently reports overwrite as an
> int field with size 1. That makes parsers warn about a type and
> size mismatch even though the field is only used as a one-byte flag
> within commit.
> 
> Keep the shared offset with commit as-is, but report overwrite as
> signed char so the declared type matches the hardcoded size and the
> emitted signedness.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216999
> Signed-off-by: CaoRuichuang <create0818@163.com>
> ---
>  kernel/trace/ring_buffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 170170bd8..c4c2361b0 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -627,11 +627,11 @@ int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq
>  			 (unsigned int)sizeof(field.commit),
>  			 (unsigned int)is_signed_type(long));
>  
> -	trace_seq_printf(s, "\tfield: int overwrite;\t"
> +	trace_seq_printf(s, "\tfield: signed char overwrite;\t"

From the Bugzilla, the issue was with the rust parser. Would this still not
cause a warning if the "int" was switched to "char" and not "signed char".
The signed is redundant as it is already specified in the fields.

-- Steve


>  			 "offset:%u;\tsize:%u;\tsigned:%u;\n",
>  			 (unsigned int)offsetof(typeof(field), commit),
>  			 1,
> -			 (unsigned int)is_signed_type(long));
> +			 (unsigned int)is_signed_type(signed char));
>  
>  	trace_seq_printf(s, "\tfield: char data;\t"
>  			 "offset:%u;\tsize:%u;\tsigned:%u;\n",


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] ring-buffer: report header_page overwrite as char
  2026-04-06 16:28 [PATCH] ring-buffer: report header_page overwrite as signed char CaoRuichuang
  2026-04-06 16:45 ` Steven Rostedt
@ 2026-04-06 16:53 ` Cao Ruichuang
  1 sibling, 0 replies; 3+ messages in thread
From: Cao Ruichuang @ 2026-04-06 16:53 UTC (permalink / raw)
  To: rostedt; +Cc: mhiramat, mathieu.desnoyers, linux-kernel, linux-trace-kernel

The header_page tracefs metadata currently reports overwrite as an
int field with size 1. That makes parsers warn about a type and
size mismatch even though the field is only used as a one-byte flag
within commit.

Keep the shared offset with commit as-is, but report overwrite as
char so the declared type matches the hardcoded size. The signedness
is already carried separately by the emitted signed field.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216999
Signed-off-by: Cao Ruichuang <create0818@163.com>
---
 kernel/trace/ring_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 170170bd8..6811dfffa 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -627,11 +627,11 @@ int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq
 			 (unsigned int)sizeof(field.commit),
 			 (unsigned int)is_signed_type(long));
 
-	trace_seq_printf(s, "\tfield: int overwrite;\t"
+	trace_seq_printf(s, "\tfield: char overwrite;\t"
 			 "offset:%u;\tsize:%u;\tsigned:%u;\n",
 			 (unsigned int)offsetof(typeof(field), commit),
 			 1,
-			 (unsigned int)is_signed_type(long));
+			 (unsigned int)is_signed_type(char));
 
 	trace_seq_printf(s, "\tfield: char data;\t"
 			 "offset:%u;\tsize:%u;\tsigned:%u;\n",
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-06 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-06 16:28 [PATCH] ring-buffer: report header_page overwrite as signed char CaoRuichuang
2026-04-06 16:45 ` Steven Rostedt
2026-04-06 16:53 ` [PATCH v2] ring-buffer: report header_page overwrite as char Cao Ruichuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox