[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPaKu7QeYDqek7pBSHmg1E5A9h9E=njrvLxBMnkCtqeb3s77Cg@mail.gmail.com>
Date: Fri, 30 Aug 2019 09:24:37 -0700
From: Chia-I Wu <olvaffe@...il.com>
To: Gerd Hoffmann <kraxel@...hat.com>
Cc: David Riley <davidriley@...omium.org>,
David Airlie <airlied@...ux.ie>,
open list <linux-kernel@...r.kernel.org>,
ML dri-devel <dri-devel@...ts.freedesktop.org>,
Gurchetan Singh <gurchetansingh@...omium.org>,
Stéphane Marchesin <marcheu@...omium.org>,
"open list:VIRTIO CORE, NET AND BLOCK DRIVERS"
<virtualization@...ts.linux-foundation.org>
Subject: Re: [PATCH] drm/virtio: Use vmalloc for command buffer allocations.
On Fri, Aug 30, 2019 at 4:16 AM Gerd Hoffmann <kraxel@...hat.com> 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 doing that check.
>
> Ok.
>
> > - videobuf_vmalloc_to_sg in drivers/media/v4l2-core/videobuf-dma-sg.c,
> > assumes contiguous array of scatterlist and that the buffer being converted
> > is page aligned
>
> Well, vmalloc memory _is_ page aligned.
>
> sg_alloc_table_from_pages() does alot of what you need, you just need a
> small loop around vmalloc_to_page() create a struct page array
> beforehand.
>
> 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. We also need a flag to indicate that the
ownership of the buffer is transferred to the kernel.
>
> cheers,
> Gerd
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists