Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-09-03 Thread David Riley
On Sun, Sep 1, 2019 at 10:28 PM Gerd Hoffmann wrote: > > On Fri, Aug 30, 2019 at 10:49:25AM -0700, David Riley wrote: > > Hi Gerd, > > > > On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > > > > > Hi, > > > > > > > > > - kfree(vbuf->data_buf); > > > > > > + kvfree(vbuf->data_buf)

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-09-01 Thread Gerd Hoffmann
On Fri, Aug 30, 2019 at 10:49:25AM -0700, David Riley wrote: > Hi Gerd, > > On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > > > Hi, > > > > > > > - kfree(vbuf->data_buf); > > > > > + kvfree(vbuf->data_buf); > > > > > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > > > >

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-09-01 Thread Gerd Hoffmann
> > Completely different approach: use get_user_pages() and don't copy the > > execbuffer at all. > It would be really nice if execbuffer does not copy. > > The user space owns the buffer and may overwrite the contents > immediately after the ioctl. Oh, right. The exec ioctl doesn't block. So t

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread David Riley
Hi Gerd, On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > Hi, > > > > > - kfree(vbuf->data_buf); > > > > + kvfree(vbuf->data_buf); > > > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > > > needed here I gues? > > > > > > > kvfree() handles vmalloc/kmalloc/kvmalloc interna

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Chia-I Wu
On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann wrote: > > Hi, > > > > > - kfree(vbuf->data_buf); > > > > + kvfree(vbuf->data_buf); > > > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > > > needed here I gues? > > > > > > > kvfree() handles vmalloc/kmalloc/kvmalloc internally by doi

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Chia-I Wu
On Thu, Aug 29, 2019 at 2:24 PM David Riley wrote: > > Userspace requested command buffer allocations could be too large > to make as a contiguous allocation. Use vmalloc if necessary to > satisfy those allocations. > > Signed-off-by: David Riley > --- > drivers/gpu/drm/virtio/virtgpu_ioctl.c |

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-30 Thread Gerd Hoffmann
Hi, > > > - kfree(vbuf->data_buf); > > > + kvfree(vbuf->data_buf); > > > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > > > needed here I gues? > > > > kvfree() handles vmalloc/kmalloc/kvmalloc internally by doing that check. Ok. > - videobuf_vmalloc_to_sg in drivers/media/v4l2-core/v

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-29 Thread David Riley
On Thu, Aug 29, 2019 at 11:09 PM Gerd Hoffmann wrote: > Hi, > > > { > > if (vbuf->resp_size > MAX_INLINE_RESP_SIZE) > > kfree(vbuf->resp_buf); > > - kfree(vbuf->data_buf); > > + kvfree(vbuf->data_buf); > > if (is_vmalloc_addr(vbuf->data_buf)) ... > > needed here I g

Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-29 Thread Gerd Hoffmann
Hi, > { > if (vbuf->resp_size > MAX_INLINE_RESP_SIZE) > kfree(vbuf->resp_buf); > - kfree(vbuf->data_buf); > + kvfree(vbuf->data_buf); if (is_vmalloc_addr(vbuf->data_buf)) ... needed here I gues? > +/* Create sg_table from a vmalloc'd buffer. */ > +static struct sg

[PATCH] drm/virtio: Use vmalloc for command buffer allocations.

2019-08-29 Thread David Riley
Userspace requested command buffer allocations could be too large to make as a contiguous allocation. Use vmalloc if necessary to satisfy those allocations. Signed-off-by: David Riley --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 4 +- drivers/gpu/drm/virtio/virtgpu_vq.c| 74 +++