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


Groups > linux.kernel > #1709383

Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring buffer overwrite

From Byungchul Park <byungchul.park@lge.com>
Newsgroups linux.kernel
Subject Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring buffer overwrite
Date 2017-08-11 11:00 +0200
Message-ID <uddXs-1kf-5@gated-at.bofh.it> (permalink)
References (3 earlier) <ucUL9-5wC-39@gated-at.bofh.it> <ucVea-5GH-31@gated-at.bofh.it> <ucVxv-62g-7@gated-at.bofh.it> <ud97r-6Jm-13@gated-at.bofh.it> <uddb3-14n-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Aug 11, 2017 at 04:03:29PM +0800, Boqun Feng wrote:
> Thanks for taking a look at it ;-)

I rather appriciate it.

> > > @@ -5005,7 +5003,7 @@ static int commit_xhlock(struct cross_lock *xlock, struct hist_lock *xhlock)
> > >  static void commit_xhlocks(struct cross_lock *xlock)
> > >  {
> > >  	unsigned int cur = current->xhlock_idx;
> > > -	unsigned int prev_hist_id = xhlock(cur).hist_id;
> > > +	unsigned int prev_hist_id = cur + 1;
> > 
> > I should have named it another. Could you suggest a better one?
> > 
> 
> I think "prev" is fine, because I thought the "previous" means the
> xhlock item we visit _previously_.
> 
> > >  	unsigned int i;
> > >  
> > >  	if (!graph_lock())
> > > @@ -5030,7 +5028,7 @@ static void commit_xhlocks(struct cross_lock *xlock)
> > >  			 * hist_id than the following one, which is impossible
> > >  			 * otherwise.
> > 
> > Or we need to modify the comment so that the word 'prev' does not make
> > readers confused. It was my mistake.
> > 
> 
> I think the comment needs some help, but before you do it, could you
> have another look at what Peter proposed previously? Note you have a
> same_context_xhlock() check in the commit_xhlocks(), so the your
> previous overwrite case actually could be detected, I think.

What is the previous overwrite case?

ppppppppppwwwwwwwwwwwwiiiiiiiii
iiiiiiiiiiiiiii................

Do you mean this one? I missed the check of same_context_xhlock(). Yes,
peterz's suggestion also seems to work.

> However, one thing may not be detected is this case:
> 
> 		ppppppppppppppppppppppppppppppppppwwwwwwww
> wrapped >	wwwwwww

To be honest, I think your suggestion is more natual, with which this
case would be also covered.

> 
> 	where p: process and w: worker.
> 
> , because p and w are in the same task_irq_context(). I discussed this
> with Peter yesterday, and he has a good idea: unconditionally do a reset
> on the ring buffer whenever we do a crossrelease_hist_end(XHLOCK_PROC).
> Basically it means we empty the lock history whenever we finished a
> worker function in a worker thread or we are about to return to
> userspace after we finish the syscall. This could further save some
> memory and so I think this may be better than my approach.

Do you mean reset _whenever_ hard irq exit, soft irq exit or work exit?
Why should we give up chances to check dependencies of remaining xhlocks
whenever each exit? Am I understanding correctly?

I am just curious. Does your approach have some problems?

Thanks,
Byungchul

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


Thread

[PATCH v8 06/14] lockdep: Detect and handle hist_lock ring buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-07 09:20 +0200
  Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-08-09 16:20 +0200
    Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-10 03:40 +0200
      Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Peter Zijlstra <peterz@infradead.org> - 2017-08-10 11:30 +0200
    Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-10 12:40 +0200
  Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Boqun Feng <boqun.feng@gmail.com> - 2017-08-10 14:00 +0200
    RE: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring buffer overwrite "Byungchul Park" <byungchul.park@lge.com> - 2017-08-10 14:30 +0200
      Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Boqun Feng <boqun.feng@gmail.com> - 2017-08-10 15:00 +0200
        Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Boqun Feng <boqun.feng@gmail.com> - 2017-08-10 15:20 +0200
          Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-11 02:50 +0200
          Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-11 05:50 +0200
            Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Boqun Feng <boqun.feng@gmail.com> - 2017-08-11 10:10 +0200
              Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-11 11:00 +0200
                Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-11 11:50 +0200
                Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring buffer overwrite Byungchul Park <max.byungchul.park@gmail.com> - 2017-08-11 15:10 +0200
        Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Byungchul Park <byungchul.park@lge.com> - 2017-08-11 02:50 +0200
          Re: [PATCH v8 06/14] lockdep: Detect and handle hist_lock ring  buffer overwrite Boqun Feng <boqun.feng@gmail.com> - 2017-08-11 03:10 +0200
  [tip:locking/core] locking/lockdep: Detect and handle hist_lock  ring buffer overwrite tip-bot for Byungchul Park <tipbot@zytor.com> - 2017-08-10 14:30 +0200

csiph-web