Re: [PATCH 1/7] powerpc/spufs: simplify spufs core dumping

2020-04-21 Thread Al Viro
On Tue, Apr 21, 2020 at 08:19:09PM +0100, Al Viro wrote: > On Tue, Apr 21, 2020 at 09:01:48PM +0200, Christoph Hellwig wrote: > > On Tue, Apr 21, 2020 at 07:49:41PM +0100, Al Viro wrote: > > > > spin_lock(&ctx->csa.register_lock); > > > > - ret = __spufs_proxydma_info_read(ctx, buf, l

Re: [PATCH 1/7] powerpc/spufs: simplify spufs core dumping

2020-04-21 Thread Al Viro
On Tue, Apr 21, 2020 at 09:01:48PM +0200, Christoph Hellwig wrote: > On Tue, Apr 21, 2020 at 07:49:41PM +0100, Al Viro wrote: > > > spin_lock(&ctx->csa.register_lock); > > > - ret = __spufs_proxydma_info_read(ctx, buf, len, pos); > > > + __spufs_proxydma_info_read(ctx, &info); > > > + ret = simpl

Re: [PATCH 1/7] powerpc/spufs: simplify spufs core dumping

2020-04-21 Thread Christoph Hellwig
On Tue, Apr 21, 2020 at 07:49:41PM +0100, Al Viro wrote: > > spin_lock(&ctx->csa.register_lock); > > - ret = __spufs_proxydma_info_read(ctx, buf, len, pos); > > + __spufs_proxydma_info_read(ctx, &info); > > + ret = simple_read_from_buffer(buf, len, pos, &info, sizeof(info)); > > IDGI...

Re: [PATCH 1/7] powerpc/spufs: simplify spufs core dumping

2020-04-21 Thread Al Viro
On Tue, Apr 21, 2020 at 05:41:58PM +0200, Christoph Hellwig wrote: > static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf, > size_t len, loff_t *pos) > { > struct spu_context *ctx = file->private_data; > + struct spu_proxydma_info

[PATCH 1/7] powerpc/spufs: simplify spufs core dumping

2020-04-21 Thread Christoph Hellwig
Replace the coredump ->read method with a ->dump method that must call dump_emit itself. That way we avoid a buffer allocation an messing with set_fs() to call into code that is intended to deal with user buffers. For the ->get case we can now use a small on-stack buffer and avoid memory allocatio