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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170301044033.GC11663@X58A-UD3R>
Date:   Wed, 1 Mar 2017 13:40:33 +0900
From:   Byungchul Park <byungchul.park@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...nel.org, tglx@...utronix.de, walken@...gle.com,
        boqun.feng@...il.com, kirill@...temov.name,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        iamjoonsoo.kim@....com, akpm@...ux-foundation.org,
        npiggin@...il.com, kernel-team@....com
Subject: Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature

On Tue, Feb 28, 2017 at 07:29:02PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 28, 2017 at 10:24:44PM +0900, Byungchul Park wrote:
> > On Tue, Feb 28, 2017 at 02:10:12PM +0100, Peter Zijlstra wrote:
> 
> > > > +/* For easy access to xhlock */
> > > > +#define xhlock(t, i)		((t)->xhlocks + (i))
> > > > +#define xhlock_prev(t, l)	xhlock(t, idx_prev((l) - (t)->xhlocks))
> > > > +#define xhlock_curr(t)		xhlock(t, idx(t))
> > > 
> > > So these result in an xhlock pointer
> > > 
> > > > +#define xhlock_incr(t)		({idx(t) = idx_next(idx(t));})
> > > 
> > > This does not; which is confusing seeing how they share the same
> > > namespace; also incr is weird.
> > 
> > OK.. Could you suggest a better name? xhlock_adv()? advance_xhlock()?
> > And.. replace it with a function?
> 
> How about doing: xhlocks_idx++ ? That is, keep all the indexes as
> regular u32 and only reduce the space when using them as index.

OK.

> 
> Also, I would write the loop:
> 
> > +static int commit_xhlocks(struct cross_lock *xlock)
> > +{
> > +     struct task_struct *curr = current;
> > +     struct hist_lock *xhlock_c = xhlock_curr(curr);
> > +     struct hist_lock *xhlock = xhlock_c;
> > +
> > +     do {
> > +             xhlock = xhlock_prev(curr, xhlock);
> > +
> > +             if (!xhlock_used(xhlock))
> > +                     break;
> > +
> > +             if (before(xhlock->hlock.gen_id, xlock->hlock.gen_id))
> > +                     break;
> > +
> > +             if (same_context_xhlock(xhlock) &&
> > +                 before(xhlock->prev_gen_id, xlock->hlock.gen_id) &&
> > +                 !commit_xhlock(xlock, xhlock))
> > +                     return 0;
> > +     } while (xhlock_c != xhlock);
> > +
> > +     return 1;
> > +}
> 
> like:
> 
> #define xhlock(i)	current->xhlocks[i % MAX_XHLOCKS_NR]
> 
> 	for (i = 0; i < MAX_XHLOCKS_NR; i++) {
> 		xhlock = xhlock(curr->xhlock_idx - i);
> 
> 		/* ... */
> 	}
> 
> That avoids that horrible xhlock_prev() thing.

Right. I decided to force MAX_XHLOCKS_NR to be power of 2 and everything
became easy. Thank you very much.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ