From a2c375789aa6c83fc85b8f528ee6d7d5f5666941 Mon Sep 17 00:00:00 2001 From: Zhan Xusheng Date: Wed, 23 Sep 2026 22:49:36 +0800 Subject: [PATCH] sysctl: Add jiffies converter entries to the test module lib/test_sysctl.c covers proc_dointvec(), proc_douintvec(), proc_dostring(), proc_do_large_bitmap() and proc_dou8vec_minmax(), but none of the jiffies converters. Their int paths report the sign separately from the magnitude, which is a shape the existing entries do not exercise at all. Add one entry per affected int converter: proc_dointvec_jiffies(), proc_dointvec_ms_jiffies() and proc_dointvec_userhz_jiffies(). Each is seeded with HZ jiffies, which is one second in every converter's own unit, so the three read back as 1, 1000 and 100 respectively. Signed-off-by: Zhan Xusheng Reviewed-by: Bradley Morgan Tested-by: Bradley Morgan # POWER10 Signed-off-by: Joel Granados --- lib/test_sysctl.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c index dd795979558a..65ce42346170 100644 --- a/lib/test_sysctl.c +++ b/lib/test_sysctl.c @@ -15,6 +15,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -48,6 +49,10 @@ struct test_sysctl_data { int boot_int; + int int_jiffies; + int int_ms_jiffies; + int int_userhz_jiffies; + unsigned int uint_0001; char string_0001[65]; @@ -67,6 +72,11 @@ static struct test_sysctl_data test_data = { .boot_int = 0, + /* One second in each converter's unit; all three store HZ jiffies. */ + .int_jiffies = HZ, + .int_ms_jiffies = HZ, + .int_userhz_jiffies = HZ, + .uint_0001 = 314, .string_0001 = "(none)", @@ -113,6 +123,27 @@ static const struct ctl_table test_table[] = { .extra1 = SYSCTL_ZERO, .extra2 = SYSCTL_ONE, }, + { + .procname = "int_jiffies", + .data = &test_data.int_jiffies, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_jiffies, + }, + { + .procname = "int_ms_jiffies", + .data = &test_data.int_ms_jiffies, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_ms_jiffies, + }, + { + .procname = "int_userhz_jiffies", + .data = &test_data.int_userhz_jiffies, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_userhz_jiffies, + }, { .procname = "uint_0001", .data = &test_data.uint_0001,