linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yury Norov <ynorov@caviumnetworks.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Dr. Philipp Tomsich" <philipp.tomsich@theobroma-systems.com>,
	linux-doc@vger.kernel.org, szabolcs.nagy@arm.com,
	heiko.carstens@de.ibm.com, cmetcalf@ezchip.com,
	"Joseph S. Myers" <joseph@codesourcery.com>,
	linux-arch@vger.kernel.org, zhouchengming1@huawei.com, "Kapoor,
	Prasun" <Prasun.Kapoor@caviumnetworks.com>,
	Alexander Graf <agraf@suse.de>,
	geert@linux-m68k.org, kilobyte@angband.pl,
	manuel.montezelo@gmail.com, Arnd Bergmann <arnd@arndb.de>,
	Andrew Pinski <pinskia@gmail.com>,
	linyongting@huawei.com, Alexey Klimov <klimov.linux@gmail.com>,
	broonie@kernel.org,
	"Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>,
	libc-alpha@sourceware.org, Nathan Lynch <Nathan_Lynch@mentor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Martin Schwidefsky <schwidefsky>
Subject: Re: [RFC2 nowrap: PATCH v7 00/18] ILP32 for ARM64
Date: Thu, 18 Aug 2016 12:45:28 +0300	[thread overview]
Message-ID: <20160818094528.GA4765@yury-N73SV> (raw)
In-Reply-To: <20160817152642.GD20762@e104818-lin.cambridge.arm.com>

On Wed, Aug 17, 2016 at 04:26:42PM +0100, Catalin Marinas wrote:
> On Wed, Aug 17, 2016 at 04:32:23PM +0200, Dr. Philipp Tomsich wrote:
> > On 17 Aug 2016, at 16:29, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > > On Wed, Aug 17, 2016 at 02:54:59PM +0200, Dr. Philipp Tomsich wrote:
> > >> On 17 Aug 2016, at 14:48, Yury Norov <ynorov@caviumnetworks.com> wrote:
> > >>> On Wed, Aug 17, 2016 at 02:28:50PM +0200, Alexander Graf wrote:
> > >>>> On 17 Aug 2016, at 13:46, Yury Norov <ynorov@caviumnetworks.com> wrote:
> > >>>>> This series enables aarch64 with ilp32 mode, and as supporting work,
> > >>>>> introduces ARCH_32BIT_OFF_T configuration option that is enabled for
> > >>>>> existing 32-bit architectures but disabled for new arches (so 64-bit
> > >>>>> off_t is is used by new userspace).
> > >>>>> 
> > >>>>> This version is based on kernel v4.8-rc2.
> > >>>>> It works with glibc-2.23, and tested with LTP.
> > >>>>> 
> > >>>>> This is RFC because there is still no solid understanding what type of registers
> > >>>>> top-halves delousing we prefer. In this patchset, w0-w7 are cleared for each
> > >>>>> syscall in assembler entry. The alternative approach is in introducing compat
> > >>>>> wrappers which is little faster for natively routed syscalls (~2.6% for syscall
> > >>>>> with no payload) but much more complicated.
> > >>>> 
> > >>>> So you’re saying there are 2 options:
> > >>>> 
> > >>>> 1) easy to get right, slightly slower, same ABI to user space as 2
> > >>>> 2) harder to get right, minor performance benefit
> > >>> 
> > >>> No, ABI is little different. If 1) we pass off_t in a pair to syscalls,
> > >>> if 2) - in a single register. So if 1, we 'd take some wrappers from aarch32.
> > >>> See patch 12 here.
> > >> 
> > >> From our experience with ILP32, I’d prefer to have off_t (and similar)
> > >> in a single register whenever possible (i.e. option #2).  It feels
> > >> more natural to use the full 64bit registers whenever possible, as
> > >> ILP32 on ARMv8 should really be understood as a 64bit ABI with a 32bit
> > >> memory model.
> > > 
> > > I think we are well past the point where we considered ILP32 a 64-bit
> > > ABI. It would have been nice but we decided that breaking POSIX
> > > compatibility is a bad idea, so we went back (again) to a 32-bit ABI for
> > > ILP32. While there are 64-bit arguments that, at a first look, would
> > > make sense to be passed in 64-bit registers, the kernel maintenance cost
> > > is significant with changes to generic files.
> > > 
> > > Allowing 64-bit wide registers at the ILP32 syscall interface means that
> > > the kernel would have to zero/sign-extend the upper half of the 32-bit
> > > arguments for the cases where they are passed directly to a native
> > > syscall that expects a 64-bit argument. This (a) adds a significant
> > > number of wrappers to the generic code together additional annotations
> > > to the generic unistd.h and (b) it adds a small overhead to the AArch32
> > > (compat) ABI since it doesn't need such generic wrapping (the upper half
> > > of 64-bit registers is guaranteed to be zero/preserved by the
> > > architecture when coming from the AArch32 mode).
> > 
> > Yes, I remember the discussions and just wanted to put option #2 in
> > context again.
> 
> I don't particularly like splitting 64-bit arguments in two 32-bit
> values either but I don't see a better alternative. To keep this
> mostly in the arch code we would need an additional table of syscall
> wrappers where the majority just use the default zero-extend everything
> with a few specific wrappers where we pass 64-bit arguments. Or we could
> set an extra bit in the syscall number for those syscalls that need
> special wrapping and avoid zero-extending. But neither of these look any
> nicer (well, maybe only from the user-space perspective).
> 

This is the discussion started by David Miller
https://patchwork.kernel.org/patch/9132521/

After it we switched to current version.

> > Everything points to just going with the pair-of-registers and getting
> > this merged quickly then, I suppose.
> 
> I will refrain from commenting on how quickly we merge this ;) (it may
> be seen as binding by some).
> 
> -- 
> Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Yury Norov <ynorov@caviumnetworks.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Dr. Philipp Tomsich" <philipp.tomsich@theobroma-systems.com>,
	linux-doc@vger.kernel.org, szabolcs.nagy@arm.com,
	heiko.carstens@de.ibm.com, cmetcalf@ezchip.com,
	"Joseph S. Myers" <joseph@codesourcery.com>,
	linux-arch@vger.kernel.org, zhouchengming1@huawei.com, "Kapoor,
	Prasun" <Prasun.Kapoor@caviumnetworks.com>,
	"Alexander Graf" <agraf@suse.de>,
	geert@linux-m68k.org, kilobyte@angband.pl,
	manuel.montezelo@gmail.com, "Arnd Bergmann" <arnd@arndb.de>,
	"Andrew Pinski" <pinskia@gmail.com>,
	linyongting@huawei.com, "Alexey Klimov" <klimov.linux@gmail.com>,
	broonie@kernel.org,
	"Zhangjian (Bamvor)" <bamvor.zhangjian@huawei.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"Maxim Kuvyrkov" <maxim.kuvyrkov@linaro.org>,
	libc-alpha@sourceware.org,
	"Nathan Lynch" <Nathan_Lynch@mentor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	davem@davemloft.net,
	"Christoph Müllner" <christoph.muellner@theobroma-systems.com>
Subject: Re: [RFC2 nowrap: PATCH v7 00/18] ILP32 for ARM64
Date: Thu, 18 Aug 2016 12:45:28 +0300	[thread overview]
Message-ID: <20160818094528.GA4765@yury-N73SV> (raw)
Message-ID: <20160818094528.SMkEf_5qkeNX9ZD9S3Epue2uWPK8zJSoJifR1XZYfgI@z> (raw)
In-Reply-To: <20160817152642.GD20762@e104818-lin.cambridge.arm.com>

On Wed, Aug 17, 2016 at 04:26:42PM +0100, Catalin Marinas wrote:
> On Wed, Aug 17, 2016 at 04:32:23PM +0200, Dr. Philipp Tomsich wrote:
> > On 17 Aug 2016, at 16:29, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > > On Wed, Aug 17, 2016 at 02:54:59PM +0200, Dr. Philipp Tomsich wrote:
> > >> On 17 Aug 2016, at 14:48, Yury Norov <ynorov@caviumnetworks.com> wrote:
> > >>> On Wed, Aug 17, 2016 at 02:28:50PM +0200, Alexander Graf wrote:
> > >>>> On 17 Aug 2016, at 13:46, Yury Norov <ynorov@caviumnetworks.com> wrote:
> > >>>>> This series enables aarch64 with ilp32 mode, and as supporting work,
> > >>>>> introduces ARCH_32BIT_OFF_T configuration option that is enabled for
> > >>>>> existing 32-bit architectures but disabled for new arches (so 64-bit
> > >>>>> off_t is is used by new userspace).
> > >>>>> 
> > >>>>> This version is based on kernel v4.8-rc2.
> > >>>>> It works with glibc-2.23, and tested with LTP.
> > >>>>> 
> > >>>>> This is RFC because there is still no solid understanding what type of registers
> > >>>>> top-halves delousing we prefer. In this patchset, w0-w7 are cleared for each
> > >>>>> syscall in assembler entry. The alternative approach is in introducing compat
> > >>>>> wrappers which is little faster for natively routed syscalls (~2.6% for syscall
> > >>>>> with no payload) but much more complicated.
> > >>>> 
> > >>>> So you’re saying there are 2 options:
> > >>>> 
> > >>>> 1) easy to get right, slightly slower, same ABI to user space as 2
> > >>>> 2) harder to get right, minor performance benefit
> > >>> 
> > >>> No, ABI is little different. If 1) we pass off_t in a pair to syscalls,
> > >>> if 2) - in a single register. So if 1, we 'd take some wrappers from aarch32.
> > >>> See patch 12 here.
> > >> 
> > >> From our experience with ILP32, I’d prefer to have off_t (and similar)
> > >> in a single register whenever possible (i.e. option #2).  It feels
> > >> more natural to use the full 64bit registers whenever possible, as
> > >> ILP32 on ARMv8 should really be understood as a 64bit ABI with a 32bit
> > >> memory model.
> > > 
> > > I think we are well past the point where we considered ILP32 a 64-bit
> > > ABI. It would have been nice but we decided that breaking POSIX
> > > compatibility is a bad idea, so we went back (again) to a 32-bit ABI for
> > > ILP32. While there are 64-bit arguments that, at a first look, would
> > > make sense to be passed in 64-bit registers, the kernel maintenance cost
> > > is significant with changes to generic files.
> > > 
> > > Allowing 64-bit wide registers at the ILP32 syscall interface means that
> > > the kernel would have to zero/sign-extend the upper half of the 32-bit
> > > arguments for the cases where they are passed directly to a native
> > > syscall that expects a 64-bit argument. This (a) adds a significant
> > > number of wrappers to the generic code together additional annotations
> > > to the generic unistd.h and (b) it adds a small overhead to the AArch32
> > > (compat) ABI since it doesn't need such generic wrapping (the upper half
> > > of 64-bit registers is guaranteed to be zero/preserved by the
> > > architecture when coming from the AArch32 mode).
> > 
> > Yes, I remember the discussions and just wanted to put option #2 in
> > context again.
> 
> I don't particularly like splitting 64-bit arguments in two 32-bit
> values either but I don't see a better alternative. To keep this
> mostly in the arch code we would need an additional table of syscall
> wrappers where the majority just use the default zero-extend everything
> with a few specific wrappers where we pass 64-bit arguments. Or we could
> set an extra bit in the syscall number for those syscalls that need
> special wrapping and avoid zero-extending. But neither of these look any
> nicer (well, maybe only from the user-space perspective).
> 

This is the discussion started by David Miller
https://patchwork.kernel.org/patch/9132521/

After it we switched to current version.

> > Everything points to just going with the pair-of-registers and getting
> > this merged quickly then, I suppose.
> 
> I will refrain from commenting on how quickly we merge this ;) (it may
> be seen as binding by some).
> 
> -- 
> Catalin

  parent reply	other threads:[~2016-08-18  9:45 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 11:46 [RFC2 nowrap: PATCH v7 00/18] ILP32 for ARM64 Yury Norov
2016-08-17 11:46 ` Yury Norov
2016-08-17 11:46 ` [PATCH 01/18] 32-bit ABI: introduce ARCH_32BIT_OFF_T config option Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 02/18] arm64: ilp32: add documentation on the ILP32 ABI for ARM64 Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 03/18] arm64: ensure the kernel is compiled for LP64 Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 04/18] arm64: rename COMPAT to AARCH32_EL0 in Kconfig Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 05/18] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64 Yury Norov
2016-08-17 11:46 ` [PATCH 06/18] thread: move thread bits accessors to separated file Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 07/18] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 08/18] arm64: ilp32: add is_ilp32_compat_{task,thread} and TIF_32BIT_AARCH64 Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 09/18] arm64: introduce binfmt_elf32.c Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 10/18] arm64: ilp32: introduce binfmt_ilp32.c Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 11/18] arm64: ilp32: share aarch32 syscall handlers Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 12/18] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-09-02 10:46   ` Bamvor Jian Zhang
2016-09-02 10:46     ` Bamvor Jian Zhang
2016-09-02 12:55     ` Arnd Bergmann
2016-09-02 12:55       ` Arnd Bergmann
2016-09-02 13:04       ` Yury Norov
2016-09-02 13:04         ` Yury Norov
2016-08-17 11:46 ` [PATCH 13/18] arm64: signal: share lp64 signal routines to ilp32 Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 14/18] arm64: signal32: move ilp32 and aarch32 common code to separated file Yury Norov
2016-08-17 11:46 ` [PATCH 15/18] arm64: ilp32: introduce ilp32-specific handlers for sigframe and ucontext Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 16/18] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 11:46 ` [PATCH 17/18] arm64:ilp32: add vdso-ilp32 and use for signal return Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 13:18   ` Andreas Schwab
2016-08-17 11:46 ` [PATCH 18/18] arm64:ilp32: add ARM64_ILP32 to Kconfig Yury Norov
2016-08-17 11:46   ` Yury Norov
2016-08-17 12:28 ` [RFC2 nowrap: PATCH v7 00/18] ILP32 for ARM64 Alexander Graf
2016-08-17 12:48   ` Yury Norov
2016-08-17 12:48     ` Yury Norov
2016-08-17 12:54     ` Dr. Philipp Tomsich
2016-08-17 12:54       ` Dr. Philipp Tomsich
2016-08-17 14:29       ` Catalin Marinas
2016-08-17 14:29         ` Catalin Marinas
2016-08-17 14:32         ` Dr. Philipp Tomsich
2016-08-17 14:32           ` Dr. Philipp Tomsich
2016-08-17 15:26           ` Catalin Marinas
2016-08-17 15:26             ` Catalin Marinas
2016-08-18  9:45             ` Yury Norov [this message]
2016-08-18  9:45               ` Yury Norov
2016-09-02 10:20 ` Bamvor Jian Zhang
2016-09-02 10:20   ` Bamvor Jian Zhang

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=20160818094528.GA4765@yury-N73SV \
    --to=ynorov@caviumnetworks.com \
    --cc=Nathan_Lynch@mentor.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=bamvor.zhangjian@huawei.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=cmetcalf@ezchip.com \
    --cc=geert@linux-m68k.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=joseph@codesourcery.com \
    --cc=kilobyte@angband.pl \
    --cc=klimov.linux@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyongting@huawei.com \
    --cc=manuel.montezelo@gmail.com \
    --cc=maxim.kuvyrkov@linaro.org \
    --cc=philipp.tomsich@theobroma-systems.com \
    --cc=pinskia@gmail.com \
    --cc=szabolcs.nagy@arm.com \
    --cc=zhouchengming1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).