Skip to contentSkip to conversation

tst_kvercmp: Handle larger kernel version numbers

PATCH Applied Edward Liaw via ltp 2 participants 7 messages Oct 18, 2023 – Oct 25, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tst_kvercmp: Handle larger kernel version numbers

Current implementation can only handle revision numbers up to 256. Bump this up to 1024 as some revision numbers are in the 300s.

---
 lib/tst_kvercmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/tst_kvercmp.c +2 -2
index 552920fac..9e1a511af 100644
@@ -92,8 +92,8 @@ int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3)
 		         cur_kver);
 	}
 
-	testver = (r1 << 16) + (r2 << 8) + r3;
-	currver = (a1 << 16) + (a2 << 8) + a3;
+	testver = (r1 << 20) + (r2 << 10) + r3;
+	currver = (a1 << 20) + (a2 << 10) + a3;
 
 	return currver - testver;
 }
Signature · 5 lines
2.42.0.655.g421f12c284-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Edward,

Quoted 2 lines

Current implementation can only handle revision numbers up to 256. Bump this up to 1024 as some revision numbers are in the 300s.

Thanks!

FYI I'm waiting for CI fixes before merging this.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Edward Liaw via ltp

Hi Edward,

Quoted 13 lines

Current implementation can only handle revision numbers up to 256. Bump this up to 1024 as some revision numbers are in the 300s.

---
 lib/tst_kvercmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/tst_kvercmp.c +0 -0
index 552920fac..9e1a511af 100644

lib/tst_kvercmp.c int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3) · line 96

Quoted 7 lines
lib/tst_kvercmp.c +2 -2
@@ -92,8 +92,8 @@ int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3)
 		         cur_kver);
 	}
 
-	testver = (r1 << 16) + (r2 << 8) + r3;
-	currver = (a1 << 16) + (a2 << 8) + a3;
+	testver = (r1 << 20) + (r2 << 10) + r3;
+	currver = (a1 << 20) + (a2 << 10) + a3;

I wonder why you need this change. Number > 256 is actually only the third number, but we haven't checked that so far. Do you plan to use it actually?

We try to detect functional changes to avoid problems to compare about mainline and *also* with stable/LTS kernels.

NOTE: checking for 3rd number actually does not work for Debian, which reports uname -r as: 5.10.0-8-amd64 (the real version is only as an comment in /boot/config-*). If something specific in stable would be needed, it would have to use tst_kvercmp2() (e.g. utimensat01.c for Ubuntu). Maybe you have a similar problem in AOSP kernel.

Kind regards,
Petr

Quoted 2 lines
lib/tst_kvercmp.c +0 -0
 	return currver - testver;
 }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 19 lines · Petr Vorel

Hi Edward,

lib/tst_kvercmp.c int tst_kvcmp(const char *cur_kver, int r1, int r2,

Quoted 13 lines

Current implementation can only handle revision numbers up to 256. Bump this up to 1024 as some revision numbers are in the 300s.

---
 lib/tst_kvercmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/tst_kvercmp.c +0 -0
index 552920fac..9e1a511af 100644
@@ -92,8 +92,8 @@ int tst_kvcmp(const char *cur_kver, int r1, int r2,

int r3)

Quoted 2 lines
lib/tst_kvercmp.c +0 -0
                       cur_kver);
      }
Quoted 8 lines

lib/tst_kvercmp.c int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3) · line 96

Quoted 4 lines
lib/tst_kvercmp.c +2 -2
-     testver = (r1 << 16) + (r2 << 8) + r3;
-     currver = (a1 << 16) + (a2 << 8) + a3;
+     testver = (r1 << 20) + (r2 << 10) + r3;
+     currver = (a1 << 20) + (a2 << 10) + a3;

I wonder why you need this change. Number > 256 is actually only the third number, but we haven't checked that so far. Do you plan to use it actually?

It was causing the minor rev of the kernel I was running to overflow into the major rev, so a test that had a min kver of 4.19 was running and failing on a 4.14.327 kernel.

We try to detect functional changes to avoid problems to compare about

Quoted 19 lines

mainline
and *also* with stable/LTS kernels.

NOTE: checking for 3rd number actually does not work for Debian, which reports
uname -r as: 5.10.0-8-amd64 (the real version is only as an comment in /boot/config-*). If something specific in stable would be needed, it would have
to use tst_kvercmp2() (e.g. utimensat01.c for Ubuntu). Maybe you have a similar
problem in AOSP kernel.

Kind regards,
Petr

Quoted 2 lines
lib/tst_kvercmp.c +0 -0
      return currver - testver;
 }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hi Petr,

Quoted 26 lines · Edward Liaw
Quoted 24 lines · Petr Vorel

Hi Edward,

Quoted 20 lines

Current implementation can only handle revision numbers up to 256. Bump this up to 1024 as some revision numbers are in the 300s.

---
 lib/tst_kvercmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/tst_kvercmp.c +2 -2
index 552920fac..9e1a511af 100644
@@ -92,8 +92,8 @@ int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3)
                       cur_kver);
      }
 
-     testver = (r1 << 16) + (r2 << 8) + r3;
-     currver = (a1 << 16) + (a2 << 8) + a3;
+     testver = (r1 << 20) + (r2 << 10) + r3;
+     currver = (a1 << 20) + (a2 << 10) + a3;
Quoted 5 lines
Quoted 2 lines

I wonder why you need this change. Number > 256 is actually only the third number, but we haven't checked that so far. Do you plan to use it actually?

It was causing the minor rev of the kernel I was running to overflow into the major rev, so a test that had a min kver of 4.19 was running and failing on a 4.14.327 kernel.

I remembered it incorrectly. It was the mmap20 test with min_kver 4.15 that was failing on a 4.14.327 kernel.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Hi Edward,

...

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I wonder why you need this change. Number > 256 is actually only the third number, but we haven't checked that so far. Do you plan to use it actually?

It was causing the minor rev of the kernel I was running to overflow into the major rev, so a test that had a min kver of 4.19 was running and failing on a 4.14.327 kernel.

I remembered it incorrectly. It was the mmap20 test with min_kver 4.15 that was failing on a 4.14.327 kernel.

Good to know, thank for info. It will be merged during this week, once we solve CI issue (should be fairly soon).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Applied
#6 lore raw

Hi Edward,

merged, thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp