mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Bug 220102 - struct taskstats breaks backward compatibility since version 15
@ 2025-05-09 18:35 Boian Bonev
  2025-05-09 21:17 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Boian Bonev @ 2025-05-09 18:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Balbir Singh, Yang Yang, Wang Yaxin, Kun Jiang, xu xin, Andrew Morton

Hello!

Since version 15 (TASKSTATS_VERSION=15) the new layout of the structure
adds fields in the middle of the structure, rendering all old software
incompatible with newer kernels and software compiled against the new
kernel headers incompatible with older kernels.

I think that change has to be reverted and the added fields moved to
the end of the structure. Also bumping the version to 16 after the
change is a good idea in order for the userspace software to be able to
distinguish the different formats.

https://bugzilla.kernel.org/show_bug.cgi?id=220102

With best regards,
b.

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

* Re: Bug 220102 - struct taskstats breaks backward compatibility since version 15
  2025-05-09 18:35 Bug 220102 - struct taskstats breaks backward compatibility since version 15 Boian Bonev
@ 2025-05-09 21:17 ` Andrew Morton
  2025-05-10 11:45   ` Boian Bonev
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2025-05-09 21:17 UTC (permalink / raw)
  To: Boian Bonev
  Cc: linux-kernel, Balbir Singh, Yang Yang, Wang Yaxin, Kun Jiang, xu xin

On Fri, 09 May 2025 21:35:59 +0300 Boian Bonev <bbonev@devuan.org> wrote:

> Hello!
> 
> Since version 15 (TASKSTATS_VERSION=15) the new layout of the structure
> adds fields in the middle of the structure, rendering all old software
> incompatible with newer kernels and software compiled against the new
> kernel headers incompatible with older kernels.

Yikes.  Yes, we did change the versioning but such an incompatibility
seems undesirable and unnecessarily disruptive.

> I think that change has to be reverted and the added fields moved to
> the end of the structure. Also bumping the version to 16 after the
> change is a good idea in order for the userspace software to be able to
> distinguish the different formats.

Yes, please send along the patch.  Include the suitable Fixes: and we
can backport this into the affected -stable kernels.

> https://bugzilla.kernel.org/show_bug.cgi?id=220102


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

* Re: Bug 220102 - struct taskstats breaks backward compatibility since version 15
  2025-05-09 21:17 ` Andrew Morton
@ 2025-05-10 11:45   ` Boian Bonev
  2025-05-10 20:23     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Boian Bonev @ 2025-05-10 11:45 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Balbir Singh, Yang Yang, Wang Yaxin, Kun Jiang, xu xin

On Fri, 2025-05-09 at 14:17 -0700, Andrew Morton wrote:
> Yes, please send along the patch.  Include the suitable Fixes: and we
> can backport this into the affected -stable kernels.
> 
> > https://bugzilla.kernel.org/show_bug.cgi?id=220102

My patch was attached in the bugzilla above. I also see that Wang Yaxin
<wang.yaxin@zte.com.cn> has already sent a different but working
patch...

With best regards,
b.


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

* Re: Bug 220102 - struct taskstats breaks backward compatibility since version 15
  2025-05-10 11:45   ` Boian Bonev
@ 2025-05-10 20:23     ` Andrew Morton
  2025-05-10 22:03       ` Boian Bonev
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2025-05-10 20:23 UTC (permalink / raw)
  To: Boian Bonev
  Cc: linux-kernel, Balbir Singh, Yang Yang, Wang Yaxin, Kun Jiang, xu xin

On Sat, 10 May 2025 14:45:31 +0300 Boian Bonev <bbonev@devuan.org> wrote:

> On Fri, 2025-05-09 at 14:17 -0700, Andrew Morton wrote:
> > Yes, please send along the patch.  Include the suitable Fixes: and we
> > can backport this into the affected -stable kernels.
> > 
> > > https://bugzilla.kernel.org/show_bug.cgi?id=220102
> 
> My patch was attached in the bugzilla above.

We barely use bugzilla at all for kernel development.  I think I wish
that kernel bugzilla was simply shut down, replaced with a page to help
people to email their bug reports.

> I also see that Wang Yaxin
> <wang.yaxin@zte.com.cn> has already sent a different but working
> patch...

Cool.  Except I cannot find that patch.  Help?


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

* Re: Bug 220102 - struct taskstats breaks backward compatibility since version 15
  2025-05-10 20:23     ` Andrew Morton
@ 2025-05-10 22:03       ` Boian Bonev
  2025-05-13  0:58         ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Boian Bonev @ 2025-05-10 22:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Balbir Singh, Yang Yang, Wang Yaxin, Kun Jiang, xu xin

[-- Attachment #1: Type: text/plain, Size: 621 bytes --]

On Sat, 2025-05-10 at 13:23 -0700, Andrew Morton wrote:
> > > > https://bugzilla.kernel.org/show_bug.cgi?id=220102
> > 
> > My patch was attached in the bugzilla above.
> 
> We barely use bugzilla at all for kernel development.  I think I wish
> that kernel bugzilla was simply shut down, replaced with a page to
> help people to email their bug reports.

I am not sure if my patch is up to standards, PFA

> 
> > I also see that Wang Yaxin
> > <wang.yaxin@zte.com.cn> has already sent a different but working
> > patch...
> 
> Cool.  Except I cannot find that patch.  Help?

That one was on email.

[-- Attachment #2: taskstats_compat.patch --]
[-- Type: text/x-patch, Size: 3161 bytes --]

diff --git a/include/uapi/linux/taskstats.h b/include/uapi/linux/taskstats.h
index 95762232e018..7f169c65b16e 100644
--- a/include/uapi/linux/taskstats.h
+++ b/include/uapi/linux/taskstats.h
@@ -34,7 +34,7 @@
  */
 
 
-#define TASKSTATS_VERSION	15
+#define TASKSTATS_VERSION	16
 #define TS_COMM_LEN		32	/* should be >= TASK_COMM_LEN
 					 * in linux/sched.h */
 
@@ -72,8 +72,6 @@ struct taskstats {
 	 */
 	__u64	cpu_count __attribute__((aligned(8)));
 	__u64	cpu_delay_total;
-	__u64	cpu_delay_max;
-	__u64	cpu_delay_min;
 
 	/* Following four fields atomically updated using task->delays->lock */
 
@@ -82,14 +80,10 @@ struct taskstats {
 	 */
 	__u64	blkio_count;
 	__u64	blkio_delay_total;
-	__u64	blkio_delay_max;
-	__u64	blkio_delay_min;
 
 	/* Delay waiting for page fault I/O (swap in only) */
 	__u64	swapin_count;
 	__u64	swapin_delay_total;
-	__u64	swapin_delay_max;
-	__u64	swapin_delay_min;
 
 	/* cpu "wall-clock" running time
 	 * On some architectures, value will adjust for cpu time stolen
@@ -161,8 +155,8 @@ struct taskstats {
 	__u64	write_bytes;		/* bytes of write I/O */
 	__u64	cancelled_write_bytes;	/* bytes of cancelled write I/O */
 
-	__u64  nvcsw;			/* voluntary_ctxt_switches */
-	__u64  nivcsw;			/* nonvoluntary_ctxt_switches */
+	__u64   nvcsw;			/* voluntary_ctxt_switches */
+	__u64   nivcsw;			/* nonvoluntary_ctxt_switches */
 
 	/* time accounting for SMT machines */
 	__u64	ac_utimescaled;		/* utime scaled on frequency etc */
@@ -172,14 +166,10 @@ struct taskstats {
 	/* Delay waiting for memory reclaim */
 	__u64	freepages_count;
 	__u64	freepages_delay_total;
-	__u64	freepages_delay_max;
-	__u64	freepages_delay_min;
 
 	/* Delay waiting for thrashing page */
 	__u64	thrashing_count;
 	__u64	thrashing_delay_total;
-	__u64	thrashing_delay_max;
-	__u64	thrashing_delay_min;
 
 	/* v10: 64-bit btime to avoid overflow */
 	__u64	ac_btime64;		/* 64-bit begin time */
@@ -187,8 +177,6 @@ struct taskstats {
 	/* v11: Delay waiting for memory compact */
 	__u64	compact_count;
 	__u64	compact_delay_total;
-	__u64	compact_delay_max;
-	__u64	compact_delay_min;
 
 	/* v12 begin */
 	__u32   ac_tgid;	/* thread group ID */
@@ -208,17 +196,30 @@ struct taskstats {
 	/* v12 end */
 
 	/* v13: Delay waiting for write-protect copy */
-	__u64    wpcopy_count;
-	__u64    wpcopy_delay_total;
-	__u64    wpcopy_delay_max;
-	__u64    wpcopy_delay_min;
+	__u64   wpcopy_count;
+	__u64   wpcopy_delay_total;
 
 	/* v14: Delay waiting for IRQ/SOFTIRQ */
-	__u64    irq_count;
-	__u64    irq_delay_total;
-	__u64    irq_delay_max;
-	__u64    irq_delay_min;
-	/* v15: add Delay max */
+	__u64   irq_count;
+	__u64   irq_delay_total;
+	/* v15: broken compatibility */
+	/* v16: add Delay min/max */
+	__u64	cpu_delay_min;
+	__u64	cpu_delay_max;
+	__u64	blkio_delay_min;
+	__u64	blkio_delay_max;
+	__u64	swapin_delay_min;
+	__u64	swapin_delay_max;
+	__u64	freepages_delay_min;
+	__u64	freepages_delay_max;
+	__u64	thrashing_delay_min;
+	__u64	thrashing_delay_max;
+	__u64	compact_delay_min;
+	__u64	compact_delay_max;
+	__u64   wpcopy_delay_min;
+	__u64   wpcopy_delay_max;
+	__u64   irq_delay_min;
+	__u64   irq_delay_max;
 };
 
 

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

* Re: Bug 220102 - struct taskstats breaks backward compatibility since version 15
  2025-05-10 22:03       ` Boian Bonev
@ 2025-05-13  0:58         ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2025-05-13  0:58 UTC (permalink / raw)
  To: Boian Bonev
  Cc: linux-kernel, Balbir Singh, Yang Yang, Wang Yaxin, Kun Jiang, xu xin

On Sun, 11 May 2025 01:03:58 +0300 Boian Bonev <bbonev@devuan.org> wrote:

> > 
> > > I also see that Wang Yaxin
> > > <wang.yaxin@zte.com.cn> has already sent a different but working
> > > patch...
> > 
> > Cool.  Except I cannot find that patch.  Help?
> 
> That one was on email.
> 
> 
> diff --git a/include/uapi/linux/taskstats.h b/include/uapi/linux/taskstats.h
> index 95762232e018..7f169c65b16e 100644

I don't think I've yet seen a usable patch for this issue?  Can someone
please email one at me in the usual fashion?



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

end of thread, other threads:[~2025-05-13  0:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-09 18:35 Bug 220102 - struct taskstats breaks backward compatibility since version 15 Boian Bonev
2025-05-09 21:17 ` Andrew Morton
2025-05-10 11:45   ` Boian Bonev
2025-05-10 20:23     ` Andrew Morton
2025-05-10 22:03       ` Boian Bonev
2025-05-13  0:58         ` Andrew Morton

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

all inboxes | Powered by JetHome®