All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] refscale: simplify the errexit checkpoint
@ 2021-10-25  3:26 Li Zhijian
  2021-10-25  3:26 ` [PATCH 2/3] refscale: prevent buffer to pr_alert() being too long Li Zhijian
  2021-10-25  3:26 ` [PATCH 3/3] refscale: always log the error message Li Zhijian
  0 siblings, 2 replies; 8+ messages in thread
From: Li Zhijian @ 2021-10-25  3:26 UTC (permalink / raw)
  To: dave, paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu
  Cc: linux-kernel, Li Zhijian

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
V2: permit further simplification # Paul
---
 kernel/rcu/refscale.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 66dc14cf5687..d97427e0b9d5 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -637,7 +637,6 @@ static u64 process_durations(int n)
 // point all the timestamps are printed.
 static int main_func(void *arg)
 {
-	bool errexit = false;
 	int exp, r;
 	char buf1[64];
 	char *buf;
@@ -651,7 +650,7 @@ static int main_func(void *arg)
 	buf = kzalloc(64 + nruns * 32, GFP_KERNEL);
 	if (!result_avg || !buf) {
 		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
-		errexit = true;
+		goto oom_exit;
 	}
 	if (holdoff)
 		schedule_timeout_interruptible(holdoff * HZ);
@@ -663,8 +662,6 @@ static int main_func(void *arg)
 
 	// Start exp readers up per experiment
 	for (exp = 0; exp < nruns && !torture_must_stop(); exp++) {
-		if (errexit)
-			break;
 		if (torture_must_stop())
 			goto end;
 
@@ -698,26 +695,22 @@ static int main_func(void *arg)
 	// Print the average of all experiments
 	SCALEOUT("END OF TEST. Calculating average duration per loop (nanoseconds)...\n");
 
-	if (!errexit) {
-		buf[0] = 0;
-		strcat(buf, "\n");
-		strcat(buf, "Runs\tTime(ns)\n");
-	}
+	buf[0] = 0;
+	strcat(buf, "\n");
+	strcat(buf, "Runs\tTime(ns)\n");
 
 	for (exp = 0; exp < nruns; exp++) {
 		u64 avg;
 		u32 rem;
 
-		if (errexit)
-			break;
 		avg = div_u64_rem(result_avg[exp], 1000, &rem);
 		sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
 		strcat(buf, buf1);
 	}
 
-	if (!errexit)
-		SCALEOUT("%s", buf);
+	SCALEOUT("%s", buf);
 
+oom_exit:
 	// This will shutdown everything including us.
 	if (shutdown) {
 		shutdown_start = 1;
-- 
2.33.0




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

* [PATCH 2/3] refscale: prevent buffer to pr_alert() being too long
  2021-10-25  3:26 [PATCH 1/3] refscale: simplify the errexit checkpoint Li Zhijian
@ 2021-10-25  3:26 ` Li Zhijian
  2021-10-25  3:26 ` [PATCH 3/3] refscale: always log the error message Li Zhijian
  1 sibling, 0 replies; 8+ messages in thread
From: Li Zhijian @ 2021-10-25  3:26 UTC (permalink / raw)
  To: dave, paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu
  Cc: linux-kernel, Li Zhijian, Philip Li, kernel test robot

0Day/LKP observed that the refscale results become incompleted
when a larger nruns(such as 300) is specified.
It seems that printk() can accept < 1024 buffer at once.
Print the buffer if its length exceeds 800 simply.

CC: Philip Li <philip.li@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
V2: shorten the buffer length. # Paul
---
 kernel/rcu/refscale.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index d97427e0b9d5..a4479f00dcdc 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -604,7 +604,7 @@ static u64 process_durations(int n)
 	char *buf;
 	u64 sum = 0;
 
-	buf = kmalloc(128 + nreaders * 32, GFP_KERNEL);
+	buf = kmalloc(800 + 64, GFP_KERNEL);
 	if (!buf)
 		return 0;
 	buf[0] = 0;
@@ -617,13 +617,15 @@ static u64 process_durations(int n)
 
 		if (i % 5 == 0)
 			strcat(buf, "\n");
+		if (strlen(buf) >= 800) {
+			pr_alert("%s", buf);
+			buf[0] = 0;
+		}
 		strcat(buf, buf1);
 
 		sum += rt->last_duration_ns;
 	}
-	strcat(buf, "\n");
-
-	SCALEOUT("%s\n", buf);
+	pr_alert("%s\n", buf);
 
 	kfree(buf);
 	return sum;
@@ -647,7 +649,7 @@ static int main_func(void *arg)
 
 	VERBOSE_SCALEOUT("main_func task started");
 	result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
-	buf = kzalloc(64 + nruns * 32, GFP_KERNEL);
+	buf = kzalloc(800 + 64, GFP_KERNEL);
 	if (!result_avg || !buf) {
 		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
 		goto oom_exit;
@@ -695,10 +697,7 @@ static int main_func(void *arg)
 	// Print the average of all experiments
 	SCALEOUT("END OF TEST. Calculating average duration per loop (nanoseconds)...\n");
 
-	buf[0] = 0;
-	strcat(buf, "\n");
-	strcat(buf, "Runs\tTime(ns)\n");
-
+	pr_alert("Runs\tTime(ns)\n");
 	for (exp = 0; exp < nruns; exp++) {
 		u64 avg;
 		u32 rem;
@@ -706,9 +705,13 @@ static int main_func(void *arg)
 		avg = div_u64_rem(result_avg[exp], 1000, &rem);
 		sprintf(buf1, "%d\t%llu.%03u\n", exp + 1, avg, rem);
 		strcat(buf, buf1);
+		if (strlen(buf) >= 800) {
+			pr_alert("%s", buf);
+			buf[0] = 0;
+		}
 	}
 
-	SCALEOUT("%s", buf);
+	pr_alert("%s", buf);
 
 oom_exit:
 	// This will shutdown everything including us.
-- 
2.33.0




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

* [PATCH 3/3] refscale: always log the error message
  2021-10-25  3:26 [PATCH 1/3] refscale: simplify the errexit checkpoint Li Zhijian
  2021-10-25  3:26 ` [PATCH 2/3] refscale: prevent buffer to pr_alert() being too long Li Zhijian
@ 2021-10-25  3:26 ` Li Zhijian
  2021-10-25  6:12   ` lizhijian
  1 sibling, 1 reply; 8+ messages in thread
From: Li Zhijian @ 2021-10-25  3:26 UTC (permalink / raw)
  To: dave, paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu
  Cc: linux-kernel, Li Zhijian

Generally, error message should be logged anyhow.

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 kernel/rcu/refscale.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index a4479f00dcdc..f055d168365a 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -58,8 +58,8 @@ do {											\
 	}										\
 } while (0)
 
-#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
-	do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
+#define SCALEOUT_ERRSTRING(s, x...) \
+	do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
@@ -651,7 +651,7 @@ static int main_func(void *arg)
 	result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
 	buf = kzalloc(800 + 64, GFP_KERNEL);
 	if (!result_avg || !buf) {
-		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
+		SCALEOUT_ERRSTRING("out of memory");
 		goto oom_exit;
 	}
 	if (holdoff)
@@ -837,7 +837,7 @@ ref_scale_init(void)
 	reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
 			       GFP_KERNEL);
 	if (!reader_tasks) {
-		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
+		SCALEOUT_ERRSTRING("out of memory");
 		firsterr = -ENOMEM;
 		goto unwind;
 	}
-- 
2.33.0




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

* Re: [PATCH 3/3] refscale: always log the error message
  2021-10-25  3:26 ` [PATCH 3/3] refscale: always log the error message Li Zhijian
@ 2021-10-25  6:12   ` lizhijian
  2021-10-26 14:06     ` Paul E. McKenney
  0 siblings, 1 reply; 8+ messages in thread
From: lizhijian @ 2021-10-25  6:12 UTC (permalink / raw)
  To: lizhijian, dave, paulmck, josh, rostedt, mathieu.desnoyers,
	jiangshanlai, joel, rcu
  Cc: linux-kernel



On 25/10/2021 11:26, Li Zhijian wrote:
> Generally, error message should be logged anyhow.
>
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
> ---
>   kernel/rcu/refscale.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
> index a4479f00dcdc..f055d168365a 100644
> --- a/kernel/rcu/refscale.c
> +++ b/kernel/rcu/refscale.c
> @@ -58,8 +58,8 @@ do {											\
>   	}										\
>   } while (0)
>   
> -#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
> -	do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
> +#define SCALEOUT_ERRSTRING(s, x...) \
> +	do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
>   
>   MODULE_LICENSE("GPL");
>   MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
> @@ -651,7 +651,7 @@ static int main_func(void *arg)
>   	result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
>   	buf = kzalloc(800 + 64, GFP_KERNEL);
>   	if (!result_avg || !buf) {
> -		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> +		SCALEOUT_ERRSTRING("out of memory");

'\n' should be added to the last to flush it.



>   		goto oom_exit;
>   	}
>   	if (holdoff)
> @@ -837,7 +837,7 @@ ref_scale_init(void)
>   	reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
>   			       GFP_KERNEL);
>   	if (!reader_tasks) {
> -		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> +		SCALEOUT_ERRSTRING("out of memory");
ditto

Thanks
Zhijian
>   		firsterr = -ENOMEM;
>   		goto unwind;
>   	}

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

* Re: [PATCH 3/3] refscale: always log the error message
  2021-10-25  6:12   ` lizhijian
@ 2021-10-26 14:06     ` Paul E. McKenney
  2021-10-27  5:18       ` lizhijian
  0 siblings, 1 reply; 8+ messages in thread
From: Paul E. McKenney @ 2021-10-26 14:06 UTC (permalink / raw)
  To: lizhijian
  Cc: dave, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu,
	linux-kernel

On Mon, Oct 25, 2021 at 06:12:40AM +0000, lizhijian@fujitsu.com wrote:
> 
> 
> On 25/10/2021 11:26, Li Zhijian wrote:
> > Generally, error message should be logged anyhow.
> >
> > Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
> > ---
> >   kernel/rcu/refscale.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
> > index a4479f00dcdc..f055d168365a 100644
> > --- a/kernel/rcu/refscale.c
> > +++ b/kernel/rcu/refscale.c
> > @@ -58,8 +58,8 @@ do {											\
> >   	}										\
> >   } while (0)
> >   
> > -#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
> > -	do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
> > +#define SCALEOUT_ERRSTRING(s, x...) \
> > +	do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
> >   
> >   MODULE_LICENSE("GPL");
> >   MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
> > @@ -651,7 +651,7 @@ static int main_func(void *arg)
> >   	result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
> >   	buf = kzalloc(800 + 64, GFP_KERNEL);
> >   	if (!result_avg || !buf) {
> > -		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> > +		SCALEOUT_ERRSTRING("out of memory");
> 
> '\n' should be added to the last to flush it.

And there might well be other missing "\n" instances in similar messages
in rcuscale.c, rcutorture.c, scftorture.c, locktorture.c, and torture.c.
Please feel free to send a patch for each file needing this help.

I queued your other three patches for v5.17 (not this coming merge window,
but the one after that), thank you!  I did wordsmith the commit logs,
so please check to see if I messed anything up.

							Thanx, Paul

> >   		goto oom_exit;
> >   	}
> >   	if (holdoff)
> > @@ -837,7 +837,7 @@ ref_scale_init(void)
> >   	reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
> >   			       GFP_KERNEL);
> >   	if (!reader_tasks) {
> > -		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> > +		SCALEOUT_ERRSTRING("out of memory");
> ditto
> 
> Thanks
> Zhijian
> >   		firsterr = -ENOMEM;
> >   		goto unwind;
> >   	}

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

* Re: [PATCH 3/3] refscale: always log the error message
  2021-10-26 14:06     ` Paul E. McKenney
@ 2021-10-27  5:18       ` lizhijian
  2021-10-27  7:21         ` lizhijian
  0 siblings, 1 reply; 8+ messages in thread
From: lizhijian @ 2021-10-27  5:18 UTC (permalink / raw)
  To: paulmck
  Cc: dave, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu,
	linux-kernel



On 26/10/2021 22:06, Paul E. McKenney wrote:
> On Mon, Oct 25, 2021 at 06:12:40AM +0000, lizhijian@fujitsu.com wrote:
>>
>> On 25/10/2021 11:26, Li Zhijian wrote:
>>> Generally, error message should be logged anyhow.
>>>
>>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>>> ---
>>>    kernel/rcu/refscale.c | 8 ++++----
>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
>>> index a4479f00dcdc..f055d168365a 100644
>>> --- a/kernel/rcu/refscale.c
>>> +++ b/kernel/rcu/refscale.c
>>> @@ -58,8 +58,8 @@ do {											\
>>>    	}										\
>>>    } while (0)
>>>    
>>> -#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
>>> -	do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
>>> +#define SCALEOUT_ERRSTRING(s, x...) \
>>> +	do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
>>>    
>>>    MODULE_LICENSE("GPL");
>>>    MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
>>> @@ -651,7 +651,7 @@ static int main_func(void *arg)
>>>    	result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
>>>    	buf = kzalloc(800 + 64, GFP_KERNEL);
>>>    	if (!result_avg || !buf) {
>>> -		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
>>> +		SCALEOUT_ERRSTRING("out of memory");
>> '\n' should be added to the last to flush it.
> And there might well be other missing "\n" instances in similar messages
> in rcuscale.c, rcutorture.c, scftorture.c, locktorture.c, and torture.c.
> Please feel free to send a patch for each file needing this help.

Sure, i will do that.

Thanks
Zhijian

> I queued your other three patches for v5.17 (not this coming merge window,
> but the one after that), thank you!  I did wordsmith the commit logs,
> so please check to see if I messed anything up.
>
> 							Thanx, Paul
>
>>>    		goto oom_exit;
>>>    	}
>>>    	if (holdoff)
>>> @@ -837,7 +837,7 @@ ref_scale_init(void)
>>>    	reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
>>>    			       GFP_KERNEL);
>>>    	if (!reader_tasks) {
>>> -		VERBOSE_SCALEOUT_ERRSTRING("out of memory");
>>> +		SCALEOUT_ERRSTRING("out of memory");
>> ditto
>>
>> Thanks
>> Zhijian
>>>    		firsterr = -ENOMEM;
>>>    		goto unwind;
>>>    	}

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

* Re: [PATCH 3/3] refscale: always log the error message
  2021-10-27  5:18       ` lizhijian
@ 2021-10-27  7:21         ` lizhijian
  2021-10-28 13:30           ` Paul E. McKenney
  0 siblings, 1 reply; 8+ messages in thread
From: lizhijian @ 2021-10-27  7:21 UTC (permalink / raw)
  To: paulmck
  Cc: dave, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu,
	linux-kernel

Hi Paul

During adding the missing '\n', i also found there are some verbose control error message
Should we convert it like [PATCH 3/3] refscale: always log the error message

lizj@FNSTPC: linux$ git grep VERBOSE.*_ERRSTRING
include/linux/torture.h:#define VERBOSE_TOROUT_ERRSTRING(s) \
kernel/locking/locktorture.c: VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory");
kernel/locking/locktorture.c: VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory");
kernel/rcu/rcuscale.c:#define VERBOSE_SCALEOUT_ERRSTRING(s) \
kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!");
kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("out of memory");
kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("out of memory");
kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
kernel/scftorture.c:#define VERBOSE_SCFTORTOUT_ERRSTRING(s, x...) \
kernel/scftorture.c:            VERBOSE_SCFTORTOUT_ERRSTRING("all zero weights makes no sense");
kernel/scftorture.c:            VERBOSE_SCFTORTOUT_ERRSTRING("built as module, weight_resched ignored");
kernel/scftorture.c:            VERBOSE_SCFTORTOUT_ERRSTRING("out of memory");
kernel/torture.c:               VERBOSE_TOROUT_ERRSTRING("Failed to alloc mask");
kernel/torture.c:               VERBOSE_TOROUT_ERRSTRING(f);



Thanks



On 27/10/2021 13:17, Li Zhijian wrote:
>
>
> On 26/10/2021 22:06, Paul E. McKenney wrote:
>> On Mon, Oct 25, 2021 at 06:12:40AM +0000, lizhijian@fujitsu.com wrote:
>>>
>>> On 25/10/2021 11:26, Li Zhijian wrote:
>>>> Generally, error message should be logged anyhow.
>>>>
>>>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
>>>> ---
>>>>    kernel/rcu/refscale.c | 8 ++++----
>>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
>>>> index a4479f00dcdc..f055d168365a 100644
>>>> --- a/kernel/rcu/refscale.c
>>>> +++ b/kernel/rcu/refscale.c
>>>> @@ -58,8 +58,8 @@ do {                                            \
>>>>        }                                        \
>>>>    } while (0)
>>>>    -#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
>>>> -    do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
>>>> +#define SCALEOUT_ERRSTRING(s, x...) \
>>>> +    do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
>>>>       MODULE_LICENSE("GPL");
>>>>    MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
>>>> @@ -651,7 +651,7 @@ static int main_func(void *arg)
>>>>        result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
>>>>        buf = kzalloc(800 + 64, GFP_KERNEL);
>>>>        if (!result_avg || !buf) {
>>>> -        VERBOSE_SCALEOUT_ERRSTRING("out of memory");
>>>> +        SCALEOUT_ERRSTRING("out of memory");
>>> '\n' should be added to the last to flush it.
>> And there might well be other missing "\n" instances in similar messages
>> in rcuscale.c, rcutorture.c, scftorture.c, locktorture.c, and torture.c.
>> Please feel free to send a patch for each file needing this help.
>
> Sure, i will do that.
>
> Thanks
> Zhijian
>
>> I queued your other three patches for v5.17 (not this coming merge window,
>> but the one after that), thank you!  I did wordsmith the commit logs,
>> so please check to see if I messed anything up.
>>
>>                             Thanx, Paul
>>
>>>>            goto oom_exit;
>>>>        }
>>>>        if (holdoff)
>>>> @@ -837,7 +837,7 @@ ref_scale_init(void)
>>>>        reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
>>>>                       GFP_KERNEL);
>>>>        if (!reader_tasks) {
>>>> -        VERBOSE_SCALEOUT_ERRSTRING("out of memory");
>>>> +        SCALEOUT_ERRSTRING("out of memory");
>>> ditto
>>>
>>> Thanks
>>> Zhijian
>>>>            firsterr = -ENOMEM;
>>>>            goto unwind;
>>>>        }
>

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

* Re: [PATCH 3/3] refscale: always log the error message
  2021-10-27  7:21         ` lizhijian
@ 2021-10-28 13:30           ` Paul E. McKenney
  0 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2021-10-28 13:30 UTC (permalink / raw)
  To: lizhijian
  Cc: dave, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, rcu,
	linux-kernel

On Wed, Oct 27, 2021 at 07:21:34AM +0000, lizhijian@fujitsu.com wrote:
> Hi Paul
> 
> During adding the missing '\n', i also found there are some verbose control error message
> Should we convert it like [PATCH 3/3] refscale: always log the error message

These do indeed look like they should always be logged.  Good catches!

							Thanx, Paul

> lizj@FNSTPC: linux$ git grep VERBOSE.*_ERRSTRING
> include/linux/torture.h:#define VERBOSE_TOROUT_ERRSTRING(s) \
> kernel/locking/locktorture.c: VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory");
> kernel/locking/locktorture.c: VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory");
> kernel/rcu/rcuscale.c:#define VERBOSE_SCALEOUT_ERRSTRING(s) \
> kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
> kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
> kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!");
> kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> kernel/rcu/rcuscale.c:          VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
> kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
> kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
> kernel/rcu/rcutorture.c: VERBOSE_TOROUT_ERRSTRING("out of memory");
> kernel/scftorture.c:#define VERBOSE_SCFTORTOUT_ERRSTRING(s, x...) \
> kernel/scftorture.c:            VERBOSE_SCFTORTOUT_ERRSTRING("all zero weights makes no sense");
> kernel/scftorture.c:            VERBOSE_SCFTORTOUT_ERRSTRING("built as module, weight_resched ignored");
> kernel/scftorture.c:            VERBOSE_SCFTORTOUT_ERRSTRING("out of memory");
> kernel/torture.c:               VERBOSE_TOROUT_ERRSTRING("Failed to alloc mask");
> kernel/torture.c:               VERBOSE_TOROUT_ERRSTRING(f);
> 
> 
> 
> Thanks
> 
> 
> 
> On 27/10/2021 13:17, Li Zhijian wrote:
> >
> >
> > On 26/10/2021 22:06, Paul E. McKenney wrote:
> >> On Mon, Oct 25, 2021 at 06:12:40AM +0000, lizhijian@fujitsu.com wrote:
> >>>
> >>> On 25/10/2021 11:26, Li Zhijian wrote:
> >>>> Generally, error message should be logged anyhow.
> >>>>
> >>>> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
> >>>> ---
> >>>>    kernel/rcu/refscale.c | 8 ++++----
> >>>>    1 file changed, 4 insertions(+), 4 deletions(-)
> >>>>
> >>>> diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
> >>>> index a4479f00dcdc..f055d168365a 100644
> >>>> --- a/kernel/rcu/refscale.c
> >>>> +++ b/kernel/rcu/refscale.c
> >>>> @@ -58,8 +58,8 @@ do {                                            \
> >>>>        }                                        \
> >>>>    } while (0)
> >>>>    -#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
> >>>> -    do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
> >>>> +#define SCALEOUT_ERRSTRING(s, x...) \
> >>>> +    do { pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
> >>>>       MODULE_LICENSE("GPL");
> >>>>    MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
> >>>> @@ -651,7 +651,7 @@ static int main_func(void *arg)
> >>>>        result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
> >>>>        buf = kzalloc(800 + 64, GFP_KERNEL);
> >>>>        if (!result_avg || !buf) {
> >>>> -        VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> >>>> +        SCALEOUT_ERRSTRING("out of memory");
> >>> '\n' should be added to the last to flush it.
> >> And there might well be other missing "\n" instances in similar messages
> >> in rcuscale.c, rcutorture.c, scftorture.c, locktorture.c, and torture.c.
> >> Please feel free to send a patch for each file needing this help.
> >
> > Sure, i will do that.
> >
> > Thanks
> > Zhijian
> >
> >> I queued your other three patches for v5.17 (not this coming merge window,
> >> but the one after that), thank you!  I did wordsmith the commit logs,
> >> so please check to see if I messed anything up.
> >>
> >>                             Thanx, Paul
> >>
> >>>>            goto oom_exit;
> >>>>        }
> >>>>        if (holdoff)
> >>>> @@ -837,7 +837,7 @@ ref_scale_init(void)
> >>>>        reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
> >>>>                       GFP_KERNEL);
> >>>>        if (!reader_tasks) {
> >>>> -        VERBOSE_SCALEOUT_ERRSTRING("out of memory");
> >>>> +        SCALEOUT_ERRSTRING("out of memory");
> >>> ditto
> >>>
> >>> Thanks
> >>> Zhijian
> >>>>            firsterr = -ENOMEM;
> >>>>            goto unwind;
> >>>>        }
> >

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

end of thread, other threads:[~2021-10-28 13:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25  3:26 [PATCH 1/3] refscale: simplify the errexit checkpoint Li Zhijian
2021-10-25  3:26 ` [PATCH 2/3] refscale: prevent buffer to pr_alert() being too long Li Zhijian
2021-10-25  3:26 ` [PATCH 3/3] refscale: always log the error message Li Zhijian
2021-10-25  6:12   ` lizhijian
2021-10-26 14:06     ` Paul E. McKenney
2021-10-27  5:18       ` lizhijian
2021-10-27  7:21         ` lizhijian
2021-10-28 13:30           ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.