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


Groups > linux.kernel > #1437347

Re: [PATCH] lockdep: Add a document describing crossrelease feature

From Boqun Feng <boqun.feng@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] lockdep: Add a document describing crossrelease feature
Date 2016-07-06 02:50 +0200
Message-ID <rRJcl-1UL-5@gated-at.bofh.it> (permalink)
References <rLZMR-42g-3@gated-at.bofh.it> <rPY5P-1V8-1@gated-at.bofh.it> <rQ4bf-5yT-3@gated-at.bofh.it> <rR5RE-2gx-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, Jul 04, 2016 at 03:42:59PM +0900, Byungchul Park wrote:
[snip]
> > > +2. A lock has dependency with all locks in the releasing context, having
> > > +   been held since the lock was held.
> > 
> > But you cannot tell this. The 'since the lock was held' thing fully
> > depends on timing and is not fundamentally correct.
> > 
> > 			lock(A)
> > 			unlock(A)
> > 	lock(A)
> > 	wait_for(B)
> > 	unlock(A)
> > 			wake(B)
> > 
> > Between the wait_for(B) and wake(B), _nothing_ has been held, yet still
> > there's the deadlock potential.
> 
> Crossreleas feature can detect this situation as a deadlock. wait_for()
> is not an actual lock, but we can make it detectable by using acquring and
> releasing semantics on wait_for() and wake().
> 
> > And note that if the timing was 'right', you would never get to wake(B)
> > because deadlock, so you'd never establish that there would be a
> > deadlock.
> 
> If a deadlock actually happens, then we cannot establish it as you said.
> Remind that current lockdep does nothing for this situation. But at least
> crossrelease feature can detect this deadlock possibility at the time the
> dependency tree(graph) is built, which is better than doing nothing.
> 

Confused, how?

Say the sequence of events is as follow:

(two tasks are initially with no lock held)

	Task 1		Task 2
	=============	====================
			lock(A)
			unlock(A)
	lock(A)
	wait_for(B) // acquire
			wake(B) // commit + release
	unlock(A)

by the time, the commit are called, the dependency tree will be built,
and we will find there is _no_ lock held before wake(B). Therefore at
the release stage, you will end up only adding dependency chain A->B in
the lockdep, right? And it looks like neither Task1 or Task2 will break
the dependency chain A->B. So how can crossrelease detect the potential
deadlock?

It will be better, that you could provide some samples that crossrelease
can detect after your confirmation.

Regards,
Boqun

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


Thread

[PATCH] lockdep: Add a document describing crossrelease feature Byungchul Park <byungchul.park@lge.com> - 2016-07-01 06:20 +0200
  Re: [PATCH] lockdep: Add a document describing crossrelease feature Peter Zijlstra <peterz@infradead.org> - 2016-07-01 12:50 +0200
    Re: [PATCH] lockdep: Add a document describing crossrelease feature Byungchul Park <byungchul.park@lge.com> - 2016-07-04 08:50 +0200
      Re: [PATCH] lockdep: Add a document describing crossrelease feature Boqun Feng <boqun.feng@gmail.com> - 2016-07-06 02:50 +0200
        Re: [PATCH] lockdep: Add a document describing crossrelease feature Byungchul Park <byungchul.park@lge.com> - 2016-07-06 04:20 +0200
          Re: [PATCH] lockdep: Add a document describing crossrelease feature Byungchul Park <byungchul.park@lge.com> - 2016-07-06 07:40 +0200
            Re: [PATCH] lockdep: Add a document describing crossrelease feature Peter Zijlstra <peterz@infradead.org> - 2016-07-06 10:00 +0200
              Re: [PATCH] lockdep: Add a document describing crossrelease feature Byungchul Park <byungchul.park@lge.com> - 2016-07-06 10:20 +0200

csiph-web