Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:39, Peter Zijlstra wrote: > > So I think using bool as return type or argument is fine, using it in > structures is 'insane'. > Yes, scalar use only, and not across the kernel boundary, please. -hpa

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:39, Peter Zijlstra wrote: > > So I think using bool as return type or argument is fine, using it in > structures is 'insane'. > Yes, scalar use only, and not across the kernel boundary, please. -hpa

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:20, Ingo Molnar wrote: > > Also, unless I'm missing something it's not really 'hard' or dangerous per se > to > do that change for every architecture, just incredibly boring! ;-) > > I'm not sure how much it matters though, given other asymmetries in the > bitops API >

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:20, Ingo Molnar wrote: > > Also, unless I'm missing something it's not really 'hard' or dangerous per se > to > do that change for every architecture, just incredibly boring! ;-) > > I'm not sure how much it matters though, given other asymmetries in the > bitops API >

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Peter Zijlstra
On Wed, Jun 08, 2016 at 02:31:31AM -0700, H. Peter Anvin wrote: > On 06/08/16 02:20, Ingo Molnar wrote: > > > > Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates > > worse code > > with modern compilers then I'm not going to argue for worse code. Would a > > 'char' > >

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Peter Zijlstra
On Wed, Jun 08, 2016 at 02:31:31AM -0700, H. Peter Anvin wrote: > On 06/08/16 02:20, Ingo Molnar wrote: > > > > Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates > > worse code > > with modern compilers then I'm not going to argue for worse code. Would a > > 'char' > >

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:20, Ingo Molnar wrote: > > Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates worse > code > with modern compilers then I'm not going to argue for worse code. Would a > 'char' > return type be very weird? > Yes. I have to admit I don't share your hatred

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:20, Ingo Molnar wrote: > > Yeah, absolutely. I hate 'bool' with a vengence but if 'int' generates worse > code > with modern compilers then I'm not going to argue for worse code. Would a > 'char' > return type be very weird? > Yes. I have to admit I don't share your hatred

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* H. Peter Anvin wrote: > On 06/08/16 02:01, Ingo Molnar wrote: > > > > That's a divergence with an underlying reason - but not harmonizing the > > return > > code is an unforced error AFAICS and can be fixed. > > > > Perhaps. It is also no real question that "bool" is the

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* H. Peter Anvin wrote: > On 06/08/16 02:01, Ingo Molnar wrote: > > > > That's a divergence with an underlying reason - but not harmonizing the > > return > > code is an unforced error AFAICS and can be fixed. > > > > Perhaps. It is also no real question that "bool" is the right return >

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:01, Ingo Molnar wrote: > > That's a divergence with an underlying reason - but not harmonizing the > return > code is an unforced error AFAICS and can be fixed. > Perhaps. It is also no real question that "bool" is the right return type for a single bit. Changing that in all

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 02:01, Ingo Molnar wrote: > > That's a divergence with an underlying reason - but not harmonizing the > return > code is an unforced error AFAICS and can be fixed. > Perhaps. It is also no real question that "bool" is the right return type for a single bit. Changing that in all

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* H. Peter Anvin wrote: > On 06/08/16 01:28, Ingo Molnar wrote: > > > > It does matter: > > > > In file included from arch/x86/kernel/cpu/common.c:21:0: > > ./arch/x86/include/asm/archrandom.h:95:20: error: redefinition of > > ‘arch_get_random_long’ > > static inline bool

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* H. Peter Anvin wrote: > On 06/08/16 01:28, Ingo Molnar wrote: > > > > It does matter: > > > > In file included from arch/x86/kernel/cpu/common.c:21:0: > > ./arch/x86/include/asm/archrandom.h:95:20: error: redefinition of > > ‘arch_get_random_long’ > > static inline bool

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* H. Peter Anvin wrote: > On 06/08/16 01:33, Ingo Molnar wrote: > > > > Note that this particular build error was introduced by b0bdba9825fe, a > > later > > patch in this series - but in generaly I'm uneasy about allowing function > > signatures diverge between

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* H. Peter Anvin wrote: > On 06/08/16 01:33, Ingo Molnar wrote: > > > > Note that this particular build error was introduced by b0bdba9825fe, a > > later > > patch in this series - but in generaly I'm uneasy about allowing function > > signatures diverge between architectures. > > > > For

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 01:28, Ingo Molnar wrote: > > It does matter: > > In file included from arch/x86/kernel/cpu/common.c:21:0: > ./arch/x86/include/asm/archrandom.h:95:20: error: redefinition of > ‘arch_get_random_long’ > static inline bool arch_get_random_long(unsigned long *v) > In file included

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 01:28, Ingo Molnar wrote: > > It does matter: > > In file included from arch/x86/kernel/cpu/common.c:21:0: > ./arch/x86/include/asm/archrandom.h:95:20: error: redefinition of > ‘arch_get_random_long’ > static inline bool arch_get_random_long(unsigned long *v) > In file included

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 01:33, Ingo Molnar wrote: > > Note that this particular build error was introduced by b0bdba9825fe, a later > patch in this series - but in generaly I'm uneasy about allowing function > signatures diverge between architectures. > For the bitops, they already do: PowerPC, for

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread H. Peter Anvin
On 06/08/16 01:33, Ingo Molnar wrote: > > Note that this particular build error was introduced by b0bdba9825fe, a later > patch in this series - but in generaly I'm uneasy about allowing function > signatures diverge between architectures. > For the bitops, they already do: PowerPC, for

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* Ingo Molnar wrote: > > * Peter Zijlstra wrote: > > > On Tue, Jun 07, 2016 at 04:31:01PM -0700, H. Peter Anvin wrote: > > > From: "H. Peter Anvin" > > > > > > The gcc people have confirmed that using "bool" when combined with > > >

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* Ingo Molnar wrote: > > * Peter Zijlstra wrote: > > > On Tue, Jun 07, 2016 at 04:31:01PM -0700, H. Peter Anvin wrote: > > > From: "H. Peter Anvin" > > > > > > The gcc people have confirmed that using "bool" when combined with > > > inline assembly always is treated as a byte-sized operand

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* Peter Zijlstra wrote: > On Tue, Jun 07, 2016 at 04:31:01PM -0700, H. Peter Anvin wrote: > > From: "H. Peter Anvin" > > > > The gcc people have confirmed that using "bool" when combined with > > inline assembly always is treated as a byte-sized operand

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Ingo Molnar
* Peter Zijlstra wrote: > On Tue, Jun 07, 2016 at 04:31:01PM -0700, H. Peter Anvin wrote: > > From: "H. Peter Anvin" > > > > The gcc people have confirmed that using "bool" when combined with > > inline assembly always is treated as a byte-sized operand that can be > > assumed to be 0 or 1,

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Peter Zijlstra
On Tue, Jun 07, 2016 at 04:31:01PM -0700, H. Peter Anvin wrote: > From: "H. Peter Anvin" > > The gcc people have confirmed that using "bool" when combined with > inline assembly always is treated as a byte-sized operand that can be > assumed to be 0 or 1, which is exactly what

Re: [PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-08 Thread Peter Zijlstra
On Tue, Jun 07, 2016 at 04:31:01PM -0700, H. Peter Anvin wrote: > From: "H. Peter Anvin" > > The gcc people have confirmed that using "bool" when combined with > inline assembly always is treated as a byte-sized operand that can be > assumed to be 0 or 1, which is exactly what the SET

[PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-07 Thread H. Peter Anvin
From: "H. Peter Anvin" The gcc people have confirmed that using "bool" when combined with inline assembly always is treated as a byte-sized operand that can be assumed to be 0 or 1, which is exactly what the SET instruction emits. Change the output types and intermediate

[PATCH 02/10] x86, asm: use bool for bitops and other assembly outputs

2016-06-07 Thread H. Peter Anvin
From: "H. Peter Anvin" The gcc people have confirmed that using "bool" when combined with inline assembly always is treated as a byte-sized operand that can be assumed to be 0 or 1, which is exactly what the SET instruction emits. Change the output types and intermediate variables of as many