Re: [PATCH 1/3] futex: remove duplicated code

2017-03-09 Thread Vineet Gupta
On 03/03/2017 04:27 AM, Jiri Slaby wrote: > There is code duplicated over all architecture's headers for > futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr, > and comparison of the result. > > Remove this duplication and leave up to the arches only the needed > assembly which

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-09 Thread Rich Felker
On Wed, Mar 08, 2017 at 08:36:30PM -0800, H. Peter Anvin wrote: > ,Thomas Gleixner ,Ingo Molnar > ,Chris Zankel ,Max Filippov > ,Arnd Bergmann > ,x...@kernel.org,linux-al...@vger.kernel.org,linux-snps-...@lists.infradead.org,linux-arm-ker...@lists.infradead.org,linux-hexa...@vger.kernel.org,linu

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-08 Thread H. Peter Anvin
,Thomas Gleixner ,Ingo Molnar ,Chris Zankel ,Max Filippov ,Arnd Bergmann ,x...@kernel.org,linux-al...@vger.kernel.org,linux-snps-...@lists.infradead.org,linux-arm-ker...@lists.infradead.org,linux-hexa...@vger.kernel.org,linux-i...@vger.kernel.org,linux-m...@linux-mips.org,openr...@lists.librecor

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-08 Thread Rob Landley
On 03/04/2017 07:05 AM, Russell King - ARM Linux wrote: > On Fri, Mar 03, 2017 at 01:27:10PM +0100, Jiri Slaby wrote: >> diff --git a/kernel/futex.c b/kernel/futex.c >> index b687cb22301c..c5ff9850952f 100644 >> --- a/kernel/futex.c >> +++ b/kernel/futex.c >> @@ -1457,6 +1457,42 @@ futex_wake(u32 _

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-06 Thread Geert Uytterhoeven
Hi Jiri, On Mon, Mar 6, 2017 at 9:46 AM, Jiri Slaby wrote: > futex: make the encoded_op decoding readable > > Decoding of encoded_op is a bit unreadable. It contains shifts to the > left and to the right by some constants. Make it clearly visible what > part of the bit mask is tak

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-06 Thread H. Peter Anvin
On 03/06/17 00:46, Jiri Slaby wrote: > > static int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) > { > - int op = (encoded_op >> 28) & 7; > - int cmp = (encoded_op >> 24) & 15; > - int oparg = (encoded_op << 8) >> 20; > - int cmparg = (encoded_op << 20) >> 20

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-06 Thread Jiri Slaby
On 03/05/2017, 12:39 AM, Stafford Horne wrote: > On Sat, Mar 04, 2017 at 03:08:50PM -0800, H. Peter Anvin wrote: >> ,Chris Metcalf ,Thomas Gleixner >> ,Ingo Molnar ,Chris Zankel >> ,Max Filippov ,Arnd Bergmann >> ,x...@kernel.org,linux-al...@vger.kernel.org,linux-snps-...@lists.infradead.org,lin

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-05 Thread Rich Felker
On Fri, Mar 03, 2017 at 01:27:10PM +0100, Jiri Slaby wrote: > There is code duplicated over all architecture's headers for > futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr, > and comparison of the result. > > Remove this duplication and leave up to the arches only the needed

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread Stafford Horne
On Sat, Mar 04, 2017 at 03:08:50PM -0800, H. Peter Anvin wrote: > ,Chris Metcalf ,Thomas Gleixner > ,Ingo Molnar ,Chris Zankel > ,Max Filippov ,Arnd Bergmann > ,x...@kernel.org,linux-al...@vger.kernel.org,linux-snps-...@lists.infradead.org,linux-arm-ker...@lists.infradead.org,linux-hexa...@vger.

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread H. Peter Anvin
,Chris Metcalf ,Thomas Gleixner ,Ingo Molnar ,Chris Zankel ,Max Filippov ,Arnd Bergmann ,x...@kernel.org,linux-al...@vger.kernel.org,linux-snps-...@lists.infradead.org,linux-arm-ker...@lists.infradead.org,linux-hexa...@vger.kernel.org,linux-i...@vger.kernel.org,linux-m...@linux-mips.org,openr...

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread H. Peter Anvin
,Chris Metcalf ,Thomas Gleixner ,Ingo Molnar ,Chris Zankel ,Max Filippov ,Arnd Bergmann ,x...@kernel.org,linux-al...@vger.kernel.org,linux-snps-...@lists.infradead.org,linux-arm-ker...@lists.infradead.org,linux-hexa...@vger.kernel.org,linux-i...@vger.kernel.org,linux-m...@linux-mips.org,openr...

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread Stafford Horne
On Sat, Mar 04, 2017 at 11:15:17AM -0800, H. Peter Anvin wrote: > On 03/04/17 05:05, Russell King - ARM Linux wrote: > >> > >> +static int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) > >> +{ > >> + int op = (encoded_op >> 28) & 7; > >> + int cmp = (encoded_op >> 24) & 15; > >> +

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread H. Peter Anvin
On 03/04/17 05:05, Russell King - ARM Linux wrote: >> >> +static int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) >> +{ >> +int op = (encoded_op >> 28) & 7; >> +int cmp = (encoded_op >> 24) & 15; >> +int oparg = (encoded_op << 8) >> 20; >> +int cmparg = (encoded_op <<

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread Russell King - ARM Linux
On Fri, Mar 03, 2017 at 01:27:10PM +0100, Jiri Slaby wrote: > diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h > index 6795368ad023..cc414382dab4 100644 > --- a/arch/arm/include/asm/futex.h > +++ b/arch/arm/include/asm/futex.h > @@ -128,20 +128,10 @@ futex_atomic_cmpxchg_ina

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-04 Thread Michael Ellerman
Jiri Slaby writes: > There is code duplicated over all architecture's headers for > futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr, > and comparison of the result. > > Remove this duplication and leave up to the arches only the needed > assembly which is now in arch_futex_a

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-03 Thread Heiko Carstens
On Fri, Mar 03, 2017 at 01:27:10PM +0100, Jiri Slaby wrote: > There is code duplicated over all architecture's headers for > futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr, > and comparison of the result. > > Remove this duplication and leave up to the arches only the needed

Re: [PATCH 1/3] futex: remove duplicated code

2017-03-03 Thread Chris Metcalf
On 3/3/2017 7:27 AM, Jiri Slaby wrote: There is code duplicated over all architecture's headers for futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr, and comparison of the result. Remove this duplication and leave up to the arches only the needed assembly which is now in arc

[PATCH 1/3] futex: remove duplicated code

2017-03-03 Thread Jiri Slaby
There is code duplicated over all architecture's headers for futex_atomic_op_inuser. Namely op decoding, access_ok check for uaddr, and comparison of the result. Remove this duplication and leave up to the arches only the needed assembly which is now in arch_futex_atomic_op_inuser. Note that s390