Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-04 Thread Steven Rostedt
On Tue, 4 Aug 2015 16:33:44 +0200 Borislav Petkov wrote: > Hell, we can drop that "key" or "branch" from the whole API for all I > know. "static_" is enough for me to say what the thing is. But that's > just me - I like short names - no poems in code and sh*t. > > Thoughts, comments? I agree to

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-04 Thread Andy Lutomirski
On Tue, Aug 4, 2015 at 7:33 AM, Borislav Petkov wrote: > On Tue, Aug 04, 2015 at 08:06:45AM -0400, Steven Rostedt wrote: >> I just don't like the inconsistency of the initialization and the >> setting. >> >> Either have: >> >> DEFINE_STATIC_KEY_TRUE() >> DEFINE_STATIC_KEY_FALSE() >> >> and >> >>

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-04 Thread Borislav Petkov
On Tue, Aug 04, 2015 at 08:06:45AM -0400, Steven Rostedt wrote: > I just don't like the inconsistency of the initialization and the > setting. > > Either have: > > DEFINE_STATIC_KEY_TRUE() > DEFINE_STATIC_KEY_FALSE() > > and > > static_branch_set_true() > static_branch_set_false() > > > o

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-04 Thread Steven Rostedt
On Tue, 4 Aug 2015 05:37:33 +0200 Borislav Petkov wrote: > On Mon, Aug 03, 2015 at 05:57:57PM -0400, Steven Rostedt wrote: > > That's implementation details, not a general concept that users will > > need to know about. > > Why? > > It is a branch, regardless of which insn is used on which arch

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-04 Thread Peter Zijlstra
On Tue, Aug 04, 2015 at 02:50:32PM +0800, yalin wang wrote: > is this means static_key_{true,false}() are deprecated ? Yes. > do you need mark static_key_{true,false}() as deprecated? > like this: > static __always_inline __deprecated bool static_key_false(struct static_key > *key) ? Not unti

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread yalin wang
> On Jul 28, 2015, at 21:21, Peter Zijlstra wrote: > > There are various problems and short-comings with the current > static_key interface: > > - static_key_{true,false}() read like a branch depending on the key > value, instead of the actual likely/unlikely branch depending on > init valu

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Borislav Petkov
On Mon, Aug 03, 2015 at 09:07:53PM -0700, Andy Lutomirski wrote: > Except that, with the new interface, static_key_likely is the other > way around, right? If the key is true (i.e. enabled), then it doesn't > branch. > > I think of the key as a boolean thing that happens to work by code > patchin

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Andy Lutomirski
On Mon, Aug 3, 2015 at 8:37 PM, Borislav Petkov wrote: > On Mon, Aug 03, 2015 at 05:57:57PM -0400, Steven Rostedt wrote: >> That's implementation details, not a general concept that users will >> need to know about. > > Why? > > It is a branch, regardless of which insn is used on which arch - it i

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Borislav Petkov
On Mon, Aug 03, 2015 at 05:57:57PM -0400, Steven Rostedt wrote: > That's implementation details, not a general concept that users will > need to know about. Why? It is a branch, regardless of which insn is used on which arch - it is either active and you *branch* to that code or *inactive* and yo

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Steven Rostedt
On Mon, 3 Aug 2015 22:00:02 +0200 Peter Zijlstra wrote: > On Mon, Aug 03, 2015 at 03:28:10PM -0400, Steven Rostedt wrote: > > Technically, one can think: "activate the branch", but we are > > activating not the branch, but the jump label itself. > > No you are enabling the branch, you're making

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Peter Zijlstra
On Mon, Aug 03, 2015 at 03:28:10PM -0400, Steven Rostedt wrote: > Technically, one can think: "activate the branch", but we are > activating not the branch, but the jump label itself. No you are enabling the branch, you're making the branch body active. There is no enable/disable/true/false for t

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Steven Rostedt
On Mon, 3 Aug 2015 21:18:16 +0200 Peter Zijlstra wrote: > On Mon, Aug 03, 2015 at 03:03:59PM -0400, Steven Rostedt wrote: > > > I wonder if static_branch_set_false(&blah) would be a better name to > > understand. What does "disable" / "enable" mean? > > "make false" / "make true" ? Check a loca

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Peter Zijlstra
On Mon, Aug 03, 2015 at 03:03:59PM -0400, Steven Rostedt wrote: > I wonder if static_branch_set_false(&blah) would be a better name to > understand. What does "disable" / "enable" mean? "make false" / "make true" ? Check a local dictionary. http://lmgtfy.com/?q=enable "2. computing: make (a dev

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-08-03 Thread Steven Rostedt
On Wed, 29 Jul 2015 10:49:06 +0200 Peter Zijlstra wrote: > On Wed, Jul 29, 2015 at 09:19:22AM +0200, Vlastimil Babka wrote: > > > How would one define a static key that's e.g. expected to be mostly false, > > but > > with initial value of true, e.g. during boot? > > DEFINE_STATIC_KEY_TRUE(blah

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-30 Thread Michael Ellerman
On Tue, 2015-07-28 at 15:21 +0200, Peter Zijlstra wrote: > There are various problems and short-comings with the current > static_key interface: ... > --- > arch/powerpc/include/asm/jump_label.h | 19 This looks sane and seems to be working, so powerpc bits: Acked-by: Michael Ellerman c

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-29 Thread Peter Zijlstra
On Wed, Jul 29, 2015 at 09:19:22AM +0200, Vlastimil Babka wrote: > How would one define a static key that's e.g. expected to be mostly false, but > with initial value of true, e.g. during boot? DEFINE_STATIC_KEY_TRUE(blah); will get you the true at boot time. You'll then want to use: i

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-29 Thread Vlastimil Babka
On 07/28/2015 03:21 PM, Peter Zijlstra wrote: > +/* > -- */ > + > +/* > + * Two type wrappers around static_key, such that we can use compile time > + * type differentiation to emit the right code. > + * > + * All the below co

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-28 Thread Heiko Carstens
On Tue, Jul 28, 2015 at 03:21:01PM +0200, Peter Zijlstra wrote: > There are various problems and short-comings with the current > static_key interface: > > - static_key_{true,false}() read like a branch depending on the key >value, instead of the actual likely/unlikely branch depending on >

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-28 Thread Peter Zijlstra
On Tue, Jul 28, 2015 at 07:00:55PM +0200, Rabin Vincent wrote: > > This is missing an include of asm/unified.h for the WASM(): > > diff --git a/arch/arm/include/asm/jump_label.h > b/arch/arm/include/asm/jump_label.h > index f8bc12f..34f7b69 100644 > --- a/arch/arm/include/asm/jump_label.h > +++

Re: [PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-28 Thread Rabin Vincent
On Tue, Jul 28, 2015 at 03:21:01PM +0200, Peter Zijlstra wrote: > --- a/arch/arm/include/asm/jump_label.h > +++ b/arch/arm/include/asm/jump_label.h > @@ -7,20 +7,28 @@ > > #define JUMP_LABEL_NOP_SIZE 4 > > -#ifdef CONFIG_THUMB2_KERNEL > -#define JUMP_LABEL_NOP "nop.w" > -#else > -#define

[PATCH -v2 6/8] jump_label: Add a new static_key interface

2015-07-28 Thread Peter Zijlstra
There are various problems and short-comings with the current static_key interface: - static_key_{true,false}() read like a branch depending on the key value, instead of the actual likely/unlikely branch depending on init value. - static_key_{true,false}() are, as stated above, tied to th