2021-10-29 09:43:52

by Li Zhijian

[permalink] [raw]
Subject: [PATCH 0/6] 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(-)

--
2.32.0


2021-10-29 09:44:02

by Li Zhijian

[permalink] [raw]
Subject: [PATCH 2/6] scftorture: add missing '\n' to flush message out

add '\n' to macros directly like what torture does to flush message
for each calls

Signed-off-by: Li Zhijian <[email protected]>
---
kernel/scftorture.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 64a08288b1a6..f60a7a240f91 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -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++) {
--
2.32.0

2021-10-29 09:44:11

by Li Zhijian

[permalink] [raw]
Subject: [PATCH 3/6] scftorture: remove unused SCFTORTOUT

no one refers to it any more.

Signed-off-by: Li Zhijian <[email protected]>
---
kernel/scftorture.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index f60a7a240f91..5fb15492999b 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -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)

--
2.32.0

2021-10-29 09:44:49

by Li Zhijian

[permalink] [raw]
Subject: [PATCH 5/6] rcuscale: alwaly log error message

Generally, error message should be logged anyhow.

Signed-off-by: Li Zhijian <[email protected]>
---
kernel/rcu/rcuscale.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 2cc34a22a506..5c8449a8827a 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -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;
}
--
2.32.0

2021-10-29 09:45:11

by Li Zhijian

[permalink] [raw]
Subject: [PATCH 6/6] locktorture,rcutorture,torture: always log error message

Generally, error message should be logged anyhow.

Signed-off-by: Li Zhijian <[email protected]>
---
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(-)

diff --git a/include/linux/torture.h b/include/linux/torture.h
index 0910c5803f35..1d2e6c4c38fa 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -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. */
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 7c5a4a087cc7..6752ce3ac424 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -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;
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index ab4215266ebe..9197ce5c7a7d 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -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;
}
diff --git a/kernel/torture.c b/kernel/torture.c
index bb8f411c974b..ef27a6c82451 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -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);
--
2.32.0

2021-10-29 09:46:46

by Li Zhijian

[permalink] [raw]
Subject: [PATCH 4/6] scftorture: always log error message

Generally, error message should be logged anyhow.

Signed-off-by: Li Zhijian <[email protected]>
---
kernel/scftorture.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index 5fb15492999b..8ef7888d78cc 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -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;
}
--
2.32.0

2021-10-29 16:41:40

by Davidlohr Bueso

[permalink] [raw]
Subject: Re: [PATCH 5/6] rcuscale: alwaly log error message

For the subject you have a typo, I guess you meant 'always'.

Thanks,
Davidlohr

2021-10-29 16:44:22

by Davidlohr Bueso

[permalink] [raw]
Subject: Re: [PATCH 0/6] minor fixes and cleanups in rcuscale and torture tests

On Fri, 29 Oct 2021, Li Zhijian wrote:

>- 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

No particular objection from me.

Acked-by: Davidlohr Bueso <[email protected]>

2021-11-02 16:35:56

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH 4/6] scftorture: always log error message

On Fri, Oct 29, 2021 at 05:40:27PM +0800, Li Zhijian wrote:
> 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

> ---
> kernel/scftorture.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/scftorture.c b/kernel/scftorture.c
> index 5fb15492999b..8ef7888d78cc 100644
> --- a/kernel/scftorture.c
> +++ b/kernel/scftorture.c
> @@ -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;
> }
> --
> 2.32.0
>

2021-11-02 16:38:55

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH 5/6] rcuscale: alwaly log error message

On Fri, Oct 29, 2021 at 05:40:28PM +0800, Li Zhijian wrote:
> 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

> ---
> kernel/rcu/rcuscale.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
> index 2cc34a22a506..5c8449a8827a 100644
> --- a/kernel/rcu/rcuscale.c
> +++ b/kernel/rcu/rcuscale.c
> @@ -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;
> }
> --
> 2.32.0
>

2021-11-03 08:27:19

by Li Zhijian

[permalink] [raw]
Subject: Re: [PATCH 4/6] scftorture: always log error message



On 03/11/2021 00:06, Paul E. McKenney wrote:
> On Fri, Oct 29, 2021 at 05:40:27PM +0800, Li Zhijian wrote:
>> 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.
Glad to know this, i will rebase the rest 2 patches and resubmit them soon.

Thanks
Zhijian


>