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


Groups > linux.kernel > #1561319 > unrolled thread

Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation

Started byBoqun Feng <boqun.feng@gmail.com>
First post2017-01-18 07:50 +0100
Last post2017-01-18 12:20 +0100
Articles 9 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Boqun Feng <boqun.feng@gmail.com> - 2017-01-18 07:50 +0100
    Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Peter Zijlstra <peterz@infradead.org> - 2017-01-18 12:10 +0100
      Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Byungchul Park <byungchul.park@lge.com> - 2017-01-18 13:00 +0100
        RE: [PATCH v4 15/15] lockdep: Crossrelease feature documentation "byungchul.park" <byungchul.park@lge.com> - 2017-01-18 13:20 +0100
          Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Peter Zijlstra <peterz@infradead.org> - 2017-01-18 15:20 +0100
            Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Byungchul Park <byungchul.park@lge.com> - 2017-01-19 03:20 +0100
        Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Peter Zijlstra <peterz@infradead.org> - 2017-01-18 13:40 +0100
          RE: [PATCH v4 15/15] lockdep: Crossrelease feature documentation "byungchul.park" <byungchul.park@lge.com> - 2017-01-18 14:00 +0100
    Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation Byungchul Park <byungchul.park@lge.com> - 2017-01-18 12:20 +0100

#1561319 — Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation

FromBoqun Feng <boqun.feng@gmail.com>
Date2017-01-18 07:50 +0100
SubjectRe: [PATCH v4 15/15] lockdep: Crossrelease feature documentation
Message-ID<t0See-D1-5@gated-at.bofh.it>

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

On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
[...]
> +Example 1:
> +
> +   CONTEXT X		   CONTEXT Y
> +   ---------		   ---------
> +   mutext_lock A
> +			   lock_page B
> +   lock_page B
> +			   mutext_lock A /* DEADLOCK */

s/mutext_lock/mutex_lock

> +   unlock_page B
> +			   mutext_unlock A
> +   mutex_unlock A
> +			   unlock_page B
> +
> +   where A is a lock class and B is a page lock.
> +
> +No, we cannot.
> +
> +Example 2:
> +
> +   CONTEXT X	   CONTEXT Y	   CONTEXT Z
> +   ---------	   ---------	   ----------
> +		   mutex_lock A
> +   lock_page B
> +		   lock_page B
> +				   mutext_lock A /* DEADLOCK */
> +				   mutext_unlock A

Ditto.

> +				   unlock_page B held by X
> +		   unlock_page B
> +		   mutex_unlock A
> +
> +   where A is a lock class and B is a page lock.
> +
> +No, we cannot.
> +
> +Example 3:
> +
> +   CONTEXT X		   CONTEXT Y
> +   ---------		   ---------
> +			   mutex_lock A
> +   mutex_lock A
> +   mutex_unlock A
> +			   wait_for_complete B /* DEADLOCK */

I think this part better be:

   CONTEXT X		   CONTEXT Y
   ---------		   ---------
   			   mutex_lock A
   mutex_lock A
   			   wait_for_complete B /* DEADLOCK */
   mutex_unlock A

, right? Because Y triggers DEADLOCK before X could run mutex_unlock().

Regards,
Boqun

[toc] | [next] | [standalone]


#1561548

FromPeter Zijlstra <peterz@infradead.org>
Date2017-01-18 12:10 +0100
Message-ID<t0WhR-3hP-27@gated-at.bofh.it>
In reply to#1561319
On Wed, Jan 18, 2017 at 07:53:47PM +0900, Byungchul Park wrote:
> On Wed, Jan 18, 2017 at 02:42:30PM +0800, Boqun Feng wrote:
> > On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
> > [...]
> > > +Example 1:
> > > +
> > > +   CONTEXT X		   CONTEXT Y
> > > +   ---------		   ---------
> > > +   mutext_lock A
> > > +			   lock_page B
> > > +   lock_page B
> > > +			   mutext_lock A /* DEADLOCK */
> > 
> > s/mutext_lock/mutex_lock
> 
> Thank you.
> 
> > > +Example 3:
> > > +
> > > +   CONTEXT X		   CONTEXT Y
> > > +   ---------		   ---------
> > > +			   mutex_lock A
> > > +   mutex_lock A
> > > +   mutex_unlock A
> > > +			   wait_for_complete B /* DEADLOCK */
> > 
> > I think this part better be:
> > 
> >    CONTEXT X		   CONTEXT Y
> >    ---------		   ---------
> >    			   mutex_lock A
> >    mutex_lock A
> >    			   wait_for_complete B /* DEADLOCK */
> >    mutex_unlock A
> > 
> > , right? Because Y triggers DEADLOCK before X could run mutex_unlock().
> 
> There's no different between two examples.

There is..

> No matter which one is chosen, mutex_lock A in CONTEXT X cannot be passed.

But your version shows it does mutex_unlock() before CONTEXT Y does
wait_for_completion().

The thing about these diagrams is that both columns are assumed to have
the same timeline.

[toc] | [prev] | [next] | [standalone]


#1561687

FromByungchul Park <byungchul.park@lge.com>
Date2017-01-18 13:00 +0100
Message-ID<t0X4e-3E5-29@gated-at.bofh.it>
In reply to#1561548
On Wed, Jan 18, 2017 at 12:03:17PM +0100, Peter Zijlstra wrote:
> On Wed, Jan 18, 2017 at 07:53:47PM +0900, Byungchul Park wrote:
> > On Wed, Jan 18, 2017 at 02:42:30PM +0800, Boqun Feng wrote:
> > > On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
> > > [...]
> > > > +Example 1:
> > > > +
> > > > +   CONTEXT X		   CONTEXT Y
> > > > +   ---------		   ---------
> > > > +   mutext_lock A
> > > > +			   lock_page B
> > > > +   lock_page B
> > > > +			   mutext_lock A /* DEADLOCK */
> > > 
> > > s/mutext_lock/mutex_lock
> > 
> > Thank you.
> > 
> > > > +Example 3:
> > > > +
> > > > +   CONTEXT X		   CONTEXT Y
> > > > +   ---------		   ---------
> > > > +			   mutex_lock A
> > > > +   mutex_lock A
> > > > +   mutex_unlock A
> > > > +			   wait_for_complete B /* DEADLOCK */
> > > 
> > > I think this part better be:
> > > 
> > >    CONTEXT X		   CONTEXT Y
> > >    ---------		   ---------
> > >    			   mutex_lock A
> > >    mutex_lock A
> > >    			   wait_for_complete B /* DEADLOCK */
> > >    mutex_unlock A
> > > 
> > > , right? Because Y triggers DEADLOCK before X could run mutex_unlock().
> > 
> > There's no different between two examples.
> 
> There is..
> 
> > No matter which one is chosen, mutex_lock A in CONTEXT X cannot be passed.
> 
> But your version shows it does mutex_unlock() before CONTEXT Y does
> wait_for_completion().
> 
> The thing about these diagrams is that both columns are assumed to have
> the same timeline.

X cannot acquire mutex A because Y already acquired it.

In order words, all statements below mutex_lock A in X cannot run.

[toc] | [prev] | [next] | [standalone]


#1561689

From"byungchul.park" <byungchul.park@lge.com>
Date2017-01-18 13:20 +0100
Message-ID<t0Xnz-3ZK-1@gated-at.bofh.it>
In reply to#1561687
> -----Original Message-----
> From: Peter Zijlstra [mailto:peterz@infradead.org]
> Sent: Wednesday, January 18, 2017 9:08 PM
> To: Byungchul Park
> Cc: Boqun Feng; mingo@kernel.org; tglx@linutronix.de; walken@google.com;
> kirill@shutemov.name; linux-kernel@vger.kernel.org; linux-mm@kvack.org;
> iamjoonsoo.kim@lge.com; akpm@linux-foundation.org; npiggin@gmail.com
> Subject: Re: [PATCH v4 15/15] lockdep: Crossrelease feature documentation
> 
> On Wed, Jan 18, 2017 at 08:54:28PM +0900, Byungchul Park wrote:
> > On Wed, Jan 18, 2017 at 12:03:17PM +0100, Peter Zijlstra wrote:
> > > On Wed, Jan 18, 2017 at 07:53:47PM +0900, Byungchul Park wrote:
> > > > On Wed, Jan 18, 2017 at 02:42:30PM +0800, Boqun Feng wrote:
> > > > > On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
> > > > > [...]
> > > > > > +Example 1:
> > > > > > +
> > > > > > +   CONTEXT X		   CONTEXT Y
> > > > > > +   ---------		   ---------
> > > > > > +   mutext_lock A
> > > > > > +			   lock_page B
> > > > > > +   lock_page B
> > > > > > +			   mutext_lock A /* DEADLOCK */
> > > > >
> > > > > s/mutext_lock/mutex_lock
> > > >
> > > > Thank you.
> > > >
> > > > > > +Example 3:
> > > > > > +
> > > > > > +   CONTEXT X		   CONTEXT Y
> > > > > > +   ---------		   ---------
> > > > > > +			   mutex_lock A
> > > > > > +   mutex_lock A
> > > > > > +   mutex_unlock A
> > > > > > +			   wait_for_complete B /* DEADLOCK */
> > > > >
> > > > > I think this part better be:
> > > > >
> > > > >    CONTEXT X		   CONTEXT Y
> > > > >    ---------		   ---------
> > > > >    			   mutex_lock A
> > > > >    mutex_lock A
> > > > >    			   wait_for_complete B /* DEADLOCK */
> > > > >    mutex_unlock A
> > > > >
> > > > > , right? Because Y triggers DEADLOCK before X could run
> mutex_unlock().
> > > >
> > > > There's no different between two examples.
> > >
> > > There is..
> > >
> > > > No matter which one is chosen, mutex_lock A in CONTEXT X cannot be
> passed.
> > >
> > > But your version shows it does mutex_unlock() before CONTEXT Y does
> > > wait_for_completion().
> > >
> > > The thing about these diagrams is that both columns are assumed to
> have
> > > the same timeline.
> >
> > X cannot acquire mutex A because Y already acquired it.
> >
> > In order words, all statements below mutex_lock A in X cannot run.
> 
> But your timeline shows it does, which is the error that Boqun pointed
> out.

I am sorry for not understanding what you are talking about.

Do you mean that I should remove all statements below mutex_lock A in X?

Or should I move mutex_unlock as Boqun said? What will change?

[toc] | [prev] | [next] | [standalone]


#1561840

FromPeter Zijlstra <peterz@infradead.org>
Date2017-01-18 15:20 +0100
Message-ID<t0ZfI-594-11@gated-at.bofh.it>
In reply to#1561689
On Wed, Jan 18, 2017 at 09:14:59PM +0900, byungchul.park wrote:

> +Example 3:
> +
> +   CONTEXT X		   CONTEXT Y
> +   ---------		   ---------
> +			   mutex_lock A
> +   mutex_lock A
> +   mutex_unlock A
> +			   wait_for_complete B /* DEADLOCK */

Each line (across both columns) is a distinct point in time after the
line before.

Therefore, this states that "mutex_unlock A" happens before
"wait_for_completion B", which is clearly impossible.

You don't have to remove everything after mutex_lock A, but the unlock
must not happen before context Y does the unlock.

[toc] | [prev] | [next] | [standalone]


#1562377

FromByungchul Park <byungchul.park@lge.com>
Date2017-01-19 03:20 +0100
Message-ID<t1auu-3KN-1@gated-at.bofh.it>
In reply to#1561840
On Wed, Jan 18, 2017 at 03:12:55PM +0100, Peter Zijlstra wrote:
> On Wed, Jan 18, 2017 at 09:14:59PM +0900, byungchul.park wrote:
> 
> > +Example 3:
> > +
> > +   CONTEXT X		   CONTEXT Y
> > +   ---------		   ---------
> > +			   mutex_lock A
> > +   mutex_lock A
> > +   mutex_unlock A
> > +			   wait_for_complete B /* DEADLOCK */
> 
> Each line (across both columns) is a distinct point in time after the
> line before.
> 
> Therefore, this states that "mutex_unlock A" happens before
> "wait_for_completion B", which is clearly impossible.

I meant that all statements below mutex_lock A in X are already impossible.
So the order of those are meaningless. But.. I got what you mean.

> You don't have to remove everything after mutex_lock A, but the unlock
> must not happen before context Y does the unlock.

I will apply what you and boqun recommanded, from the next spin.

Thank you,
Byungchul

[toc] | [prev] | [next] | [standalone]


#1561716

FromPeter Zijlstra <peterz@infradead.org>
Date2017-01-18 13:40 +0100
Message-ID<t0Xnz-3ZK-3@gated-at.bofh.it>
In reply to#1561687
On Wed, Jan 18, 2017 at 08:54:28PM +0900, Byungchul Park wrote:
> On Wed, Jan 18, 2017 at 12:03:17PM +0100, Peter Zijlstra wrote:
> > On Wed, Jan 18, 2017 at 07:53:47PM +0900, Byungchul Park wrote:
> > > On Wed, Jan 18, 2017 at 02:42:30PM +0800, Boqun Feng wrote:
> > > > On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
> > > > [...]
> > > > > +Example 1:
> > > > > +
> > > > > +   CONTEXT X		   CONTEXT Y
> > > > > +   ---------		   ---------
> > > > > +   mutext_lock A
> > > > > +			   lock_page B
> > > > > +   lock_page B
> > > > > +			   mutext_lock A /* DEADLOCK */
> > > > 
> > > > s/mutext_lock/mutex_lock
> > > 
> > > Thank you.
> > > 
> > > > > +Example 3:
> > > > > +
> > > > > +   CONTEXT X		   CONTEXT Y
> > > > > +   ---------		   ---------
> > > > > +			   mutex_lock A
> > > > > +   mutex_lock A
> > > > > +   mutex_unlock A
> > > > > +			   wait_for_complete B /* DEADLOCK */
> > > > 
> > > > I think this part better be:
> > > > 
> > > >    CONTEXT X		   CONTEXT Y
> > > >    ---------		   ---------
> > > >    			   mutex_lock A
> > > >    mutex_lock A
> > > >    			   wait_for_complete B /* DEADLOCK */
> > > >    mutex_unlock A
> > > > 
> > > > , right? Because Y triggers DEADLOCK before X could run mutex_unlock().
> > > 
> > > There's no different between two examples.
> > 
> > There is..
> > 
> > > No matter which one is chosen, mutex_lock A in CONTEXT X cannot be passed.
> > 
> > But your version shows it does mutex_unlock() before CONTEXT Y does
> > wait_for_completion().
> > 
> > The thing about these diagrams is that both columns are assumed to have
> > the same timeline.
> 
> X cannot acquire mutex A because Y already acquired it.
> 
> In order words, all statements below mutex_lock A in X cannot run.

But your timeline shows it does, which is the error that Boqun pointed
out.

[toc] | [prev] | [next] | [standalone]


#1561730

From"byungchul.park" <byungchul.park@lge.com>
Date2017-01-18 14:00 +0100
Message-ID<t0Y0h-4cB-7@gated-at.bofh.it>
In reply to#1561716
> -----Original Message-----
> From: byungchul.park [mailto:byungchul.park@lge.com]
> Sent: Wednesday, January 18, 2017 9:15 PM
> To: 'Peter Zijlstra'
> Cc: 'Boqun Feng'; 'mingo@kernel.org'; 'tglx@linutronix.de';
> 'walken@google.com'; 'kirill@shutemov.name'; 'linux-
> kernel@vger.kernel.org'; 'linux-mm@kvack.org'; 'iamjoonsoo.kim@lge.com';
> 'akpm@linux-foundation.org'; 'npiggin@gmail.com'
> Subject: RE: [PATCH v4 15/15] lockdep: Crossrelease feature documentation
> 
> > -----Original Message-----
> > From: Peter Zijlstra [mailto:peterz@infradead.org]
> > Sent: Wednesday, January 18, 2017 9:08 PM
> > To: Byungchul Park
> > Cc: Boqun Feng; mingo@kernel.org; tglx@linutronix.de; walken@google.com;
> > kirill@shutemov.name; linux-kernel@vger.kernel.org; linux-mm@kvack.org;
> > iamjoonsoo.kim@lge.com; akpm@linux-foundation.org; npiggin@gmail.com
> > Subject: Re: [PATCH v4 15/15] lockdep: Crossrelease feature
> documentation
> >
> > On Wed, Jan 18, 2017 at 08:54:28PM +0900, Byungchul Park wrote:
> > > On Wed, Jan 18, 2017 at 12:03:17PM +0100, Peter Zijlstra wrote:
> > > > On Wed, Jan 18, 2017 at 07:53:47PM +0900, Byungchul Park wrote:
> > > > > On Wed, Jan 18, 2017 at 02:42:30PM +0800, Boqun Feng wrote:
> > > > > > On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
> > > > > > [...]
> > > > > > > +Example 1:
> > > > > > > +
> > > > > > > +   CONTEXT X		   CONTEXT Y
> > > > > > > +   ---------		   ---------
> > > > > > > +   mutext_lock A
> > > > > > > +			   lock_page B
> > > > > > > +   lock_page B
> > > > > > > +			   mutext_lock A /* DEADLOCK */
> > > > > >
> > > > > > s/mutext_lock/mutex_lock
> > > > >
> > > > > Thank you.
> > > > >
> > > > > > > +Example 3:
> > > > > > > +
> > > > > > > +   CONTEXT X		   CONTEXT Y
> > > > > > > +   ---------		   ---------
> > > > > > > +			   mutex_lock A
> > > > > > > +   mutex_lock A
> > > > > > > +   mutex_unlock A
> > > > > > > +			   wait_for_complete B /* DEADLOCK */
> > > > > >
> > > > > > I think this part better be:
> > > > > >
> > > > > >    CONTEXT X		   CONTEXT Y
> > > > > >    ---------		   ---------
> > > > > >    			   mutex_lock A
> > > > > >    mutex_lock A
> > > > > >    			   wait_for_complete B /* DEADLOCK */
> > > > > >    mutex_unlock A
> > > > > >
> > > > > > , right? Because Y triggers DEADLOCK before X could run
> > mutex_unlock().
> > > > >
> > > > > There's no different between two examples.
> > > >
> > > > There is..
> > > >
> > > > > No matter which one is chosen, mutex_lock A in CONTEXT X cannot be
> > passed.
> > > >
> > > > But your version shows it does mutex_unlock() before CONTEXT Y does
> > > > wait_for_completion().
> > > >
> > > > The thing about these diagrams is that both columns are assumed to
> > have
> > > > the same timeline.
> > >
> > > X cannot acquire mutex A because Y already acquired it.
> > >
> > > In order words, all statements below mutex_lock A in X cannot run.
> >
> > But your timeline shows it does, which is the error that Boqun pointed
> > out.
> 
> I am sorry for not understanding what you are talking about.
> 
> Do you mean that I should remove all statements below mutex_lock A in X?
> 
> Or should I move mutex_unlock as Boqun said? What will change?

Anyway, I will change it as he said even though I don't understand what is
different between them. :/ But I am just curious. It would be appreciated
if you answer my question.

[toc] | [prev] | [next] | [standalone]


#1561601

FromByungchul Park <byungchul.park@lge.com>
Date2017-01-18 12:20 +0100
Message-ID<t0WhR-3hP-29@gated-at.bofh.it>
In reply to#1561319
On Wed, Jan 18, 2017 at 02:42:30PM +0800, Boqun Feng wrote:
> On Fri, Dec 09, 2016 at 02:12:11PM +0900, Byungchul Park wrote:
> [...]
> > +Example 1:
> > +
> > +   CONTEXT X		   CONTEXT Y
> > +   ---------		   ---------
> > +   mutext_lock A
> > +			   lock_page B
> > +   lock_page B
> > +			   mutext_lock A /* DEADLOCK */
> 
> s/mutext_lock/mutex_lock

Thank you.

> > +Example 3:
> > +
> > +   CONTEXT X		   CONTEXT Y
> > +   ---------		   ---------
> > +			   mutex_lock A
> > +   mutex_lock A
> > +   mutex_unlock A
> > +			   wait_for_complete B /* DEADLOCK */
> 
> I think this part better be:
> 
>    CONTEXT X		   CONTEXT Y
>    ---------		   ---------
>    			   mutex_lock A
>    mutex_lock A
>    			   wait_for_complete B /* DEADLOCK */
>    mutex_unlock A
> 
> , right? Because Y triggers DEADLOCK before X could run mutex_unlock().

There's no different between two examples.

No matter which one is chosen, mutex_lock A in CONTEXT X cannot be passed.

> 
> Regards,
> Boqun

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web