minor fixes and cleanups in rcuscale and torture tests
Subsystems (2)
cover minor fixes and cleanups in rcuscale and torture tests
- we added '\n' to the macros directly like what torture does, see include/linux/torture.h
- SCFTORTOUT is unused any more, remove it
- follow up https://lkml.org/lkml/2021/10/24/439, covert all other residuals
Li Zhijian (6):
refscale: add missing '\n' to flush message out
scftorture: add missing '\n' to flush message out
scftorture: Remove unused SCFTORTOUT
scftorture: always log error message
rcuscale: alwaly log error message locktorture,rcutorture,torture: always log error message
include/linux/torture.h | 9 ++------- kernel/locking/locktorture.c | 4 ++-- kernel/rcu/rcuscale.c | 14 +++++++------- kernel/rcu/rcutorture.c | 8 ++++---- kernel/rcu/refscale.c | 11 +++++++---- kernel/scftorture.c | 16 ++++++---------- kernel/torture.c | 4 ++-- 7 files changed, 30 insertions(+), 36 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/6 refscale: add missing '\n' to flush message out
add '\n' to macros directly like what torture does to flush message for each calls
--- kernel/rcu/refscale.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/rcu/refscale.c +7 -4
@@ -44,7 +44,10 @@ pr_alert("%s" SCALE_FLAG s, scale_type, ## x) #define VERBOSE_SCALEOUT(s, x...) \ - do { if (verbose) pr_alert("%s" SCALE_FLAG s, scale_type, ## x); } while (0) + do { \ + if (verbose) \ + pr_alert("%s" SCALE_FLAG s "\n", scale_type, ## x); \ + } while (0) static atomic_t verbose_batch_ctr;
@@ -54,12 +57,12 @@ do { \ (verbose_batched <= 0 || \ !(atomic_inc_return(&verbose_batch_ctr) % verbose_batched))) { \schedule_timeout_uninterruptible (1 ); \ - pr_alert("%s" SCALE_FLAG s, scale_type, ## x); \ + pr_alert("%s" SCALE_FLAG s "\n", scale_type, ## x); \ } \ } while (0) #define SCALEOUT_ERRSTRING(s, x...) \ - do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0) + do { pr_alert("%s" SCALE_FLAG "!!! " s "\n", scale_type, ## x); } while (0)MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Joel Fernandes (Google) <[email protected]>" );
@@ -842,7 +845,7 @@ ref_scale_init(void) goto unwind; } -VERBOSE_SCALEOUT ("Starting %d reader threads\n" , nreaders); +VERBOSE_SCALEOUT ("Starting %d reader threads" , nreaders);for (i =0 ; i < nreaders; i++) { firsterr = torture_create_kthread(ref_scale_reader, (void *)i,
Signature · 1 line
2.32.0
PATCH 2/6 scftorture: add missing '\n' to flush message out
In reply to Li Zhijianadd '\n' to macros directly like what torture does to flush message for each calls
--- kernel/scftorture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/scftorture.c +3 -3
@@ -42,10 +42,10 @@ pr_alert(SCFTORT_FLAG s, ## x) #define VERBOSE_SCFTORTOUT(s, x...) \ - do { if (verbose) pr_alert(SCFTORT_FLAG s, ## x); } while (0) + do { if (verbose) pr_alert(SCFTORT_FLAG s "\n", ## x); } while (0) #define VERBOSE_SCFTORTOUT_ERRSTRING(s, x...) \ - do { if (verbose) pr_alert(SCFTORT_FLAG "!!! " s, ## x); } while (0) + do { if (verbose) pr_alert(SCFTORT_FLAG "!!! " s "\n", ## x); } while (0)MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" );
@@ -629,7 +629,7 @@ static int __init scf_torture_init(void) goto unwind; } -VERBOSE_SCFTORTOUT ("Starting %d smp_call_function() threads\n" , nthreads); +VERBOSE_SCFTORTOUT ("Starting %d smp_call_function() threads" , nthreads);atomic_set (&n_started, nthreads);for (i =0 ; i < nthreads; i++) {
Signature · 1 line
2.32.0
PATCH 3/6 scftorture: remove unused SCFTORTOUT
In reply to Li Zhijianno one refers to it any more.
--- kernel/scftorture.c | 3 --- 1 file changed, 3 deletions(-)
kernel/scftorture.c +0 -3
@@ -38,9 +38,6 @@#define SCFTORT_STRING "scftorture"#define SCFTORT_FLAG SCFTORT_STRING ": " -#define SCFTORTOUT(s, x...) \ - pr_alert(SCFTORT_FLAG s, ## x) - #define VERBOSE_SCFTORTOUT(s, x...) \ do { if (verbose) pr_alert(SCFTORT_FLAG s "\n", ## x); } while (0)
Signature · 1 line
2.32.0
PATCH 4/6 scftorture: always log error message
In reply to Li ZhijianGenerally, error message should be logged anyhow.
--- kernel/scftorture.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
kernel/scftorture.c +4 -5
@@ -41,8 +41,7 @@ #define VERBOSE_SCFTORTOUT(s, x...) \ do { if (verbose) pr_alert(SCFTORT_FLAG s "\n", ## x); } while (0) -#define VERBOSE_SCFTORTOUT_ERRSTRING(s, x...) \ - do { if (verbose) pr_alert(SCFTORT_FLAG "!!! " s "\n", ## x); } while (0) +#define SCFTORTOUT_ERRSTRING(s, x...) pr_alert(SCFTORT_FLAG "!!! " s "\n", ## x)MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" );
@@ -583,14 +582,14 @@ static int __init scf_torture_init(void)if (weight_single1 ==0 && weight_single_rpc1 ==0 && weight_single_wait1 ==0 && weight_many1 ==0 && weight_many_wait1 ==0 && weight_all1 ==0 && weight_all_wait1 ==0 ) { -VERBOSE_SCFTORTOUT_ERRSTRING ("all zero weights makes no sense" ); +SCFTORTOUT_ERRSTRING ("all zero weights makes no sense" ); firsterr = -EINVAL ; goto unwind; }if (IS_BUILTIN (CONFIG_SCF_TORTURE_TEST ))scf_sel_add (weight_resched1,SCF_PRIM_RESCHED , false);else if (weight_resched1) -VERBOSE_SCFTORTOUT_ERRSTRING ("built as module, weight_resched ignored" ); +SCFTORTOUT_ERRSTRING ("built as module, weight_resched ignored" );scf_sel_add (weight_single1,SCF_PRIM_SINGLE , false);scf_sel_add (weight_single_rpc1,SCF_PRIM_SINGLE_RPC , true);scf_sel_add (weight_single_wait1,SCF_PRIM_SINGLE , true);
@@ -621,7 +620,7 @@ static int __init scf_torture_init(void) nthreads =num_online_cpus (); scf_stats_p =kcalloc (nthreads,sizeof (scf_stats_p[0 ]),GFP_KERNEL );if (!scf_stats_p) { -VERBOSE_SCFTORTOUT_ERRSTRING ("out of memory" ); +SCFTORTOUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }
Signature · 1 line
2.32.0
Paul E. McKenney
maintainerRe: [PATCH 4/6] scftorture: always log error message
Quoted 3 lines · Li Zhijian
Generally, error message should be logged anyhow.
Signed-off-by Li Zhijian <[email protected]>
I have queued the patches up to this point for the v5.17 merge window (not the current one, but the next one).
This one does not apply. It looks like you created it against mainline rather than -rcu. You can learn about the -rcu tree and its habits here:
https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/rcutodo.html
Please port this patch to -rcu so that I can pull it in without conflicting with patches in -rcu.
Thanx, Paul
Quoted 47 lines
--- kernel/scftorture.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)kernel/scftorture.c +4
-5@@ -41,8 +41,7 @@ #define VERBOSE_SCFTORTOUT(s, x...) \ do { if (verbose) pr_alert(SCFTORT_FLAG s "\n", ## x); } while (0) -#define VERBOSE_SCFTORTOUT_ERRSTRING(s, x...) \ - do { if (verbose) pr_alert(SCFTORT_FLAG "!!! " s "\n", ## x); } while (0) +#define SCFTORTOUT_ERRSTRING(s, x...) pr_alert(SCFTORT_FLAG "!!! " s "\n", ## x)MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" );@@ -583,14 +582,14 @@ static int __init scf_torture_init(void)if (weight_single1 ==0 && weight_single_rpc1 ==0 && weight_single_wait1 ==0 && weight_many1 ==0 && weight_many_wait1 ==0 && weight_all1 ==0 && weight_all_wait1 ==0 ) { -VERBOSE_SCFTORTOUT_ERRSTRING ("all zero weights makes no sense" ); +SCFTORTOUT_ERRSTRING ("all zero weights makes no sense" ); firsterr = -EINVAL ; goto unwind; }if (IS_BUILTIN (CONFIG_SCF_TORTURE_TEST ))scf_sel_add (weight_resched1,SCF_PRIM_RESCHED , false);else if (weight_resched1) -VERBOSE_SCFTORTOUT_ERRSTRING ("built as module, weight_resched ignored" ); +SCFTORTOUT_ERRSTRING ("built as module, weight_resched ignored" );scf_sel_add (weight_single1,SCF_PRIM_SINGLE , false);scf_sel_add (weight_single_rpc1,SCF_PRIM_SINGLE_RPC , true);scf_sel_add (weight_single_wait1,SCF_PRIM_SINGLE , true);@@ -621,7 +620,7 @@ static int __init scf_torture_init(void) nthreads =num_online_cpus (); scf_stats_p =kcalloc (nthreads,sizeof (scf_stats_p[0 ]),GFP_KERNEL );if (!scf_stats_p) { -VERBOSE_SCFTORTOUT_ERRSTRING ("out of memory" ); +SCFTORTOUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }Signature · 1 line
2.32.0
Re: [PATCH 4/6] scftorture: always log error message
Quoted 7 lines · Paul E. McKenney
Quoted 3 lines · Li Zhijian
Generally, error message should be logged anyhow.
Signed-off-by Li Zhijian<[email protected]>I have queued the patches up to this point for the v5.17 merge window (not the current one, but the next one).
Quoted 7 lines
This one does not apply. It looks like you created it against mainline rather than -rcu. You can learn about the -rcu tree and its habits here:
https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/rcutodo.html
Please port this patch to -rcu so that I can pull it in without conflicting with patches in -rcu.
Glad to know this, i will rebase the rest 2 patches and resubmit them soon.
Thanks
Zhijian
Quoted 1 line
PATCH 5/6 rcuscale: alwaly log error message
In reply to Li ZhijianGenerally, error message should be logged anyhow.
--- kernel/rcu/rcuscale.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
kernel/rcu/rcuscale.c +7 -7
@@ -50,8 +50,8 @@ MODULE_AUTHOR("Paul E. McKenney <[email protected]>"); pr_alert("%s" SCALE_FLAG " %s\n", scale_type, s)#define VERBOSE_SCALEOUT_STRING (s) \ do { if (verbose) pr_alert("%s" SCALE_FLAG " %s\n", scale_type, s); } while (0) -#define VERBOSE_SCALEOUT_ERRSTRING (s) \ - do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! %s\n", scale_type, s); } while (0) +#define SCALEOUT_ERRSTRING (s) \ + pr_alert("%s" SCALE_FLAG "!!! %s\n", scale_type, s)/* * The intended use cases for the nreaders and nwriters module parameters
@@ -514,11 +514,11 @@ rcu_scale_cleanup(void)* during the mid-boot phase, so have to wait till the end. */ if (rcu_gp_is_expedited () && !rcu_gp_is_normal () && !gp_exp) -VERBOSE_SCALEOUT_ERRSTRING ("All grace periods expedited, no normal ones to measure!" ); +SCALEOUT_ERRSTRING ("All grace periods expedited, no normal ones to measure!" );if (rcu_gp_is_normal () && gp_exp) -VERBOSE_SCALEOUT_ERRSTRING ("All grace periods normal, no expedited ones to measure!" ); +SCALEOUT_ERRSTRING ("All grace periods normal, no expedited ones to measure!" );if (gp_exp && gp_async) -VERBOSE_SCALEOUT_ERRSTRING ("No expedited async GPs, so went with async!" ); +SCALEOUT_ERRSTRING ("No expedited async GPs, so went with async!" );if (torture_cleanup_begin ())return ;
@@ -845,7 +845,7 @@ rcu_scale_init(void) reader_tasks =kcalloc (nrealreaders,sizeof (reader_tasks[0 ]),GFP_KERNEL );if (reader_tasks ==NULL ) { -VERBOSE_SCALEOUT_ERRSTRING ("out of memory" ); +SCALEOUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }
@@ -865,7 +865,7 @@ rcu_scale_init(void)kcalloc (nrealwriters,sizeof (*writer_n_durations),GFP_KERNEL );if (!writer_tasks || !writer_durations || !writer_n_durations) { -VERBOSE_SCALEOUT_ERRSTRING ("out of memory" ); +SCALEOUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }
Signature · 1 line
2.32.0
Davidlohr Bueso
maintainerRe: [PATCH 5/6] rcuscale: alwaly log error message
For the subject you have a typo, I guess you meant 'always'.
Thanks,
Davidlohr
Paul E. McKenney
maintainerRe: [PATCH 5/6] rcuscale: alwaly log error message
In reply to Li ZhijianQuoted 3 lines · Li Zhijian
Generally, error message should be logged anyhow.
Signed-off-by Li Zhijian <[email protected]>
And I queued this one, thank you!
The last patch also need to be ported to -rcu. Please port it and the other one and resubmit them.
Thanx, Paul
Quoted 55 lines
--- kernel/rcu/rcuscale.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)kernel/rcu/rcuscale.c +7
-7@@ -50,8 +50,8 @@ MODULE_AUTHOR("Paul E. McKenney <[email protected]>"); pr_alert("%s" SCALE_FLAG " %s\n", scale_type, s)#define VERBOSE_SCALEOUT_STRING (s) \ do { if (verbose) pr_alert("%s" SCALE_FLAG " %s\n", scale_type, s); } while (0) -#define VERBOSE_SCALEOUT_ERRSTRING (s) \ - do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! %s\n", scale_type, s); } while (0) +#define SCALEOUT_ERRSTRING (s) \ + pr_alert("%s" SCALE_FLAG "!!! %s\n", scale_type, s)/* * The intended use cases for the nreaders and nwriters module parameters @@ -514,11 +514,11 @@ rcu_scale_cleanup(void)* during the mid-boot phase, so have to wait till the end. */ if (rcu_gp_is_expedited () && !rcu_gp_is_normal () && !gp_exp) -VERBOSE_SCALEOUT_ERRSTRING ("All grace periods expedited, no normal ones to measure!" ); +SCALEOUT_ERRSTRING ("All grace periods expedited, no normal ones to measure!" );if (rcu_gp_is_normal () && gp_exp) -VERBOSE_SCALEOUT_ERRSTRING ("All grace periods normal, no expedited ones to measure!" ); +SCALEOUT_ERRSTRING ("All grace periods normal, no expedited ones to measure!" );if (gp_exp && gp_async) -VERBOSE_SCALEOUT_ERRSTRING ("No expedited async GPs, so went with async!" ); +SCALEOUT_ERRSTRING ("No expedited async GPs, so went with async!" );if (torture_cleanup_begin ())return ;@@ -845,7 +845,7 @@ rcu_scale_init(void) reader_tasks =kcalloc (nrealreaders,sizeof (reader_tasks[0 ]),GFP_KERNEL );if (reader_tasks ==NULL ) { -VERBOSE_SCALEOUT_ERRSTRING ("out of memory" ); +SCALEOUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }@@ -865,7 +865,7 @@ rcu_scale_init(void)kcalloc (nrealwriters,sizeof (*writer_n_durations),GFP_KERNEL );if (!writer_tasks || !writer_durations || !writer_n_durations) { -VERBOSE_SCALEOUT_ERRSTRING ("out of memory" ); +SCALEOUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }Signature · 1 line
2.32.0
PATCH 6/6 locktorture,rcutorture,torture: always log error message
In reply to Li ZhijianGenerally, error message should be logged anyhow.
--- include/linux/torture.h | 9 ++------- kernel/locking/locktorture.c | 4 ++-- kernel/rcu/rcutorture.c | 8 ++++---- kernel/torture.c | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-)
include/linux/torture.h +2 -7
@@ -38,13 +38,8 @@ do { \pr_alert ("%s" TORTURE_FLAG " %s\n" , torture_type, s); \ } \ } while (0) -#define VERBOSE_TOROUT_ERRSTRING (s) \ -do { \ - if (verbose) { \ - verbose_torout_sleep(); \ - pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); \ - } \ -} while (0) +#define TOROUT_ERRSTRING (s) \ + pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s)void verbose_torout_sleep (void );/* Definitions for online/offline exerciser. */
kernel/locking/locktorture.c +2 -2
@@ -1047,7 +1047,7 @@ static int __init lock_torture_init(void)sizeof (writer_tasks[0 ]), GFP_KERNEL);if (writer_tasks ==NULL ) { -VERBOSE_TOROUT_ERRSTRING ("writer_tasks: Out of memory" ); +TOROUT_ERRSTRING ("writer_tasks: Out of memory" ); firsterr = -ENOMEM ; goto unwind; }
@@ -1058,7 +1058,7 @@ static int __init lock_torture_init(void)sizeof (reader_tasks[0 ]), GFP_KERNEL);if (reader_tasks ==NULL ) { -VERBOSE_TOROUT_ERRSTRING ("reader_tasks: Out of memory" ); +TOROUT_ERRSTRING ("reader_tasks: Out of memory" );kfree (writer_tasks); writer_tasks =NULL ; firsterr = -ENOMEM ;
kernel/rcu/rcutorture.c +4 -4
@@ -2717,7 +2717,7 @@ static int rcu_torture_read_exit(void *unused) &trs,"%s" , "rcu_torture_read_exit_child");if (IS_ERR (tsp)) { -VERBOSE_TOROUT_ERRSTRING ("out of memory" ); +TOROUT_ERRSTRING ("out of memory" ); errexit = true; tsp =NULL ;break ;
@@ -3044,7 +3044,7 @@ rcu_torture_init(void)sizeof (fakewriter_tasks[0 ]), GFP_KERNEL);if (fakewriter_tasks ==NULL ) { -VERBOSE_TOROUT_ERRSTRING ("out of memory" ); +TOROUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }
@@ -3060,7 +3060,7 @@ rcu_torture_init(void) rcu_torture_reader_mbchk =kcalloc (nrealreaders,sizeof (*rcu_torture_reader_mbchk),GFP_KERNEL );if (!reader_tasks || !rcu_torture_reader_mbchk) { -VERBOSE_TOROUT_ERRSTRING ("out of memory" ); +TOROUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }
@@ -3079,7 +3079,7 @@ rcu_torture_init(void)if (nrealnocbers >0 ) { nocb_tasks =kcalloc (nrealnocbers,sizeof (nocb_tasks[0 ]),GFP_KERNEL );if (nocb_tasks ==NULL ) { -VERBOSE_TOROUT_ERRSTRING ("out of memory" ); +TOROUT_ERRSTRING ("out of memory" ); firsterr = -ENOMEM ; goto unwind; }
kernel/torture.c +2 -2
@@ -570,7 +570,7 @@ int torture_shuffle_init(long shuffint) shuffle_idle_cpu =-1 ;if (!alloc_cpumask_var (&shuffle_tmp_mask,GFP_KERNEL )) { -VERBOSE_TOROUT_ERRSTRING ("Failed to alloc mask" ); +TOROUT_ERRSTRING ("Failed to alloc mask" );return -ENOMEM ; }
@@ -934,7 +934,7 @@ int _torture_create_kthread(int (*fn)(void *arg), void *arg, char *s, char *m, *tp =kthread_run (fn, arg,"%s" , s);if (IS_ERR (*tp)) { ret =PTR_ERR (*tp); -VERBOSE_TOROUT_ERRSTRING (f); +TOROUT_ERRSTRING (f); *tp =NULL ; }torture_shuffle_task_register (*tp);
Signature · 1 line
2.32.0
Quoted 6 lines · Li Zhijian
- we added '\n' to the macros directly like what torture does, see
include/linux/torture.h
- SCFTORTOUT is unused any more, remove it
- follow up https://lkml.org/lkml/2021/10/24/439, covert all other residuals
Quoted 7 lines
Li Zhijian (6):
refscale: add missing '\n' to flush message out
scftorture: add missing '\n' to flush message out
scftorture: Remove unused SCFTORTOUT
scftorture: always log error message
rcuscale: alwaly log error message locktorture,rcutorture,torture: always log error message
No particular objection from me.