Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722814

Re: WARNING: possible circular locking dependency detected

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: WARNING: possible circular locking dependency detected
Date 2017-08-29 22:20 +0200
Message-ID <ujV9o-7fs-23@gated-at.bofh.it> (permalink)
References <uijIS-2Ic-11@gated-at.bofh.it> <ujtGb-6PN-29@gated-at.bofh.it> <ujSOd-5C2-1@gated-at.bofh.it> <ujUGm-6Qw-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 29 Aug 2017, Peter Zijlstra wrote:
> On Tue, Aug 29, 2017 at 07:40:44PM +0200, Thomas Gleixner wrote:
> 
> > One solution I'm looking into right now is to reverse the lock order and
> > actually make the hotplug code do:
> > 
> > 	 watchdog_lock();
> > 	 cpu_write_lock();
> > 
> > 	 ....
> > 	 cpu_write_unlock();
> > 	 watchdog_unlock();
> > 	 
> > and get rid of cpu_read_(un)lock() in the sysctl interface completely. I
> > know it's ugly, but we have other locks we take in the hotplug path as
> > well.
> 
> This is to serialize the sysctl against hotplug? I'm not immediately
> seeing why watchdog_lock needs to be the outer most lock, is that
> because of vfs locks or something?

Well, the watchdog sysctls serialization today is:

      cpus_read_lock();
      mutex_lock(&watchdog_mutex);
      do_stuff()
	access -> online_cpu_mask

      do_stuff()
        ...
	  ...
	    cpus_read_lock();

So we need

    watchdog_mutex -> cpuhotplug_rwsem

lock order all over the place.

> > Though it's quite a rewrite of that mess, which is particularly non trivial
> > because that extra non perf implementation in arch/powerpc which has its
> > own NMI watchdog thingy wants its calls preserved. But AFAICT so far it
> > should just work. Famous last words....
> > 
> > Thoughts?
> 
> So I have a patch _somewhere_ that preserves the event<->cpu relation
> across hotplug and disable/enable would be sufficient. If you want I can
> try and dig that out and make it work again.
> 
> That would avoid having to do the destroy/create cycle of the watchdog
> events.

Yes, that would solve the x86_release_hw() issue, but still lots of the
other rework is required in one way or the other.

I'm currently trying to avoid that extra lock mess in the cpu hotplug code,
which would just open the door for everybody to add his extra locks there,
so we end up taking a gazillion locks before we can hotplug :)

I think I have an idea how to solve that cleanly, but certainly your offer
of preserving the event - cpu relation accross hotplug would help
tremendously.

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-28 17:00 +0200
  Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-28 17:10 +0200
    Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-28 18:40 +0200
  Re: WARNING: possible circular locking dependency detected Thomas Gleixner <tglx@linutronix.de> - 2017-08-29 19:50 +0200
    Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-29 21:50 +0200
      Re: WARNING: possible circular locking dependency detected Thomas Gleixner <tglx@linutronix.de> - 2017-08-29 22:20 +0200
        Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-30 07:50 +0200
          Re: WARNING: possible circular locking dependency detected Thomas Gleixner <tglx@linutronix.de> - 2017-08-31 09:10 +0200
            Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-31 09:40 +0200
              Re: WARNING: possible circular locking dependency detected Thomas Gleixner <tglx@linutronix.de> - 2017-08-31 10:00 +0200
                Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-08-31 10:10 +0200
                Re: WARNING: possible circular locking dependency detected Thomas Gleixner <tglx@linutronix.de> - 2017-08-31 10:20 +0200
                Re: WARNING: possible circular locking dependency detected Thomas Gleixner <tglx@linutronix.de> - 2017-08-31 23:30 +0200
                Re: WARNING: possible circular locking dependency detected Peter Zijlstra <peterz@infradead.org> - 2017-09-01 22:40 +0200

csiph-web