Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-21 Thread Al Viro
On Mon, Mar 19, 2018 at 11:23:42PM +, 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 discar

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-20 Thread Ingo Molnar
* Al Viro wrote: > > For example this attempt at creating a new system call: > > > > SYSCALL_DEFINE3(moron, int, fd, loff_t, offset, size_t, count) > > > > ... would translate into something like: > > > > .name = "moron", .pattern = "WWW", .type = "int",.size = 4, > > .name = NU

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-20 Thread Dominik Brodowski
On Mon, Mar 19, 2018 at 11:23:42PM +, Al Viro wrote: > static inline long C_S_moron(int, loff_t, size_t); > long compat_SyS_moron(long a0, long a1, long a2, long a3, long a4, long a5, > long a6) > { > return C_S_moron((__force int)a0, > (__force loff_t)(((u64)a2 << 32)|a1

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-19 Thread Al Viro
On Mon, Mar 19, 2018 at 10:29:20AM +0100, Ingo Molnar wrote: > > * Al Viro wrote: > > > On Sun, Mar 18, 2018 at 06:18:48PM +, Al Viro wrote: > > > > > I'd done some digging in that area, will find the notes and post. > > > > OK, found: > > Very nice writeup - IMHO this should go into Docu

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-19 Thread Ingo Molnar
* Al Viro wrote: > On Sun, Mar 18, 2018 at 06:18:48PM +, Al Viro wrote: > > > I'd done some digging in that area, will find the notes and post. > > OK, found: Very nice writeup - IMHO this should go into Documentation/! > OTOH, consider arm. There we have > * r0, r1, r2, r3, [sp,#

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-18 Thread Al Viro
On Sun, Mar 18, 2018 at 06:18:48PM +, Al Viro wrote: > I'd done some digging in that area, will find the notes and post. OK, found: We have two ABIs in the game - syscall and normal C. The latter (for all targets we support) can be described in the following terms: * there is a seri

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-18 Thread Al Viro
On Sun, Mar 18, 2018 at 11:06:42AM -0700, Linus Torvalds wrote: > and then we can do > > COMPAT_SYSCALL_DEFINE5(readahead, int, fd, > COMPAT_ARG_64BIT_ODD(off), compat_size_t, count) > { > return do_readahead(fd, off_lo + ((u64)off_hi << 64), count); > } > > which at least looks reas

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-18 Thread Al Viro
On Sun, Mar 18, 2018 at 05:10:54PM +0100, Dominik Brodowski wrote: > +#ifdef __ARCH_WANT_COMPAT_SYS_READAHEAD > +#if defined(__ARCH_WANT_COMPAT_SYS_WITH_PADDING) && \ > + defined(__ARCH_WANT_LE_COMPAT_SYS) > +COMPAT_SYSCALL_DEFINE5(readahead, int, fd, unsigned int, padding, > +

Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-18 Thread Linus Torvalds
On Sun, Mar 18, 2018 at 10:40 AM, Al Viro wrote: > > *UGH* > > static inline compat_to_u64(u32 w0, u32 w1) > { > #ifdef __BIG_ENDIAN > return ((u64)w0 << 32) | w1; > #else > return ((u64)w1 << 32) | w0; > #endif > } > > in compat.h, then this turns into > > #ifdef __ARCH_WANT_COMPA

[RFC PATCH 4/6] mm: provide generic compat_sys_readahead() implementation

2018-03-18 Thread Dominik Brodowski
The compat_sys_readahead() implementations in mips, powerpc, s390, sparc and x86 only differed based on whether the u64 parameter needed padding and on their endianness. Oh, and some defined the parameters as u64 or "unsigned long" which expanded to u64, though it only expected u32 in these parame