Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Daniel Vetter
On Sun, Sep 20, 2020 at 08:23:26AM +0200, Thomas Gleixner wrote: > On Sat, Sep 19 2020 at 12:37, Daniel Vetter wrote: > > On Sat, Sep 19, 2020 at 12:35 PM Daniel Vetter wrote: > >> I think it should be the case, but I want to double check: Will > >> copy_*_user be allowed within a kmap_temporary s

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Thomas Gleixner
On Sun, Sep 20 2020 at 08:41, Thomas Gleixner wrote: > On Sat, Sep 19 2020 at 10:18, Linus Torvalds wrote: >> Maybe I've missed something. Is it because the new interface still >> does "pagefault_disable()" perhaps? >> >> But does it even need the pagefault_disable() at all? Yes, the >> *atomic* o

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Arnd Bergmann
On Sun, Sep 20, 2020 at 12:09 AM Al Viro wrote: > On Fri, Sep 18, 2020 at 05:16:15PM +0200, Christoph Hellwig wrote: > > On Fri, Sep 18, 2020 at 02:58:22PM +0100, Al Viro wrote: > > > Said that, why not provide a variant that would take an explicit > > > "is it compat" argument and use it there?

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Al Viro
On Sun, Sep 20, 2020 at 03:55:47PM +0200, Arnd Bergmann wrote: > On Sun, Sep 20, 2020 at 12:09 AM Al Viro wrote: > > On Fri, Sep 18, 2020 at 05:16:15PM +0200, Christoph Hellwig wrote: > > > On Fri, Sep 18, 2020 at 02:58:22PM +0100, Al Viro wrote: > > > > Said that, why not provide a variant that w

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Matthew Wilcox
On Fri, Sep 18, 2020 at 02:45:25PM +0200, Christoph Hellwig wrote: > Add a flag to force processing a syscall as a compat syscall. This is > required so that in_compat_syscall() works for I/O submitted by io_uring > helper threads on behalf of compat syscalls. Al doesn't like this much, but my su

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Arnd Bergmann
On Sun, Sep 20, 2020 at 5:15 PM Matthew Wilcox wrote: > > On Fri, Sep 18, 2020 at 02:45:25PM +0200, Christoph Hellwig wrote: > > Add a flag to force processing a syscall as a compat syscall. This is > > required so that in_compat_syscall() works for I/O submitted by io_uring > > helper threads on

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Andy Lutomirski
On Sat, Sep 19, 2020 at 7:57 PM Al Viro wrote: > > On Sat, Sep 19, 2020 at 05:14:41PM -0700, Andy Lutomirski wrote: > > > > 2) have you counted the syscalls that do and do not need that? > > > > No. > > Might be illuminating... > > > > 3) how many of those realistically *can* be unified with their

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Linus Torvalds
On Sun, Sep 20, 2020 at 1:49 AM Thomas Gleixner wrote: > > Actually most usage sites of kmap atomic do not need page faults to be > disabled at all. Right. I think the pagefault disabling has (almost) nothing at all to do with the kmap() itself - it comes from the "atomic" part, not the "kmap" pa

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Thomas Gleixner
On Sun, Sep 20 2020 at 10:23, Daniel Vetter wrote: > On Sun, Sep 20, 2020 at 08:23:26AM +0200, Thomas Gleixner wrote: >> On Sat, Sep 19 2020 at 12:37, Daniel Vetter wrote: >> > On Sat, Sep 19, 2020 at 12:35 PM Daniel Vetter wrote: >> >> I think it should be the case, but I want to double check: W

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Thomas Gleixner
On Sun, Sep 20 2020 at 09:57, Linus Torvalds wrote: > On Sun, Sep 20, 2020 at 1:49 AM Thomas Gleixner wrote: > Btw, looking at the stack code, Ithink your new implementation of it > is a bit scary: > >static inline int kmap_atomic_idx_push(void) >{ > - int idx = __this_cpu_inc_retu

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Linus Torvalds
On Sun, Sep 20, 2020 at 10:40 AM Thomas Gleixner wrote: > > I think the more obvious solution is to split the whole exercise: > > schedule() > prepare_switch() > unmap() > > switch_to() > > finish_switch() > map() Yeah, that looks much easier to explain. Ack.

Re: [patch RFC 00/15] mm/highmem: Provide a preemptible variant of kmap_atomic & friends

2020-09-20 Thread Linus Torvalds
On Sun, Sep 20, 2020 at 10:42 AM Linus Torvalds wrote: > > Yeah, that looks much easier to explain. Ack. Btw, one thing that might be a good idea at least initially is to add a check for p->kmap_ctrl.idx being zero at fork, exit and maybe syscall return time (but that last one may be too cumberso

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Al Viro
On Sun, Sep 20, 2020 at 04:15:10PM +0100, Matthew Wilcox wrote: > On Fri, Sep 18, 2020 at 02:45:25PM +0200, Christoph Hellwig wrote: > > Add a flag to force processing a syscall as a compat syscall. This is > > required so that in_compat_syscall() works for I/O submitted by io_uring > > helper thr

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Al Viro
On Sun, Sep 20, 2020 at 09:59:36AM -0700, Andy Lutomirski wrote: > As one example, look at __sys_setsockopt(). It's called for the > native and compat versions, and it contains an in_compat_syscall() > check. (This particularly check looks dubious to me, but that's > another story.) If this wer

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread William Kucharski
I really like that as it’s self-documenting and anyone debugging it can see what is actually being used at a glance. > On Sep 20, 2020, at 09:15, Matthew Wilcox wrote: > > On Fri, Sep 18, 2020 at 02:45:25PM +0200, Christoph Hellwig wrote: >> Add a flag to force processing a syscall as a compat

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Al Viro
On Sun, Sep 20, 2020 at 07:07:42PM +0100, Al Viro wrote: > /proc/bus/input/devices (fucked bitmap-to-text representation) To illustrate the, er, beauty of that stuff: ; cat32 /proc/bus/input/devices >/tmp/a ; cat /proc/bus/input/devices >/tmp/b ; diff -u /tmp/a /tmp/b|grep '^[-+]' --- /tmp/a

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Matthew Wilcox
On Sun, Sep 20, 2020 at 07:07:42PM +0100, Al Viro wrote: > 2) a few drivers are really fucked in head. They use different > *DATA* layouts for reads/writes, depending upon the calling process. > IOW, if you fork/exec a 32bit binary and your stdin is one of those, > reads from stdin in parent

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Al Viro
On Sun, Sep 20, 2020 at 08:01:59PM +0100, Matthew Wilcox wrote: > On Sun, Sep 20, 2020 at 07:07:42PM +0100, Al Viro wrote: > > 2) a few drivers are really fucked in head. They use different > > *DATA* layouts for reads/writes, depending upon the calling process. > > IOW, if you fork/exec a 32b

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Andy Lutomirski
On Sun, Sep 20, 2020 at 11:07 AM Al Viro wrote: > > On Sun, Sep 20, 2020 at 04:15:10PM +0100, Matthew Wilcox wrote: > > On Fri, Sep 18, 2020 at 02:45:25PM +0200, Christoph Hellwig wrote: > > > Add a flag to force processing a syscall as a compat syscall. This is > > > required so that in_compat_s

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Matthew Wilcox
On Sun, Sep 20, 2020 at 08:10:31PM +0100, Al Viro wrote: > IMO it's much saner to mark those and refuse to touch them from io_uring... Simpler solution is to remove io_uring from the 32-bit syscall list. If you're a 32-bit process, you don't get to use io_uring. Would any real users actually care

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Andy Lutomirski
On Sun, Sep 20, 2020 at 12:23 PM Matthew Wilcox wrote: > > On Sun, Sep 20, 2020 at 08:10:31PM +0100, Al Viro wrote: > > IMO it's much saner to mark those and refuse to touch them from io_uring... > > Simpler solution is to remove io_uring from the 32-bit syscall list. > If you're a 32-bit process,

Re: [PATCH] soc: fsl: dpio: remove set but not used 'addr_cena'

2020-09-20 Thread Krzysztof Kozlowski
On Thu, 10 Sep 2020 at 16:57, Jason Yan wrote: > > This addresses the following gcc warning with "make W=1": > > drivers/soc/fsl/dpio/qbman-portal.c: In function > ‘qbman_swp_enqueue_multiple_direct’: > drivers/soc/fsl/dpio/qbman-portal.c:650:11: warning: variable > ‘addr_cena’ set but not used [-

[PATCH] soc: fsl: qbman: Fix return value on success

2020-09-20 Thread Krzysztof Kozlowski
On error the function was meant to return -ERRNO. This also fixes compile warning: drivers/soc/fsl/qbman/bman.c:640:6: warning: variable 'err' set but not used [-Wunused-but-set-variable] Fixes: 0505d00c8dba ("soc/fsl/qbman: Cleanup buffer pools if BMan was initialized prior to bootup") Sign

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Arnd Bergmann
On Sun, Sep 20, 2020 at 9:28 PM Andy Lutomirski wrote: > On Sun, Sep 20, 2020 at 12:23 PM Matthew Wilcox wrote: > > > > On Sun, Sep 20, 2020 at 08:10:31PM +0100, Al Viro wrote: > > > IMO it's much saner to mark those and refuse to touch them from > > > io_uring... > > > > Simpler solution is to

RE: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread David Laight
From: Arnd Bergmann > Sent: 20 September 2020 21:49 > > On Sun, Sep 20, 2020 at 9:28 PM Andy Lutomirski wrote: > > On Sun, Sep 20, 2020 at 12:23 PM Matthew Wilcox wrote: > > > > > > On Sun, Sep 20, 2020 at 08:10:31PM +0100, Al Viro wrote: > > > > IMO it's much saner to mark those and refuse to t

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Al Viro
On Sun, Sep 20, 2020 at 08:22:59PM +0100, Matthew Wilcox wrote: > On Sun, Sep 20, 2020 at 08:10:31PM +0100, Al Viro wrote: > > IMO it's much saner to mark those and refuse to touch them from io_uring... > > Simpler solution is to remove io_uring from the 32-bit syscall list. > If you're a 32-bit p

[PATCH] fsl: imx-audmix : Use devm_kcalloc() instead of devm_kzalloc()

2020-09-20 Thread Xu Wang
A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc". Signed-off-by: Xu Wang --- sound/soc/fsl/imx-audmix.c | 8 1 file changed, 4 insertions(+), 4 deletions(-)

Re: [PATCH 1/9] kernel: add a PF_FORCE_COMPAT flag

2020-09-20 Thread Christoph Hellwig
On Sun, Sep 20, 2020 at 12:14:49PM -0700, Andy Lutomirski wrote: > I wonder if this is really quite cast in stone. We could also have > FMODE_SHITTY_COMPAT and set that when a file like this is *opened* in > compat mode. Then that particular struct file would be read and > written using the compa

Re: let import_iovec deal with compat_iovecs as well

2020-09-20 Thread 'Christoph Hellwig'
On Sat, Sep 19, 2020 at 02:24:10PM +, David Laight wrote: > I thought about that change while writing my import_iovec() => iovec_import() > patch - and thought that the io_uring code would (as usual) cause grief. > > Christoph - did you see those patches? No.

Re: [patch RFC 01/15] mm/highmem: Un-EXPORT __kmap_atomic_idx()

2020-09-20 Thread Christoph Hellwig
On Sat, Sep 19, 2020 at 11:17:52AM +0200, Thomas Gleixner wrote: > Nothing in modules can use that. > > Signed-off-by: Thomas Gleixner Looks good, Reviewed-by: Christoph Hellwig

Re: [patch RFC 02/15] highmem: Provide generic variant of kmap_atomic*

2020-09-20 Thread Christoph Hellwig
> +# ifndef ARCH_NEEDS_KMAP_HIGH_GET > +static inline void *arch_kmap_temporary_high_get(struct page *page) > +{ > + return NULL; > +} > +# endif Turn this into a macro and use #ifndef on the symbol name? > +static inline void __kunmap_atomic(void *addr) > +{ > + kumap_atomic_indexed(addr