Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Paolo Bonzini
> > > Isn't that what we have static_key_enable() for? Which btw also uses > > > static_key_count() outside of the mutex. > > > > Yes, they should be fixed and net/ can then use static_key_enable. > > Right, let me try and fix _enable(). Here is what I scribbled before leaving the office.

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Paolo Bonzini
> > > Isn't that what we have static_key_enable() for? Which btw also uses > > > static_key_count() outside of the mutex. > > > > Yes, they should be fixed and net/ can then use static_key_enable. > > Right, let me try and fix _enable(). Here is what I scribbled before leaving the office.

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Dima Zavin
On Mon, Jul 31, 2017 at 6:33 AM, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: >> - key->enabled cannot go from 0 to nonzero outside jump_label_mutex. >> For this reason the atomic_try_cmpxchg is unnecessary. > > Agreed, the only

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Dima Zavin
On Mon, Jul 31, 2017 at 6:33 AM, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: >> - key->enabled cannot go from 0 to nonzero outside jump_label_mutex. >> For this reason the atomic_try_cmpxchg is unnecessary. > > Agreed, the only reason was the implied

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Peter Zijlstra
On Mon, Jul 31, 2017 at 05:35:40PM +0200, Paolo Bonzini wrote: > On 31/07/2017 15:33, Peter Zijlstra wrote: > > On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: > >> - the smp_mb (though it could be a smp_wmb or atomic_set_release) > >> initially triggered my paranoia indeed. But

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Peter Zijlstra
On Mon, Jul 31, 2017 at 05:35:40PM +0200, Paolo Bonzini wrote: > On 31/07/2017 15:33, Peter Zijlstra wrote: > > On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: > >> - the smp_mb (though it could be a smp_wmb or atomic_set_release) > >> initially triggered my paranoia indeed. But

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Paolo Bonzini
On 31/07/2017 15:33, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: >> - the smp_mb (though it could be a smp_wmb or atomic_set_release) >> initially triggered my paranoia indeed. But even then, I can't see why >> you would need it because there's nothing

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Paolo Bonzini
On 31/07/2017 15:33, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: >> - the smp_mb (though it could be a smp_wmb or atomic_set_release) >> initially triggered my paranoia indeed. But even then, I can't see why >> you would need it because there's nothing

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Peter Zijlstra
On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: > - key->enabled cannot go from 0 to nonzero outside jump_label_mutex. > For this reason the atomic_try_cmpxchg is unnecessary. Agreed, the only reason was the implied barrier. > - the (implied) smp_mb before jump_label_update is not

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Peter Zijlstra
On Mon, Jul 31, 2017 at 03:04:06PM +0200, Paolo Bonzini wrote: > - key->enabled cannot go from 0 to nonzero outside jump_label_mutex. > For this reason the atomic_try_cmpxchg is unnecessary. Agreed, the only reason was the implied barrier. > - the (implied) smp_mb before jump_label_update is not

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Paolo Bonzini
On 31/07/2017 11:36, Peter Zijlstra wrote: > On Fri, Jun 24, 2016 at 01:59:06AM -0700, tip-bot for Paolo Bonzini wrote: >> +++ b/kernel/jump_label.c >> @@ -58,13 +58,36 @@ static void jump_label_update(struct static_key *key); >> >> void static_key_slow_inc(struct static_key *key) >> { >> +

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Paolo Bonzini
On 31/07/2017 11:36, Peter Zijlstra wrote: > On Fri, Jun 24, 2016 at 01:59:06AM -0700, tip-bot for Paolo Bonzini wrote: >> +++ b/kernel/jump_label.c >> @@ -58,13 +58,36 @@ static void jump_label_update(struct static_key *key); >> >> void static_key_slow_inc(struct static_key *key) >> { >> +

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Peter Zijlstra
On Fri, Jun 24, 2016 at 01:59:06AM -0700, tip-bot for Paolo Bonzini wrote: > +++ b/kernel/jump_label.c > @@ -58,13 +58,36 @@ static void jump_label_update(struct static_key *key); > > void static_key_slow_inc(struct static_key *key) > { > + int v, v1; > + > STATIC_KEY_CHECK_USE(); >

Re: [tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2017-07-31 Thread Peter Zijlstra
On Fri, Jun 24, 2016 at 01:59:06AM -0700, tip-bot for Paolo Bonzini wrote: > +++ b/kernel/jump_label.c > @@ -58,13 +58,36 @@ static void jump_label_update(struct static_key *key); > > void static_key_slow_inc(struct static_key *key) > { > + int v, v1; > + > STATIC_KEY_CHECK_USE(); >

[tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2016-06-24 Thread tip-bot for Paolo Bonzini
Commit-ID: 4c5ea0a9cd02d6aa8adc86e100b2a4cff8d614ff Gitweb: http://git.kernel.org/tip/4c5ea0a9cd02d6aa8adc86e100b2a4cff8d614ff Author: Paolo Bonzini AuthorDate: Tue, 21 Jun 2016 18:52:17 +0200 Committer: Ingo Molnar CommitDate: Fri, 24 Jun 2016

[tip:locking/urgent] locking/static_key: Fix concurrent static_key_slow_inc()

2016-06-24 Thread tip-bot for Paolo Bonzini
Commit-ID: 4c5ea0a9cd02d6aa8adc86e100b2a4cff8d614ff Gitweb: http://git.kernel.org/tip/4c5ea0a9cd02d6aa8adc86e100b2a4cff8d614ff Author: Paolo Bonzini AuthorDate: Tue, 21 Jun 2016 18:52:17 +0200 Committer: Ingo Molnar CommitDate: Fri, 24 Jun 2016 08:23:16 +0200 locking/static_key: Fix