mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: "paulmck@kernel.org" <paulmck@kernel.org>
Cc: qiang Z <qiang.zhang1211@gmail.com>,
	"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-team@meta.com" <kernel-team@meta.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>
Subject: Re: [PATCH 5/9] rcutorture: Add tests for SRCU up/down reader primitives
Date: Thu, 27 Mar 2025 17:08:35 +0000	[thread overview]
Message-ID: <1F552A07-5799-4228-ACE2-0A8706F1D814@nvidia.com> (raw)
In-Reply-To: <f7349c37-1496-4d23-8863-3cb75b538a23@paulmck-laptop>



> On Mar 27, 2025, at 12:48 PM, Paul E. McKenney <paulmck@kernel.org> wrote:
> 
> On Thu, Mar 27, 2025 at 12:22:12PM -0400, Joel Fernandes wrote:
>> Paul,
>> 
>>>> If rtorsu_hrt timer is still in timer_queue, invoke hrtimer_cancel() will
>>>> remove it from timerqueue and directly return, so the rcu_torture_updown_hrt()
>>>> will not be executed and the rtorsup->rtorsu_inuse cannot be set false.
>>>> 
>>>> How about modifying it as follows:
>>>> 
>>>> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
>>>> index 04d7a2173b95..ecf3d3797f7e 100644
>>>> --- a/kernel/rcu/rcutorture.c
>>>> +++ b/kernel/rcu/rcutorture.c
>>>> @@ -2502,8 +2502,7 @@ static void rcu_torture_updown_cleanup(void)
>>>>        for (rtorsup = updownreaders; rtorsup <
>>>> &updownreaders[n_up_down]; rtorsup++) {
>>>>                if (!smp_load_acquire(&rtorsup->rtorsu_inuse))
>>>>                        continue;
>>>> -               (void)hrtimer_cancel(&rtorsup->rtorsu_hrt);
>>>> -               if (WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
>>>> +               if (hrtimer_cancel(&rtorsup->rtorsu_hrt) ||
>>>> WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
>>>> 
>>>> rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs,
>>>> -1);
>>>>                        WARN_ONCE(rtorsup->rtorsu_nups >=
>>>> rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n",
>>>> __func__, rtorsup - updownreaders);
>>>>                        rtorsup->rtorsu_nups++;
>>> 
>>> Good eyes, thank you!  I have applied this fix with attribution.
>> 
>> Could you re-send the series, or should I apply the fix the patch myself? Or
>> provide the new patch inline here.
> 
> Your choice, just let me know.  If you have modified any of the other
> patches in that series, it will probably be easier for you if I either
> resend just that one patch or if you apply the changes.  If you haven't
> done any modifications, it might be easier for you if I re-sent the
> series.

Thanks, you could resend as I have not changed other patches.

- Joel

> 
> I have the delta patch below, which I have pushed out for kernel test
> robot ministrations and which I expect to merge into the original
> later today.
> 
>                            Thanx, Paul
> 
> ------------------------------------------------------------------------
> 
> commit 55fcac5cb3fc96479d935db648c98503cb0a944b
> Author: Paul E. McKenney <paulmck@kernel.org>
> Date:   Thu Mar 27 07:29:48 2025 -0700
> 
>    squash! rcutorture: Add tests for SRCU up/down reader primitives
> 
>    [ paulmck: Apply Z qiang feedback. ]
> 
>    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> 
> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> index 04d7a2173b95d..ecf3d3797f7e1 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -2502,8 +2502,7 @@ static void rcu_torture_updown_cleanup(void)
>    for (rtorsup = updownreaders; rtorsup < &updownreaders[n_up_down]; rtorsup++) {
>        if (!smp_load_acquire(&rtorsup->rtorsu_inuse))
>            continue;
> -        (void)hrtimer_cancel(&rtorsup->rtorsu_hrt);
> -        if (WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
> +        if (hrtimer_cancel(&rtorsup->rtorsu_hrt) || WARN_ON_ONCE(rtorsup->rtorsu_inuse)) {
>            rcu_torture_one_read_end(&rtorsup->rtorsu_rtors, &rtorsup->rtorsu_trs, -1);
>            WARN_ONCE(rtorsup->rtorsu_nups >= rtorsup->rtorsu_ndowns, "%s: Up without matching down #%zu.\n", __func__, rtorsup - updownreaders);
>            rtorsup->rtorsu_nups++;

  reply	other threads:[~2025-03-27 17:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 18:38 [PATCH 0/9] RCU torture-test changes for v6.16 Paul E. McKenney
2025-03-10 18:38 ` [PATCH 1/9] rcutorture: Make srcu_lockdep.sh check kernel Kconfig Paul E. McKenney
2025-03-10 18:38 ` [PATCH 2/9] rcutorture: Make srcu_lockdep.sh check reader-conflict handling Paul E. McKenney
2025-03-10 18:38 ` [PATCH 3/9] rcutorture: Split out beginning and end from rcu_torture_one_read() Paul E. McKenney
2025-03-10 18:38 ` [PATCH 4/9] rcutorture: Make torture.sh --do-rt use CONFIG_PREEMPT_RT Paul E. McKenney
2025-03-10 18:38 ` [PATCH 5/9] rcutorture: Add tests for SRCU up/down reader primitives Paul E. McKenney
2025-03-27  3:26   ` Z qiang
2025-03-27 14:30     ` Paul E. McKenney
2025-03-27 16:22       ` Joel Fernandes
2025-03-27 16:48         ` Paul E. McKenney
2025-03-27 17:08           ` Joel Fernandes [this message]
2025-03-27 17:18             ` Paul E. McKenney
2025-03-10 18:38 ` [PATCH 6/9] rcutorture: Pull rcu_torture_updown() loop body into new function Paul E. McKenney
2025-03-10 18:38 ` [PATCH 7/9] rcutorture: Comment invocations of tick_dep_set_task() Paul E. McKenney
2025-03-10 18:38 ` [PATCH 8/9] rcutorture: Complain if an ->up_read() is delayed more than 10 seconds Paul E. McKenney
2025-03-10 18:38 ` [PATCH 9/9] rcutorture: Check for ->up_read() without matching ->down_read() Paul E. McKenney
2025-03-11  2:24 ` [PATCH 0/9] RCU torture-test changes for v6.16 Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1F552A07-5799-4228-ACE2-0A8706F1D814@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang1211@gmail.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®