public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Cc: Joel Fernandes <joel@joelfernandes.org>,
	ankur.a.arora@oracle.com,
	Frederic Weisbecker <frederic@kernel.org>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	neeraj.upadhyay@kernel.org, urezki@gmail.com,
	rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
	xiqi2@huawei.com,
	"Wangshaobo (bobo)" <bobo.shaobowang@huawei.com>
Subject: Re: [QUESTION] problems report: rcu_read_unlock_special() called in irq_exit() causes dead loop
Date: Tue, 3 Jun 2025 14:59:39 -0400	[thread overview]
Message-ID: <20250603185939.GA1109523@joelnvbox> (raw)
In-Reply-To: <3ce6f3ce-5dfb-8c59-cb7b-4619b70f8d25@huawei.com>

On Fri, May 30, 2025 at 09:55:45AM +0800, Xiongfeng Wang wrote:
> Hi Joel,
> 
> On 2025/5/29 0:30, Joel Fernandes wrote:
> > On Wed, May 21, 2025 at 5:43 AM Xiongfeng Wang
> > <wangxiongfeng2@huawei.com> wrote:
> >>
> >> Hi RCU experts,
> >>
> >> When I ran syskaller in Linux 6.6 with CONFIG_PREEMPT_RCU enabled, I got
> >> the following soft lockup. The Calltrace is too long. I put it in the end.
> >> The issue can also be reproduced in the latest kernel.
> >>
> >> The issue is as follows. CPU3 is waiting for a spin_lock, which is got by CPU1.
> >> But CPU1 stuck in the following dead loop.
> >>
> >> irq_exit()
> >>   __irq_exit_rcu()
> >>     /* in_hardirq() returns false after this */
> >>     preempt_count_sub(HARDIRQ_OFFSET)
> >>     tick_irq_exit()
> >>       tick_nohz_irq_exit()
> >>             tick_nohz_stop_sched_tick()
> >>               trace_tick_stop()  /* a bpf prog is hooked on this trace point */
> >>                    __bpf_trace_tick_stop()
> >>                       bpf_trace_run2()
> >>                             rcu_read_unlock_special()
> >>                               /* will send a IPI to itself */
> >>                               irq_work_queue_on(&rdp->defer_qs_iw, rdp->cpu);
> >>
> >> /* after interrupt is enabled again, the irq_work is called */
> >> asm_sysvec_irq_work()
> >>   sysvec_irq_work()
> >> irq_exit() /* after handled the irq_work, we again enter into irq_exit() */
> >>   __irq_exit_rcu()
> >>     ...skip...
> >>            /* we queue a irq_work again, and enter a dead loop */
> >>            irq_work_queue_on(&rdp->defer_qs_iw, rdp->cpu);
> > 
> > This seems legitimate, Boqun and I were just talking about it. He may
> > share more thoughts but here are a few:
> > 
> > Maybe we can delay subsequent clearing of the flag in
> > rcu_preempt_deferred_qs_handler() using a timer and an exponential
> > back-off? That way we are not sending too many self-IPIs.
> > 
> > And reset the process at the end of a grace period.
> > 
> > Or just don't send subsequent self-IPIs if we just sent one for the
> > rdp. Chances are, if we did not get the scheduler's attention during
> > the first one, we may not in subsequent ones I think. Plus we do send
> > other IPIs already if the grace period was over extended (from the FQS
> > loop), maybe we can tweak that?
> 
> Thanks a lot for your reply. I think it's hard for me to fix this issue as
> above without introducing new bugs. I barely understand the RCU code. But I'm
> very glad to help test if you have any code modifiction need to. I have
> the VM and the syskaller benchmark which can reproduce the problem.

Sure, I understand. This is already incredibly valuable so thank you again.
Will request for your testing help soon. I also have a test module now which
can sort-off reproduce this. Keep you posted!

thanks,

 - Joel


  reply	other threads:[~2025-06-03 18:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21  9:43 [QUESTION] problems report: rcu_read_unlock_special() called in irq_exit() causes dead loop Xiongfeng Wang
2025-05-28 16:30 ` Joel Fernandes
2025-05-30  1:55   ` Xiongfeng Wang
2025-06-03 18:59     ` Joel Fernandes [this message]
2025-06-03 19:03       ` Joel Fernandes
2025-06-03 19:22         ` Joel Fernandes
2025-06-04  1:35           ` Joel Fernandes
2025-06-04  3:25             ` Xiongfeng Wang
     [not found]               ` <64dfcaad-091c-4319-882b-d94515365758@huawei.com>
2025-06-04  9:20                 ` Joel Fernandes
2025-06-04  3:20           ` Xiongfeng Wang
2025-06-04 12:26             ` Paul E. McKenney
2025-06-05 18:56               ` Joel Fernandes
2025-07-01  9:20                 ` Qi Xi
2025-07-01 13:29                   ` Joel Fernandes
2025-07-02  9:04                     ` Qi Xi
2025-07-02  9:14                     ` Qi Xi
2025-07-02 10:59                       ` Joel Fernandes
2025-07-02 11:11                         ` Frederic Weisbecker
2025-07-02 17:24                         ` Joel Fernandes
2025-07-03  1:04                           ` Xiongfeng Wang
2025-07-05 13:12                             ` Joel Fernandes
2025-07-07  3:06                               ` Qi Xi
2025-07-07  3:08                                 ` 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=20250603185939.GA1109523@joelnvbox \
    --to=joelagnelf@nvidia.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=boqun.feng@gmail.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=urezki@gmail.com \
    --cc=wangxiongfeng2@huawei.com \
    --cc=xiqi2@huawei.com \
    /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