Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-31 Thread Dmitry Vyukov
On Thu, Jan 31, 2019 at 11:09 AM Reshetova, Elena wrote: > > > On Thu, Jan 31, 2019 at 11:04 AM Reshetova, Elena > > wrote: > > > > > > > Just to check, has this been tested with CONFIG_REFCOUNT_FULL and > > > > > something poking kcov? > > > > > > > > > > Given lib/refcount.c is instrumented, t

RE: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-31 Thread Reshetova, Elena
> On Thu, Jan 31, 2019 at 11:04 AM Reshetova, Elena > wrote: > > > > > Just to check, has this been tested with CONFIG_REFCOUNT_FULL and > > > > something poking kcov? > > > > > > > > Given lib/refcount.c is instrumented, the refcount_*() calls will > > > > recurse back into the kcov code. It loo

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-31 Thread Dmitry Vyukov
On Thu, Jan 31, 2019 at 11:04 AM Reshetova, Elena wrote: > > > Just to check, has this been tested with CONFIG_REFCOUNT_FULL and > > > something poking kcov? > > > > > > Given lib/refcount.c is instrumented, the refcount_*() calls will > > > recurse back into the kcov code. It looks like that's f

RE: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-31 Thread Reshetova, Elena
> Just to check, has this been tested with CONFIG_REFCOUNT_FULL and > > something poking kcov? > > > > Given lib/refcount.c is instrumented, the refcount_*() calls will > > recurse back into the kcov code. It looks like that's fine, given these > > are only manipulated in setup/teardown paths, but

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-28 Thread Peter Zijlstra
On Sun, Jan 27, 2019 at 06:41:38PM +, Reshetova, Elena wrote: > > On Mon, Jan 21, 2019 at 11:05:03AM -0500, Alan Stern wrote: > > > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > Yes, that's a very good suggestion. > > > > I suppose we can add smp_acquire__after_ctrl_dep() on the true branch.

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-28 Thread Dmitry Vyukov
On Sun, Jan 27, 2019 at 7:41 PM Reshetova, Elena wrote: > > > On Mon, Jan 21, 2019 at 11:05:03AM -0500, Alan Stern wrote: > > > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > > > > > Any additional ordering; like the one you have above; are not strictly > > > > required for the proper functioning

RE: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-27 Thread Reshetova, Elena
> On Mon, Jan 21, 2019 at 11:05:03AM -0500, Alan Stern wrote: > > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > > > Any additional ordering; like the one you have above; are not strictly > > > required for the proper functioning of the refcount. Rather, you rely on > > > additional ordering and w

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-25 Thread Peter Zijlstra
On Fri, Jan 25, 2019 at 09:02:42AM +, Reshetova, Elena wrote: > > > I suppose we can add smp_acquire__after_ctrl_dep() on the true branch. > > > Then it reall does become rel_acq. > > > > > > A wee something like so (I couldn't find an arm64 refcount, even though > > > I have distinct memories

RE: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-25 Thread Reshetova, Elena
> > I suppose we can add smp_acquire__after_ctrl_dep() on the true branch. > > Then it reall does become rel_acq. > > > > A wee something like so (I couldn't find an arm64 refcount, even though > > I have distinct memories of talk about it). > > In the end, arm and arm64 chose to use REFCOUNT_FULL

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-22 Thread Kees Cook
On Tue, Jan 22, 2019 at 10:05 PM Peter Zijlstra wrote: > > On Mon, Jan 21, 2019 at 11:05:03AM -0500, Alan Stern wrote: > > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > > > Any additional ordering; like the one you have above; are not strictly > > > required for the proper functioning of the refc

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-22 Thread Peter Zijlstra
On Mon, Jan 21, 2019 at 11:05:03AM -0500, Alan Stern wrote: > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > Any additional ordering; like the one you have above; are not strictly > > required for the proper functioning of the refcount. Rather, you rely on > > additional ordering and will need to

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Dmitry Vyukov
On Mon, Jan 21, 2019 at 3:07 PM Reshetova, Elena wrote: > > > Just to check, has this been tested with CONFIG_REFCOUNT_FULL and > > > something poking kcov? > > > > > > Given lib/refcount.c is instrumented, the refcount_*() calls will > > > recurse back into the kcov code. It looks like that's fi

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Dmitry Vyukov
On Mon, Jan 21, 2019 at 5:05 PM Alan Stern wrote: > > On Mon, 21 Jan 2019, Peter Zijlstra wrote: > > > On Mon, Jan 21, 2019 at 10:52:37AM +0100, Dmitry Vyukov wrote: > > > On Wed, Jan 16, 2019 at 1:51 PM Dmitry Vyukov wrote: > > > > > > KCOV uses refcounts in a very simple canonical way, so no hi

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Alan Stern
On Mon, 21 Jan 2019, Peter Zijlstra wrote: > On Mon, Jan 21, 2019 at 10:52:37AM +0100, Dmitry Vyukov wrote: > > On Wed, Jan 16, 2019 at 1:51 PM Dmitry Vyukov wrote: > > > > KCOV uses refcounts in a very simple canonical way, so no hidden > > > ordering implied. > > > > > > Am I missing something

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Andrea Parri
On Mon, Jan 21, 2019 at 01:29:11PM +0100, Dmitry Vyukov wrote: > On Mon, Jan 21, 2019 at 12:45 PM Andrea Parri > wrote: > > > > On Mon, Jan 21, 2019 at 10:52:37AM +0100, Dmitry Vyukov wrote: > > > > [...] > > > > > > Am I missing something or refcount_dec_and_test does not in fact > > > > provide

RE: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Reshetova, Elena
> Just to check, has this been tested with CONFIG_REFCOUNT_FULL and > > something poking kcov? > > > > Given lib/refcount.c is instrumented, the refcount_*() calls will > > recurse back into the kcov code. It looks like that's fine, given these > > are only manipulated in setup/teardown paths, but

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Peter Zijlstra
On Mon, Jan 21, 2019 at 10:52:37AM +0100, Dmitry Vyukov wrote: > On Wed, Jan 16, 2019 at 1:51 PM Dmitry Vyukov wrote: > > KCOV uses refcounts in a very simple canonical way, so no hidden > > ordering implied. > > > > Am I missing something or refcount_dec_and_test does not in fact > > provide ACQ

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Dmitry Vyukov
On Mon, Jan 21, 2019 at 1:38 PM Mark Rutland wrote: > > On Wed, Jan 16, 2019 at 12:27:09PM +0200, Elena Reshetova wrote: > > atomic_t variables are currently used to implement reference > > counters with the following properties: > > - counter is initialized to 1 using atomic_set() > > - a resou

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Mark Rutland
On Wed, Jan 16, 2019 at 12:27:09PM +0200, Elena Reshetova wrote: > atomic_t variables are currently used to implement reference > counters with the following properties: > - counter is initialized to 1 using atomic_set() > - a resource is freed upon counter reaching zero > - once counter reaches

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Dmitry Vyukov
On Mon, Jan 21, 2019 at 12:45 PM Andrea Parri wrote: > > On Mon, Jan 21, 2019 at 10:52:37AM +0100, Dmitry Vyukov wrote: > > [...] > > > > Am I missing something or refcount_dec_and_test does not in fact > > > provide ACQUIRE ordering? > > > > > > +case 5) - decrement-based RMW ops that return a v

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Andrea Parri
On Wed, Jan 16, 2019 at 12:27:09PM +0200, Elena Reshetova wrote: > atomic_t variables are currently used to implement reference > counters with the following properties: > - counter is initialized to 1 using atomic_set() > - a resource is freed upon counter reaching zero > - once counter reaches

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Andrea Parri
On Mon, Jan 21, 2019 at 10:52:37AM +0100, Dmitry Vyukov wrote: [...] > > Am I missing something or refcount_dec_and_test does not in fact > > provide ACQUIRE ordering? > > > > +case 5) - decrement-based RMW ops that return a value > > +- > > + >

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-21 Thread Dmitry Vyukov
On Wed, Jan 16, 2019 at 1:51 PM Dmitry Vyukov wrote: > > On Wed, Jan 16, 2019 at 11:27 AM Elena Reshetova > wrote: > > > > atomic_t variables are currently used to implement reference > > counters with the following properties: > > - counter is initialized to 1 using atomic_set() > > - a resour

Re: [PATCH] kcov: convert kcov.refcount to refcount_t

2019-01-16 Thread Dmitry Vyukov
On Wed, Jan 16, 2019 at 11:27 AM Elena Reshetova wrote: > > atomic_t variables are currently used to implement reference > counters with the following properties: > - counter is initialized to 1 using atomic_set() > - a resource is freed upon counter reaching zero > - once counter reaches zero,