* [PATCH 1/2] rcuscale: Do a proper cleanup if kfree_scale_init() fails
@ 2024-10-24 16:45 Uladzislau Rezki (Sony)
2024-10-24 16:45 ` [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat Uladzislau Rezki (Sony)
0 siblings, 1 reply; 5+ messages in thread
From: Uladzislau Rezki (Sony) @ 2024-10-24 16:45 UTC (permalink / raw)
To: Paul E . McKenney
Cc: Frederic Weisbecker, RCU, LKML, Neeraj upadhyay, Boqun Feng,
Joel Fernandes, Uladzislau Rezki, Oleksiy Avramchenko,
Dan Carpenter
A static analyzer for C, Smatch, reports and triggers below
warnings:
kernel/rcu/rcuscale.c:1215 rcu_scale_init()
warn: inconsistent returns 'global &fullstop_mutex'.
The checker complains about, we do not unlock the "fullstop_mutex"
mutex, in case of hitting below error path:
<snip>
...
if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) {
pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n");
WARN_ON_ONCE(1);
return -1;
^^^^^^^^^^
...
<snip>
it happens because "-1" is returned right away instead of
doing a proper unwinding.
Fix it by jumping to "unwind" label instead of returning -1.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/rcu/ZxfTrHuEGtgnOYWp@pc636/T/
Fixes: 084e04fff160 ("rcuscale: Add laziness and kfree tests")
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
kernel/rcu/rcuscale.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 6d37596deb1f..de7d511e6be4 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -890,13 +890,13 @@ kfree_scale_init(void)
if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) {
pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n");
WARN_ON_ONCE(1);
- return -1;
+ goto unwind;
}
if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start > 3 * HZ)) {
pr_alert("ERROR: call_rcu() CBs are being too lazy!\n");
WARN_ON_ONCE(1);
- return -1;
+ goto unwind;
}
}
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat
2024-10-24 16:45 [PATCH 1/2] rcuscale: Do a proper cleanup if kfree_scale_init() fails Uladzislau Rezki (Sony)
@ 2024-10-24 16:45 ` Uladzislau Rezki (Sony)
2024-10-24 20:28 ` Paul E. McKenney
0 siblings, 1 reply; 5+ messages in thread
From: Uladzislau Rezki (Sony) @ 2024-10-24 16:45 UTC (permalink / raw)
To: Paul E . McKenney
Cc: Frederic Weisbecker, RCU, LKML, Neeraj upadhyay, Boqun Feng,
Joel Fernandes, Uladzislau Rezki, Oleksiy Avramchenko
There are two places where WARN_ON_ONCE() is called two times
in the error paths. One which is encapsulated into if() condition
and another one, which is unnecessary, is placed in the brackets.
Remove an extra WARN_ON_ONCE() splat which is in brackets.
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
kernel/rcu/rcuscale.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index de7d511e6be4..1d8bb603c289 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -889,13 +889,11 @@ kfree_scale_init(void)
if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) {
pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n");
- WARN_ON_ONCE(1);
goto unwind;
}
if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start > 3 * HZ)) {
pr_alert("ERROR: call_rcu() CBs are being too lazy!\n");
- WARN_ON_ONCE(1);
goto unwind;
}
}
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat
2024-10-24 16:45 ` [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat Uladzislau Rezki (Sony)
@ 2024-10-24 20:28 ` Paul E. McKenney
2024-10-25 9:33 ` Uladzislau Rezki
2024-10-28 16:07 ` Frederic Weisbecker
0 siblings, 2 replies; 5+ messages in thread
From: Paul E. McKenney @ 2024-10-24 20:28 UTC (permalink / raw)
To: Uladzislau Rezki (Sony)
Cc: Frederic Weisbecker, RCU, LKML, Neeraj upadhyay, Boqun Feng,
Joel Fernandes, Oleksiy Avramchenko
On Thu, Oct 24, 2024 at 06:45:58PM +0200, Uladzislau Rezki (Sony) wrote:
> There are two places where WARN_ON_ONCE() is called two times
> in the error paths. One which is encapsulated into if() condition
> and another one, which is unnecessary, is placed in the brackets.
>
> Remove an extra WARN_ON_ONCE() splat which is in brackets.
>
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
For both:
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> kernel/rcu/rcuscale.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
> index de7d511e6be4..1d8bb603c289 100644
> --- a/kernel/rcu/rcuscale.c
> +++ b/kernel/rcu/rcuscale.c
> @@ -889,13 +889,11 @@ kfree_scale_init(void)
>
> if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) {
> pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n");
> - WARN_ON_ONCE(1);
> goto unwind;
> }
>
> if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start > 3 * HZ)) {
> pr_alert("ERROR: call_rcu() CBs are being too lazy!\n");
> - WARN_ON_ONCE(1);
> goto unwind;
> }
> }
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat
2024-10-24 20:28 ` Paul E. McKenney
@ 2024-10-25 9:33 ` Uladzislau Rezki
2024-10-28 16:07 ` Frederic Weisbecker
1 sibling, 0 replies; 5+ messages in thread
From: Uladzislau Rezki @ 2024-10-25 9:33 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Uladzislau Rezki (Sony), Frederic Weisbecker, RCU, LKML,
Neeraj upadhyay, Boqun Feng, Joel Fernandes, Oleksiy Avramchenko
On Thu, Oct 24, 2024 at 01:28:24PM -0700, Paul E. McKenney wrote:
> On Thu, Oct 24, 2024 at 06:45:58PM +0200, Uladzislau Rezki (Sony) wrote:
> > There are two places where WARN_ON_ONCE() is called two times
> > in the error paths. One which is encapsulated into if() condition
> > and another one, which is unnecessary, is placed in the brackets.
> >
> > Remove an extra WARN_ON_ONCE() splat which is in brackets.
> >
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
>
> For both:
>
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
>
Thank you :)
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat
2024-10-24 20:28 ` Paul E. McKenney
2024-10-25 9:33 ` Uladzislau Rezki
@ 2024-10-28 16:07 ` Frederic Weisbecker
1 sibling, 0 replies; 5+ messages in thread
From: Frederic Weisbecker @ 2024-10-28 16:07 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Uladzislau Rezki (Sony), RCU, LKML, Neeraj upadhyay, Boqun Feng,
Joel Fernandes, Oleksiy Avramchenko
Le Thu, Oct 24, 2024 at 01:28:24PM -0700, Paul E. McKenney a écrit :
> On Thu, Oct 24, 2024 at 06:45:58PM +0200, Uladzislau Rezki (Sony) wrote:
> > There are two places where WARN_ON_ONCE() is called two times
> > in the error paths. One which is encapsulated into if() condition
> > and another one, which is unnecessary, is placed in the brackets.
> >
> > Remove an extra WARN_ON_ONCE() splat which is in brackets.
> >
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
>
> For both:
>
> Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
Both applied!
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-28 16:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-24 16:45 [PATCH 1/2] rcuscale: Do a proper cleanup if kfree_scale_init() fails Uladzislau Rezki (Sony)
2024-10-24 16:45 ` [PATCH 2/2] rcuscale: Remove redundant WARN_ON_ONCE() splat Uladzislau Rezki (Sony)
2024-10-24 20:28 ` Paul E. McKenney
2024-10-25 9:33 ` Uladzislau Rezki
2024-10-28 16:07 ` Frederic Weisbecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox