public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Dave Hansen <dave.hansen@intel.com>,
	Alexander Potapenko <glider@google.com>,
	elver@google.com, dvyukov@google.com,
	dave.hansen@linux.intel.com, peterz@infradead.org,
	akpm@linux-foundation.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>
Subject: Re: [PATCH 2/3] lib/Kconfig.debug: disable LOCK_DEBUGGING_SUPPORT under KMSAN
Date: Tue, 25 Jun 2024 12:37:39 -0700	[thread overview]
Message-ID: <Znscgx8ssMlYUF5R@boqun-archlinux> (raw)
In-Reply-To: <3748b5db-6f92-41f8-a86d-ed0e73221028@paulmck-laptop>

On Tue, Jun 25, 2024 at 12:06:52PM -0700, Paul E. McKenney wrote:
> On Tue, Jun 25, 2024 at 11:51:23AM -0700, Boqun Feng wrote:
> > On Fri, Jun 21, 2024 at 09:23:25AM -0700, Dave Hansen wrote:
> > > On 6/21/24 02:49, Alexander Potapenko wrote:
> > > >  config LOCK_DEBUGGING_SUPPORT
> > > >  	bool
> > > > -	depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
> > > > +	depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT && !KMSAN
> > > >  	default y
> > > 
> > > This kinda stinks.  Practically, it'll mean that anyone turning on KMSAN
> > > will accidentally turn off lockdep.  That's really nasty, especially for
> > > folks who are turning on debug options left and right to track down
> > > nasty bugs.
> > > 
> > > I'd *MUCH* rather hide KMSAN:
> > > 
> > > config KMSAN
> > >         bool "KMSAN: detector of uninitialized values use"
> > >         depends on HAVE_ARCH_KMSAN && HAVE_KMSAN_COMPILER
> > >         depends on DEBUG_KERNEL && !KASAN && !KCSAN
> > >         depends on !PREEMPT_RT
> > > +	depends on !LOCKDEP
> > > 
> > > Because, frankly, lockdep is way more important than KMSAN.
> > > 
> > > But ideally, we'd allow them to coexist somehow.  Have we even discussed
> > > the problem with the lockdep folks?  For instance, I'd much rather have
> > > a relaxed lockdep with no checking in pfn_valid() than no lockdep at all.
> > 
> > The only locks used in pfn_valid() are rcu_read_lock_sched(), right? If
> > so, could you try (don't tell Paul ;-)) replace rcu_read_lock_sched()
> > with preempt_disable() and rcu_read_unlock_sched() with
> > preempt_enable()? That would avoid calling into lockdep. If that works
> > for KMSAN, we can either have a special rcu_read_lock_sched() or call
> > lockdep_recursion_inc() in instrumented pfn_valid() to disable lockdep
> > temporarily.
> > 
> > [Cc Paul]
> 
> Don't tell me what?  ;-)
> 

Turn out that telling you is a good idea ;-)

> An alternative is to use rcu_read_lock_sched_notrace() and
> rcu_read_unlock_sched_notrace().  If you really want to use

Yes, I think this is better than what I proposed.

Regards,
Boqun

> preempt_disable() and preempt_enable() instead, you will likely want
> the _notrace() variants.
> 
> 							Thanx, Paul

  reply	other threads:[~2024-06-25 19:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21  9:48 [PATCH 1/3] x86: mm: disable KMSAN instrumentation for physaddr.c Alexander Potapenko
2024-06-21  9:49 ` [PATCH 2/3] lib/Kconfig.debug: disable LOCK_DEBUGGING_SUPPORT under KMSAN Alexander Potapenko
2024-06-21 15:02   ` Kirill A . Shutemov
2024-06-21 16:16   ` Dave Hansen
2024-06-21 16:23   ` Dave Hansen
2024-06-25 18:51     ` Boqun Feng
2024-06-25 19:06       ` Paul E. McKenney
2024-06-25 19:37         ` Boqun Feng [this message]
2024-06-26  8:35           ` Alexander Potapenko
2024-06-21  9:49 ` [PATCH 3/3] x86/traps: fix an objtool warning in handle_bug() Alexander Potapenko
2024-06-21 15:09   ` Kirill A . Shutemov
2024-06-21 14:57 ` [PATCH 1/3] x86: mm: disable KMSAN instrumentation for physaddr.c Kirill A . Shutemov
2024-06-21 16:40 ` Dave Hansen

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=Znscgx8ssMlYUF5R@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    --cc=x86@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