lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 30 Apr 2008 15:43:05 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Gautham R Shenoy <ego@...ibm.com>
Cc:	linux-kernel@...r.kernel.org,
	Zdenek Kabelac <zdenek.kabelac@...il.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>,
	Srivatsa Vaddagiri <vatsa@...ibm.com>
Subject: Re: [PATCH 5/8] cpu: cpu-hotplug deadlock

On 04/30, Gautham R Shenoy wrote:
>
> On Tue, Apr 29, 2008 at 06:33:50PM +0400, Oleg Nesterov wrote:
> >
> > Could you explain what is the semantics difference? The current code allows
> > read-in-write recursion too.
>
> How about the following ?
> ----------------------------------------------------------------------------
> cpu_hotplug: split the cpu_hotplug.lock mutex into a spinlock and a waitqueue.
>
> Consider the following callpath:
> get_online_cpus()
> .
> .
> .
> some_fn()--> takes some_lock; /* lock_acquire(some_lock) [1] */
> .
> .
> .
> get_online_cpus();  /* lock_acquire(cpu_hotplug.lock) [2] */
>
> and on the cpu_hotplug callback path, we have
> cpu_hotplug.lock /* lock_acquire(cpu_hotplug.lock) [3]*/
> .
> .
> .
> some_other_fn() ----> take some_lock /* lock_acquire(some_lock) [4]*/
>
> lockdep will treat this as a  ABBA possiblity since on the write path we
> currently hold the lock so that the readers are blocked on it.
>
> However, the write path won't be activated until the refcount goes
> to zero. Which means that lockdep yelling at [2] is a false positive.

Thanks...

So, we need these complications to avoid a false positive from lockdep...
I wonder if it is possible to simply hide this internal mutex from lockdep.

OK, at least get_online_cpus() doesn't suffer from the performance pov,
and lockdep is really important. (I didn't actually understand this until
it found the bug introduced by me ;)

BTW, not that it matters, but get_online_cpus/put_online_cpus can check
"cpu_hotplug.active_writer == current" lockless.

Thanks!

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ