rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Fernandes <joel@joelfernandes.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com,
	kbuild test robot <lkp@intel.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	linux-doc@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	"Paul E. McKenney" <paulmck@linux.ibm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	rcu@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v2] driver/core: Fix build error when SRCU and lockdep disabled
Date: Tue, 13 Aug 2019 09:40:14 -0400	[thread overview]
Message-ID: <20190813134014.GB258732@google.com> (raw)
In-Reply-To: <20190813133905.GA258732@google.com>

On Tue, Aug 13, 2019 at 09:39:05AM -0400, Joel Fernandes wrote:
[snip] 
> > >  drivers/base/core.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/base/core.c b/drivers/base/core.c
> > > index 32cf83d1c744..c22271577c84 100644
> > > --- a/drivers/base/core.c
> > > +++ b/drivers/base/core.c
> > > @@ -97,10 +97,12 @@ void device_links_read_unlock(int not_used)
> > >  	up_read(&device_links_lock);
> > >  }
> > >  
> > > +#ifdef CONFIG_DEBUG_LOCK_ALLOC
> > >  int device_links_read_lock_held(void)
> > >  {
> > > -	return lock_is_held(&device_links_lock);
> > > +	return lock_is_held(&(device_links_lock.dep_map));
> > >  }
> > > +#endif
> > 
> > I don't know what the original code looks like here, but I'm guessing
> > that some .h file will need to be fixed up as you are just preventing
> > this function from ever being present without that option enabled?
> 
> No, it doesn't. I already thought about that and it is not an issue. I know
> this may be confusing because the patch I am fixing is not yet in mainline
> but in -rcu dev branch, however I did CC you on that RCU patch before but
> understandably it is not in the series so it was harder to review.
> 
> Let me explain, the lock checking facility that this patch uses is here:
> https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=28875945ba98d1b47a8a706812b6494d165bb0a0
> 
> If you see, the CONFIG_PROVE_RCU_LIST defines an alternate __list_check_rcu()
> which is just a NOOP if CONFIG_PROVE_RCU_LIST=n.
> 
> CONFIG_PROVE_RCU_LIST depends on CONFIG_PROVE_RCU which is def_bool on
> CONFIG_PROVE_LOCKING which selects CONFIG_DEBUG_LOCK_ALLOC.
> 
> So there cannot be a scenario where CONFIG_PROVE_RCU_LIST is enabled but
> CONFIG_DEBUG_LOCK_ALLOC is disabled.
> 
> To verify this, one could clone the RCU tree's dev branch and do this:
> 
> Initially PROVE_RCU_LIST is not in config:
> 
> joelaf@joelaf:~/repo/linux-master$ grep -i prove_rcu .config
> 
> Neither is DEBUG_LOCK_ALLOC:
> 
> joelaf@joelaf:~/repo/linux-master$ grep -i debug_lock .config
> # CONFIG_DEBUG_LOCK_ALLOC is not set
> 
> Enable all configs:
> joelaf@joelaf:~/repo/linux-master$ ./scripts/config -e CONFIG_RCU_EXPERT
> joelaf@joelaf:~/repo/linux-master$ ./scripts/config -e CONFIG_PROVE_LOCKING
> joelaf@joelaf:~/repo/linux-master$ ./scripts/config -e CONFIG_PROVE_RCU
> joelaf@joelaf:~/repo/linux-master$ ./scripts/config -e CONFIG_PROVE_RCU_LIST
> joelaf@joelaf:~/repo/linux-master$ make olddefconfig
> 
> DEBUG_LOCK_ALLOC shows up:
> 
> joelaf@joelaf:~/repo/linux-master$ grep -i debug_lock_all .config
> CONFIG_DEBUG_LOCK_ALLOC=y
> 
> So does PROVE_RCU options:
> joelaf@joelaf:~/repo/linux-master$ grep -i prove_rcu .config
> CONFIG_PROVE_RCU=y
> CONFIG_PROVE_RCU_LIST=y
> 
> Now, force disable DEBUG_LOCK_ALLOC:
> 
> joelaf@joelaf:~/repo/linux-master$ ./scripts/config -d CONFIG_DEBUG_LOCK_ALLOC
> 
> joelaf@joelaf:~/repo/linux-master$ make olddefconfig
> 
> Options are still enabled:
> 
> joelaf@joelaf:~/repo/linux-master$ grep -i debug_lock .config
> CONFIG_DEBUG_LOCK_ALLOC=y
> joelaf@joelaf:~/repo/linux-master$ grep -i prove_rcu .config
> CONFIG_PROVE_RCU=y
> CONFIG_PROVE_RCU_LIST=y

Also, appreciate if you could Ack the fix ;-)  (assuming the newlines in
commit message are fixed).

thanks,

 - Joel


  reply	other threads:[~2019-08-13 13:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 21:49 [PATCH v2] driver/core: Fix build error when SRCU and lockdep disabled Joel Fernandes (Google)
2019-08-13  6:05 ` Greg Kroah-Hartman
2019-08-13 13:39   ` Joel Fernandes
2019-08-13 13:40     ` Joel Fernandes [this message]
2019-08-13 15:25       ` Greg Kroah-Hartman

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=20190813134014.GB258732@google.com \
    --to=joel@joelfernandes.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=kernel-team@android.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.ibm.com \
    --cc=rafael@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).