Re: [PATCH v6 05/15] lockdep: Implement crossrelease feature

From: Byungchul Park
Date: Tue Apr 25 2017 - 03:02:52 EST


On Mon, Apr 24, 2017 at 11:30:51AM +0200, Peter Zijlstra wrote:
> +static void add_xhlock(struct held_lock *hlock)
> +{
> + unsigned int idx = current->xhlock_idx++;
> + struct hist_lock *xhlock = &xhlock(idx);
>
> Yes, I misread that. Then '0' has the oldest entry, which is slightly
> weird. Should we change that?

I will just follow your decision. Do you think I should change it so
that 'xhlock_idx' points to newest one, or ok to keep it unchanged?

>
>
> > > > +
> > > > + if (!xhlock_used(xhlock))
> > > > + break;
> > > > +
> > > > + if (before(xhlock->hlock.gen_id, xlock->hlock.gen_id))
> > > > + break;
> > > > +
> > > > + if (same_context_xhlock(xhlock) &&
> > > > + !commit_xhlock(xlock, xhlock))
> > >
> > > return with graph_lock held?
> >
> > No. When commit_xhlock() returns 0, the lock was already unlocked.
>
> Please add a comment, because I completely missed that. That's at least
> 2 functions deeper.

Yes, I will add a comment.

Thank you.