[PATCH] drm/virtio: delay pinning the pages till first use

Gerd Hoffmann kraxel at redhat.com
Wed Nov 3 07:30:43 UTC 2021


On Tue, Nov 02, 2021 at 08:58:55AM -0700, Chia-I Wu wrote:
> On Tue, Nov 2, 2021 at 6:07 AM Gerd Hoffmann <kraxel at redhat.com> wrote:
> >
> > On Tue, Nov 02, 2021 at 12:31:39PM +0100, Maksym Wezdecki wrote:
> > > From: mwezdeck <maksym.wezdecki at collabora.co.uk>
> > >
> > > The idea behind the commit:
> > >   1. not pin the pages during resource_create ioctl
> > >   2. pin the pages on the first use during:
> > >       - transfer_*_host ioctl
> > >         - map ioctl
> >
> > i.e. basically lazy pinning.  Approach looks sane to me.
> >
> > >   3. introduce new ioctl for pinning pages on demand
> >
> > What is the use case for this ioctl?
> > In any case this should be a separate patch.
> 
> Lazy pinning can be a nice optimization that userspace does not
> necessarily need to know about.  This patch however skips pinning for
> execbuffer ioctl and introduces a new pin ioctl instead.  That is a
> red flag.

Ah, so the pin ioctl is for buffers which need a pin for execbuffer.

Yep, that isn't going to fly that way, it'll break old userspace.

Lazy pinning must be opt-in, so new userspace which knows about
the pin ioctl can enable lazy pinning.  One possible way would
be to add a flag for the VIRTGPU_RESOURCE_CREATE ioctl, so lazy
pinning can be enabled per resource.

take care,
  Gerd



More information about the dri-devel mailing list