lkml.org 
[lkml]   [2017]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] rcutorture: Add usage warnings for parameters gp_normal and gp_exp
On Wed, Dec 06, 2017 at 06:51:07PM +0800, lianglihao@huawei.com wrote:
> From: Lihao Liang <lianglihao@huawei.com>
>
> In rcu_torture_fakewriter(), when param gp_normal is equal to
> gp_exp (even when they are false), both cur_ops->sync() and
> cur_ops->exp_sync() may be invoked. This commit checks that
> if any of them is NULL, it will print out a warning message.
> It also emits a warning if gp_normal is true but cur_ops->sync()
> is NULL.
>
> Signed-off-by: Lihao Liang <lianglihao@huawei.com>

Queued for review and testing, thank you! Passes light rcutorture
testing.

Thanx, Paul

> ---
>
> I think the last else-if block is redundant and I choose to include it
> for completeness. In addition, it may be better to have more informative
> warning messages for the new if-else blocks. Feel free to revise them.
>
> kernel/rcu/rcutorture.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> index d1b64dc..d2abebd 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -937,6 +937,16 @@ rcu_torture_writer(void *arg)
> synctype[nsynctypes++] = RTWS_SYNC;
> else if (gp_sync && !cur_ops->sync)
> pr_alert("%s: gp_sync without primitives.\n", __func__);
> + if (gp_normal == gp_exp) {
> + if (!cur_ops->sync)
> + pr_alert("%s: gp_sync without primitives.\n", __func__);
> + if (!cur_ops->exp_sync)
> + pr_alert("%s: gp_exp without primitives.\n", __func__);
> + } else if (gp_normal && !cur_ops->sync) {
> + pr_alert("%s: gp_sync without primitives.\n", __func__);
> + } else if (gp_exp && !cur_ops->exp_sync) {
> + pr_alert("%s: gp_exp without primitives.\n", __func__);
> + }
> if (WARN_ONCE(nsynctypes == 0,
> "rcu_torture_writer: No update-side primitives.\n")) {
> /*
> --
> 2.7.4
>

\
 
 \ /
  Last update: 2017-12-07 01:23    [W:0.038 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site