linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiongwei Song <sxwjean@gmail.com>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: Waiman Long <llong@redhat.com>, Xiongwei Song <sxwjean@me.com>,
	peterz@infradead.org, mingo@redhat.com, will@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v1 1/3] locking/lockdep: Fix false warning of check_wait_context()
Date: Mon, 12 Jul 2021 17:21:43 +0800	[thread overview]
Message-ID: <CAEVVKH8B0mgqMra_3G9A9jv+WUyewpxmFC7GHP_uHUU81y5mmg@mail.gmail.com> (raw)
In-Reply-To: <YOwCZEdRdS8MPFvY@boqun-archlinux>

On Mon, Jul 12, 2021 at 4:52 PM Boqun Feng <boqun.feng@gmail.com> wrote:
>
> On Mon, Jul 12, 2021 at 04:18:36PM +0800, Xiongwei Song wrote:
> > On Mon, Jul 12, 2021 at 12:43 AM Waiman Long <llong@redhat.com> wrote:
> > >
> > > On 7/11/21 10:14 AM, Xiongwei Song wrote:
> > > > From: Xiongwei Song <sxwjean@gmail.com>
> > > >
> > > > We now always get a "Invalid wait context" warning with
> > > > CONFIG_PROVE_RAW_LOCK_NESTING=y, see the full warning below:
> > > >
> > > >       [    0.705900] =============================
> > > >       [    0.706002] [ BUG: Invalid wait context ]
> > > >       [    0.706180] 5.13.0+ #4 Not tainted
> > > >       [    0.706349] -----------------------------
> > >
> > > I believe the purpose of CONFIG_PROVE_RAW_LOCK_NESTING is experimental
> > > and it is turned off by default. Turning it on can cause problem as
> > > shown in your lockdep splat. Limiting it to just PREEMPT_RT will defeat
> > > its purpose to find potential spinlock nesting problem in non-PREEMPT_RT
> > > kernel.
> > As far as I know, a spinlock can nest another spinlock. In
> > non-PREEMPT_RT kernel
> > spin_lock and raw_spin_lock are same , so here acquiring a spin_lock in hardirq
> > context is acceptable, the warning is not needed. My knowledge on this
> > is not enough,
> > Will dig into this.
> >
>
> You may find this useful: https://lwn.net/Articles/146861/ ;-)
>
> The thing is that most of the irq handlers will run in process contexts
> in PREEMPT_RT kernel (threaded irq), while the rest continues to run in
> hardirq contexts. spinlock_t is allowed int threaded irqs but not in
> hardirq contexts for PREEMPT_RT, because spinlock_t will become
> sleeplable locks.
Exactly. I think I have known why the fix is incorrect.

Regards,
Xiongwei
>
> Regards,
> Boqun
>
> > > The point is to fix the issue found,
> > Agree. I thought there was a spinlock usage issue, but by checking
> > deactivate_slab context,
> > looks like the spinlock usage is well. Maybe I'm missing something?
> >
> > > not hiding it from appearing.
> > I'm not trying to hiding it, according to the code context, the fix is
> > reasonable from my point of
> > view. Let me check again.
> >
> > Thank  you for the comments.
> >
> > Regards,
> > Xiongwei
> > >
> > > Cheers,
> > > Longman
> > >

  reply	other threads:[~2021-07-12  9:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-11 14:14 [RFC PATCH v1 1/3] locking/lockdep: Fix false warning of check_wait_context() Xiongwei Song
2021-07-11 14:14 ` [RFC PATCH v1 2/3] locking/lockdep: Unify the return values " Xiongwei Song
2021-07-11 15:19   ` Waiman Long
2021-07-12  7:48     ` Xiongwei Song
2021-07-23  2:57   ` [locking/lockdep] e0a77a7a5a: WARNING:bad_unlock_balance_detected kernel test robot
2021-07-11 14:14 ` [PATCH v1 3/3] locking/lockdep,doc: Correct the max number of lock classes Xiongwei Song
2021-07-11 15:22   ` Waiman Long
2021-07-12  7:49     ` Xiongwei Song
2021-07-11 16:43 ` [RFC PATCH v1 1/3] locking/lockdep: Fix false warning of check_wait_context() Waiman Long
2021-07-12  8:18   ` Xiongwei Song
2021-07-12  8:50     ` Boqun Feng
2021-07-12  9:21       ` Xiongwei Song [this message]
2021-07-12 13:04     ` Waiman Long
2021-07-12 15:03       ` Xiongwei Song
2021-07-13  2:29       ` Xiongwei Song

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=CAEVVKH8B0mgqMra_3G9A9jv+WUyewpxmFC7GHP_uHUU81y5mmg@mail.gmail.com \
    --to=sxwjean@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llong@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sxwjean@me.com \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).