All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rich Felker <dalias@libc.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Richard Kuo <rkuo@codeaurora.org>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Michal Simek <monstr@monstr.eu>,
	Ralf Baechle <ralf@linux-mips.org>,
	Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Stafford Horne <shorne@gmail.com>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Helge Deller <deller@gmx.de>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 1/3] futex: remove duplicated code
Date: Mon, 06 Mar 2017 01:52:07 +0000	[thread overview]
Message-ID: <20170306015207.GN1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz>

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
> assembly which is now in arch_futex_atomic_op_inuser.
> 
> Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
> remove pointless access_ok() checks") as access_ok there returns true.
> We introduce it back to the helper for the sake of simplicity (it gets
> optimized away anyway).

Overall I'm in favor of this patch, and it's close to what I had in
mind in the commit message for
00b73d8d1b7131da03aec73011a7286f566fe87f. But I'd actually like to see
it go further. These ops are mainly (only?) used for the (almost never
used) FUTEX_WAKE_OP operation, and there's very little sense in trying
to optimize them with dedicated arch-specific forms like "lock xadd".
Instead the entire logic should be in an arch-generic file, and all
the arch should need to provide is a cmpxchg-on-user-memory primitive
for it to use. On most archs, the same cmpxchg used in kernelspace
should also work for user addresses, meaning a huge amount of
unmaintained, largely untested, junk code can be removed.

Rich

WARNING: multiple messages have this Message-ID (diff)
From: Rich Felker <dalias@libc.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Richard Kuo <rkuo@codeaurora.org>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Michal Simek <monstr@monstr.eu>,
	Ralf Baechle <ralf@linux-mips.org>,
	Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Stafford Horne <shorne@gmail.com>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Helge Deller <deller@gmx.de>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Subject: Re: [PATCH 1/3] futex: remove duplicated code
Date: Sun, 5 Mar 2017 20:52:07 -0500	[thread overview]
Message-ID: <20170306015207.GN1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz>

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
> assembly which is now in arch_futex_atomic_op_inuser.
> 
> Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
> remove pointless access_ok() checks") as access_ok there returns true.
> We introduce it back to the helper for the sake of simplicity (it gets
> optimized away anyway).

Overall I'm in favor of this patch, and it's close to what I had in
mind in the commit message for
00b73d8d1b7131da03aec73011a7286f566fe87f. But I'd actually like to see
it go further. These ops are mainly (only?) used for the (almost never
used) FUTEX_WAKE_OP operation, and there's very little sense in trying
to optimize them with dedicated arch-specific forms like "lock xadd".
Instead the entire logic should be in an arch-generic file, and all
the arch should need to provide is a cmpxchg-on-user-memory primitive
for it to use. On most archs, the same cmpxchg used in kernelspace
should also work for user addresses, meaning a huge amount of
unmaintained, largely untested, junk code can be removed.

Rich

WARNING: multiple messages have this Message-ID (diff)
From: Rich Felker <dalias@libc.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Richard Kuo <rkuo@codeaurora.org>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Michal Simek <monstr@monstr.eu>,
	Ralf Baechle <ralf@linux-mips.org>,
	Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Stafford Horne <shorne@gmail.com>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Helge Deller <deller@gmx.de>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	"David S. Miller" <davem@davemloft.net>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Chris Zankel <chris@zankel.net>,
	Max Filippov <jcmvbkbc@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	x86@kernel.org, linux-alpha@vger.kernel.org,
	linux-snps-arc@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org,
	linux-mips@linux-mips.org, openrisc@lists.librecores.org,
	linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-s390@vger.kernel.org, linux-sh@vger.kernel.org,
	sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH 1/3] futex: remove duplicated code
Date: Sun, 5 Mar 2017 20:52:07 -0500	[thread overview]
Message-ID: <20170306015207.GN1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz>

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
> assembly which is now in arch_futex_atomic_op_inuser.
> 
> Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
> remove pointless access_ok() checks") as access_ok there returns true.
> We introduce it back to the helper for the sake of simplicity (it gets
> optimized away anyway).

Overall I'm in favor of this patch, and it's close to what I had in
mind in the commit message for
00b73d8d1b7131da03aec73011a7286f566fe87f. But I'd actually like to see
it go further. These ops are mainly (only?) used for the (almost never
used) FUTEX_WAKE_OP operation, and there's very little sense in trying
to optimize them with dedicated arch-specific forms like "lock xadd".
Instead the entire logic should be in an arch-generic file, and all
the arch should need to provide is a cmpxchg-on-user-memory primitive
for it to use. On most archs, the same cmpxchg used in kernelspace
should also work for user addresses, meaning a huge amount of
unmaintained, largely untested, junk code can be removed.

Rich

WARNING: multiple messages have this Message-ID (diff)
From: Rich Felker <dalias@libc.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Richard Henderson <rth@twiddle.net>,
	Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	Matt Turner <mattst88@gmail.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Richard Kuo <rkuo@codeaurora.org>,
	Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Michal Simek <monstr@monstr.eu>,
	Ralf Baechle <ralf@linux-mips.org>,
	Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Stafford Horne <shorne@gmail.com>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Helge Deller <deller@gmx.de>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 1/3] futex: remove duplicated code
Date: Sun, 5 Mar 2017 20:52:07 -0500	[thread overview]
Message-ID: <20170306015207.GN1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz>

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
> assembly which is now in arch_futex_atomic_op_inuser.
> 
> Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
> remove pointless access_ok() checks") as access_ok there returns true.
> We introduce it back to the helper for the sake of simplicity (it gets
> optimized away anyway).

Overall I'm in favor of this patch, and it's close to what I had in
mind in the commit message for
00b73d8d1b7131da03aec73011a7286f566fe87f. But I'd actually like to see
it go further. These ops are mainly (only?) used for the (almost never
used) FUTEX_WAKE_OP operation, and there's very little sense in trying
to optimize them with dedicated arch-specific forms like "lock xadd".
Instead the entire logic should be in an arch-generic file, and all
the arch should need to provide is a cmpxchg-on-user-memory primitive
for it to use. On most archs, the same cmpxchg used in kernelspace
should also work for user addresses, meaning a huge amount of
unmaintained, largely untested, junk code can be removed.

Rich

WARNING: multiple messages have this Message-ID (diff)
From: dalias@libc.org (Rich Felker)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH 1/3] futex: remove duplicated code
Date: Sun, 5 Mar 2017 20:52:07 -0500	[thread overview]
Message-ID: <20170306015207.GN1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz>

On Fri, Mar 03, 2017@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
> assembly which is now in arch_futex_atomic_op_inuser.
> 
> Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
> remove pointless access_ok() checks") as access_ok there returns true.
> We introduce it back to the helper for the sake of simplicity (it gets
> optimized away anyway).

Overall I'm in favor of this patch, and it's close to what I had in
mind in the commit message for
00b73d8d1b7131da03aec73011a7286f566fe87f. But I'd actually like to see
it go further. These ops are mainly (only?) used for the (almost never
used) FUTEX_WAKE_OP operation, and there's very little sense in trying
to optimize them with dedicated arch-specific forms like "lock xadd".
Instead the entire logic should be in an arch-generic file, and all
the arch should need to provide is a cmpxchg-on-user-memory primitive
for it to use. On most archs, the same cmpxchg used in kernelspace
should also work for user addresses, meaning a huge amount of
unmaintained, largely untested, junk code can be removed.

Rich

WARNING: multiple messages have this Message-ID (diff)
From: dalias@libc.org (Rich Felker)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] futex: remove duplicated code
Date: Sun, 5 Mar 2017 20:52:07 -0500	[thread overview]
Message-ID: <20170306015207.GN1520@brightrain.aerifal.cx> (raw)
In-Reply-To: <20170303122712.13353-1-jslaby@suse.cz>

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
> assembly which is now in arch_futex_atomic_op_inuser.
> 
> Note that s390 removed access_ok check in d12a29703 ("s390/uaccess:
> remove pointless access_ok() checks") as access_ok there returns true.
> We introduce it back to the helper for the sake of simplicity (it gets
> optimized away anyway).

Overall I'm in favor of this patch, and it's close to what I had in
mind in the commit message for
00b73d8d1b7131da03aec73011a7286f566fe87f. But I'd actually like to see
it go further. These ops are mainly (only?) used for the (almost never
used) FUTEX_WAKE_OP operation, and there's very little sense in trying
to optimize them with dedicated arch-specific forms like "lock xadd".
Instead the entire logic should be in an arch-generic file, and all
the arch should need to provide is a cmpxchg-on-user-memory primitive
for it to use. On most archs, the same cmpxchg used in kernelspace
should also work for user addresses, meaning a huge amount of
unmaintained, largely untested, junk code can be removed.

Rich

  parent reply	other threads:[~2017-03-06  1:52 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 12:27 [PATCH 1/3] futex: remove duplicated code Jiri Slaby
2017-03-03 12:27 ` [OpenRISC] " Jiri Slaby
2017-03-03 12:27 ` Jiri Slaby
2017-03-03 12:27 ` Jiri Slaby
2017-03-03 12:27 ` Jiri Slaby
2017-03-03 12:27 ` Jiri Slaby
2017-03-03 12:27 ` [PATCH 2/3] futex: fix decoding of operation Jiri Slaby
2017-03-03 12:27 ` [PATCH 3/3] futex: make the encoded_op decoding readable Jiri Slaby
2017-03-05  7:55   ` Jiri Slaby
2017-03-03 14:08 ` [PATCH 1/3] futex: remove duplicated code Heiko Carstens
2017-03-03 14:08   ` Heiko Carstens
2017-03-03 14:08   ` Heiko Carstens
2017-03-03 14:08   ` Heiko Carstens
2017-03-03 14:08   ` Heiko Carstens
2017-03-03 14:08   ` Heiko Carstens
2017-03-03 14:48 ` Chris Metcalf
2017-03-03 14:48   ` Chris Metcalf
2017-03-03 14:48   ` Chris Metcalf
2017-03-03 14:48   ` Chris Metcalf
2017-03-03 14:48   ` Chris Metcalf
2017-03-03 14:48   ` Chris Metcalf
2017-03-03 14:48   ` Chris Metcalf
2017-03-04 12:49 ` Michael Ellerman
2017-03-04 12:49   ` Michael Ellerman
2017-03-04 12:49   ` Michael Ellerman
2017-03-04 12:49   ` Michael Ellerman
2017-03-04 12:49   ` Michael Ellerman
2017-03-04 12:49   ` Michael Ellerman
2017-03-04 12:49   ` Michael Ellerman
2017-03-04 13:05 ` Russell King - ARM Linux
2017-03-04 13:05   ` Russell King - ARM Linux
2017-03-04 13:05   ` Russell King - ARM Linux
2017-03-04 13:05   ` Russell King - ARM Linux
2017-03-04 13:05   ` Russell King - ARM Linux
2017-03-04 13:05   ` Russell King - ARM Linux
2017-03-04 19:15   ` H. Peter Anvin
2017-03-04 19:15     ` H. Peter Anvin
2017-03-04 19:15     ` H. Peter Anvin
2017-03-04 19:15     ` H. Peter Anvin
2017-03-04 19:15     ` H. Peter Anvin
2017-03-04 19:15     ` H. Peter Anvin
2017-03-04 21:38     ` Stafford Horne
2017-03-04 21:38       ` [OpenRISC] " Stafford Horne
2017-03-04 21:38       ` Stafford Horne
2017-03-04 21:38       ` Stafford Horne
2017-03-04 21:38       ` Stafford Horne
2017-03-04 21:38       ` Stafford Horne
2017-03-04 21:38       ` Stafford Horne
2017-03-04 23:03       ` H. Peter Anvin
2017-03-04 23:03         ` H. Peter Anvin
2017-03-04 23:03         ` H. Peter Anvin
2017-03-04 23:03         ` H. Peter Anvin
2017-03-04 23:03       ` H. Peter Anvin
2017-03-04 23:03       ` H. Peter Anvin
2017-03-04 23:03       ` H. Peter Anvin
2017-03-04 23:03       ` H. Peter Anvin
2017-03-04 23:08       ` H. Peter Anvin
2017-03-04 23:08       ` H. Peter Anvin
2017-03-04 23:08       ` H. Peter Anvin
2017-03-04 23:08       ` H. Peter Anvin
2017-03-04 23:08         ` H. Peter Anvin
2017-03-04 23:08         ` H. Peter Anvin
2017-03-04 23:08         ` H. Peter Anvin
2017-03-04 23:39         ` Stafford Horne
2017-03-06  8:46           ` Jiri Slaby
2017-03-06  9:13             ` H. Peter Anvin
2017-03-06 14:14             ` Geert Uytterhoeven
2017-03-04 23:08       ` H. Peter Anvin
2017-03-09  4:16   ` Rob Landley
2017-03-09  4:16     ` Rob Landley
2017-03-09  4:16     ` Rob Landley
2017-03-09  4:16     ` Rob Landley
2017-03-09  4:16     ` Rob Landley
2017-03-09  4:36     ` H. Peter Anvin
2017-03-09  4:36     ` H. Peter Anvin
2017-03-09  4:36     ` H. Peter Anvin
2017-03-09  4:36     ` H. Peter Anvin
2017-03-09  4:36     ` H. Peter Anvin
2017-03-09  4:36       ` H. Peter Anvin
2017-03-09  4:36       ` H. Peter Anvin
2017-03-09  4:36       ` H. Peter Anvin
2017-03-09 22:37       ` Rich Felker
2017-03-06  1:52 ` Rich Felker [this message]
2017-03-06  1:52   ` Rich Felker
2017-03-06  1:52   ` Rich Felker
2017-03-06  1:52   ` Rich Felker
2017-03-06  1:52   ` Rich Felker
2017-03-06  1:52   ` Rich Felker
2017-03-09 22:43 ` Vineet Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170306015207.GN1520@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=deller@gmx.de \
    --cc=fenghua.yu@intel.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=jejb@parisc-linux.org \
    --cc=jonas@southpole.se \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mattst88@gmail.com \
    --cc=monstr@monstr.eu \
    --cc=ralf@linux-mips.org \
    --cc=rkuo@codeaurora.org \
    --cc=rth@twiddle.net \
    --cc=shorne@gmail.com \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=tony.luck@intel.com \
    --cc=vgupta@synopsys.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.