All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch <linux-arch@vger.kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	linux-mips <linux-mips@linux-mips.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	ppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	sparclinux@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Jiri Slaby <jslaby@suse.com>
Subject: Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation
Date: Thu, 22 Mar 2018 00:15:32 +0000	[thread overview]
Message-ID: <20180322001532.GA18399@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180319232342.GX30522@ZenIV.linux.org.uk>

On Mon, Mar 19, 2018 at 11:23:42PM +0000, Al Viro wrote:
> Benefits:
> 	* all SyS... wrappers (i.e. the thing that really ought to
> go into syscall tables) have the same type.
> 	* we could have SYSCALL_DEFINE produce a trivial compat
> wrapper, have explicit COMPAT_SYSCALL_DEFINE discard that thing
> and populate the compat syscall table *entirely* with compat_SyS_...,
> letting the linker sort it out.  That way we don't need to keep
> track of what can use native and what needs compat in each compat
> table on biarch.
> 	* s390 compat wrappers would disappear with that approach.
> 	* we could even stop generating sys_... aliases - if
> syscall table is generated by slapping SyS_... or compat_SyS_...
> on the name given there, we don't need to _have_ those sys_...
> things at all.  All SyS_... would have the same type, so the pile
> in syscalls.h would not be needed - we could generate the externs
> at the same time we generate the syscall table.
> 
> And yes, it's a high-squick approach.  I know and I'm not saying
> it's a good idea.  OTOH, to quote the motto of philosophers and
> shell game operators, "there's something in it"...

FWIW, I have something that is almost reasonable on preprocessor side;
however, that has uncovered the following fun:
void f(unsigned long long);
void g(unsigned a, unsigned b)
{
        f((((unsigned long long)b)<<32)|a);
}

which does compile to "jump to f" on i386, ends up with the following
joy on arm:
        mov     r3, r1
        mov     r2, #0
        push    {r4, lr}
        orr     r2, r2, r0
        mov     r0, r2
        mov     r1, r3
        bl      f
        pop     {r4, lr}
        bx      lr
with gcc6; gcc7 is saner - there we have just
        mov     r2, #0
        orr     r0, r2, r0
        b       f

The former is
	r3 = r1
	r2 = 0
	r2 |= r0
	r0 = r2
	r1 = r3
The latter -
	r2 = 0
	r0 |= r2
which is better, but still bloody odd

And I'm afraid to check what e.g. 4.4 will do with that testcase...

WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch <linux-arch@vger.kernel.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	James Hogan <jhogan@kernel.org>,
	linux-mips <linux-mips@linux-mips.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	ppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	sparclinux@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Jiri Slaby <jslaby@suse.com>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation
Date: Thu, 22 Mar 2018 00:15:32 +0000	[thread overview]
Message-ID: <20180322001532.GA18399@ZenIV.linux.org.uk> (raw)
Message-ID: <20180322001532.h7BsQ1cwDzAd9_xhc9f6OIlToGs5iKdPct8K70e7B_4@z> (raw)
In-Reply-To: <20180319232342.GX30522@ZenIV.linux.org.uk>

On Mon, Mar 19, 2018 at 11:23:42PM +0000, Al Viro wrote:
> Benefits:
> 	* all SyS... wrappers (i.e. the thing that really ought to
> go into syscall tables) have the same type.
> 	* we could have SYSCALL_DEFINE produce a trivial compat
> wrapper, have explicit COMPAT_SYSCALL_DEFINE discard that thing
> and populate the compat syscall table *entirely* with compat_SyS_...,
> letting the linker sort it out.  That way we don't need to keep
> track of what can use native and what needs compat in each compat
> table on biarch.
> 	* s390 compat wrappers would disappear with that approach.
> 	* we could even stop generating sys_... aliases - if
> syscall table is generated by slapping SyS_... or compat_SyS_...
> on the name given there, we don't need to _have_ those sys_...
> things at all.  All SyS_... would have the same type, so the pile
> in syscalls.h would not be needed - we could generate the externs
> at the same time we generate the syscall table.
> 
> And yes, it's a high-squick approach.  I know and I'm not saying
> it's a good idea.  OTOH, to quote the motto of philosophers and
> shell game operators, "there's something in it"...

FWIW, I have something that is almost reasonable on preprocessor side;
however, that has uncovered the following fun:
void f(unsigned long long);
void g(unsigned a, unsigned b)
{
        f((((unsigned long long)b)<<32)|a);
}

which does compile to "jump to f" on i386, ends up with the following
joy on arm:
        mov     r3, r1
        mov     r2, #0
        push    {r4, lr}
        orr     r2, r2, r0
        mov     r0, r2
        mov     r1, r3
        bl      f
        pop     {r4, lr}
        bx      lr
with gcc6; gcc7 is saner - there we have just
        mov     r2, #0
        orr     r0, r2, r0
        b       f

The former is
	r3 = r1
	r2 = 0
	r2 |= r0
	r0 = r2
	r1 = r3
The latter -
	r2 = 0
	r0 |= r2
which is better, but still bloody odd

And I'm afraid to check what e.g. 4.4 will do with that testcase...

  parent reply	other threads:[~2018-03-22  0:15 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-18 16:10 [RFC PATCH 0/6] remove in-kernel syscall invocations (part 3 == compat cruft) Dominik Brodowski
2018-03-18 16:10 ` [RFC PATCH 1/6] fs: provide a generic compat_sys_fallocate() implementation Dominik Brodowski
2018-03-18 16:10   ` Dominik Brodowski
2018-03-18 16:10 ` [RFC PATCH 2/6] fs: provide a generic compat_sys_truncate64() implementation Dominik Brodowski
2018-03-18 16:10   ` Dominik Brodowski
2018-03-18 17:49   ` Al Viro
2018-03-18 18:21   ` Linus Torvalds
2018-03-18 18:21     ` Linus Torvalds
2018-03-19  6:29   ` Kevin Easton
2018-03-19  6:29     ` Kevin Easton
2018-03-18 16:10 ` [RFC PATCH 3/6] fs: provide generic compat_sys_p{read,write}64() implementations Dominik Brodowski
2018-03-18 16:10   ` Dominik Brodowski
2018-03-18 16:10   ` [RFC PATCH 3/6] fs: provide generic compat_sys_p{read, write}64() implementations Dominik Brodowski
2018-03-18 17:40   ` [RFC PATCH 3/6] fs: provide generic compat_sys_p{read,write}64() implementations Linus Torvalds
2018-03-18 17:40     ` Linus Torvalds
2018-03-18 17:40     ` [RFC PATCH 3/6] fs: provide generic compat_sys_p{read, write}64() implementations Linus Torvalds
2018-03-18 18:05   ` [RFC PATCH 3/6] fs: provide generic compat_sys_p{read,write}64() implementations Al Viro
2018-03-18 18:05     ` Al Viro
2018-03-18 18:05     ` [RFC PATCH 3/6] fs: provide generic compat_sys_p{read, write}64() implementations Al Viro
2018-03-18 16:10 ` [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation Dominik Brodowski
2018-03-18 16:10   ` Dominik Brodowski
2018-03-18 17:40   ` Al Viro
2018-03-18 18:06     ` Linus Torvalds
2018-03-18 18:06       ` Linus Torvalds
2018-03-18 18:18       ` Al Viro
2018-03-19  4:23         ` Al Viro
2018-03-19  9:29           ` Ingo Molnar
2018-03-19  9:29             ` Ingo Molnar
2018-03-19  9:29             ` Ingo Molnar
2018-03-19 23:23             ` Al Viro
2018-03-19 23:23               ` Al Viro
2018-03-19 23:23               ` Al Viro
2018-03-20  8:56               ` Dominik Brodowski
2018-03-20  8:56                 ` Dominik Brodowski
2018-03-20  8:56                 ` Dominik Brodowski
2018-03-20  8:59               ` Ingo Molnar
2018-03-20  8:59                 ` Ingo Molnar
2018-03-20  8:59                 ` Ingo Molnar
2018-03-22  0:15               ` Al Viro [this message]
2018-03-22  0:15                 ` Al Viro
2018-03-26  0:40                 ` [RFC] new SYSCALL_DEFINE/COMPAT_SYSCALL_DEFINE wrappers Al Viro
2018-03-26  0:40                   ` Al Viro
2018-03-26  0:40                   ` Al Viro
2018-03-26  3:47                   ` Al Viro
2018-03-26  3:47                     ` Al Viro
2018-03-26  3:47                     ` Al Viro
2018-03-26  6:15                     ` Linus Torvalds
2018-03-26  6:15                       ` Linus Torvalds
2018-03-26  6:15                       ` Linus Torvalds
2018-03-26  6:20                       ` Linus Torvalds
2018-03-26  6:20                         ` Linus Torvalds
2018-03-26  6:20                         ` Linus Torvalds
2018-03-26  6:44                       ` John Paul Adrian Glaubitz
2018-03-26  6:44                         ` John Paul Adrian Glaubitz
2018-03-26  6:44                         ` John Paul Adrian Glaubitz
2018-03-27  1:03                         ` Linus Torvalds
2018-03-27  1:03                           ` Linus Torvalds
2018-03-27  1:03                           ` Linus Torvalds
2018-03-27  2:37                           ` John Paul Adrian Glaubitz
2018-03-27  2:37                             ` John Paul Adrian Glaubitz
2018-03-27  2:37                             ` John Paul Adrian Glaubitz
2018-03-27  3:40                             ` Linus Torvalds
2018-03-27  3:40                               ` Linus Torvalds
2018-03-27  3:40                               ` Linus Torvalds
2018-03-27  4:58                               ` John Paul Adrian Glaubitz
2018-03-27  4:58                                 ` John Paul Adrian Glaubitz
2018-03-27  4:58                                 ` John Paul Adrian Glaubitz
2018-03-30 10:58                                 ` Ingo Molnar
2018-03-30 10:58                                   ` Ingo Molnar
2018-03-30 10:58                                   ` Ingo Molnar
2018-03-30 15:54                                   ` Adam Borowski
2018-03-30 15:54                                     ` Adam Borowski
2018-03-30 15:54                                     ` Adam Borowski
2018-03-26  6:24                     ` Dominik Brodowski
2018-03-26  6:24                       ` Dominik Brodowski
2018-03-26  6:24                       ` Dominik Brodowski
2018-03-18 16:10 ` [RFC PATCH 5/6] x86: use _do_fork() in compat_sys_x86_clone() Dominik Brodowski
2018-03-18 16:10 ` [RFC PATCH 6/6] x86: remove compat_sys_x86_waitpid() Dominik Brodowski

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=20180322001532.GA18399@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jhogan@kernel.org \
    --cc=jslaby@suse.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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.