Gerd Hoffmann
2019-Jul-02 14:18 UTC
[PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}
Call reservation_object_* directly instead of using ttm_bo_{reserve,unreserve}. v4: check for EINTR only. v3: check for EINTR too. Signed-off-by: Gerd Hoffmann <kraxel at redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch> --- drivers/gpu/drm/virtio/virtgpu_drv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 06cc0e961df6..07f6001ea91e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -402,9 +402,9 @@ static inline int virtio_gpu_object_reserve(struct virtio_gpu_object *bo) { int r; - r = ttm_bo_reserve(&bo->tbo, true, false, NULL); + r = reservation_object_lock_interruptible(bo->gem_base.resv, NULL); if (unlikely(r != 0)) { - if (r != -ERESTARTSYS) { + if (r != -EINTR) { struct virtio_gpu_device *qdev bo->gem_base.dev->dev_private; dev_err(qdev->dev, "%p reserve failed\n", bo); @@ -416,7 +416,7 @@ static inline int virtio_gpu_object_reserve(struct virtio_gpu_object *bo) static inline void virtio_gpu_object_unreserve(struct virtio_gpu_object *bo) { - ttm_bo_unreserve(&bo->tbo); + reservation_object_unlock(bo->gem_base.resv); } /* virgl debufs */ -- 2.18.1
Chia-I Wu
2019-Jul-03 18:02 UTC
[PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann <kraxel at redhat.com> wrote:> > Call reservation_object_* directly instead > of using ttm_bo_{reserve,unreserve}. > > v4: check for EINTR only. > v3: check for EINTR too. > > Signed-off-by: Gerd Hoffmann <kraxel at redhat.com> > Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch> > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h > index 06cc0e961df6..07f6001ea91e 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_drv.h > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h > @@ -402,9 +402,9 @@ static inline int virtio_gpu_object_reserve(struct virtio_gpu_object *bo) > { > int r; > > - r = ttm_bo_reserve(&bo->tbo, true, false, NULL); > + r = reservation_object_lock_interruptible(bo->gem_base.resv, NULL);Can you elaborate a bit about how TTM keeps the BOs alive in, for example, virtio_gpu_transfer_from_host_ioctl? In that function, only three TTM functions are called: ttm_bo_reserve, ttm_bo_validate, and ttm_bo_unreserve. I am curious how they keep the BO alive.> if (unlikely(r != 0)) { > - if (r != -ERESTARTSYS) { > + if (r != -EINTR) { > struct virtio_gpu_device *qdev > bo->gem_base.dev->dev_private; > dev_err(qdev->dev, "%p reserve failed\n", bo); > @@ -416,7 +416,7 @@ static inline int virtio_gpu_object_reserve(struct virtio_gpu_object *bo) > > static inline void virtio_gpu_object_unreserve(struct virtio_gpu_object *bo) > { > - ttm_bo_unreserve(&bo->tbo); > + reservation_object_unlock(bo->gem_base.resv); > } > > /* virgl debufs */ > -- > 2.18.1 >
Gerd Hoffmann
2019-Jul-04 11:10 UTC
[PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve,unreserve}
Hi,> > - r = ttm_bo_reserve(&bo->tbo, true, false, NULL); > > + r = reservation_object_lock_interruptible(bo->gem_base.resv, NULL); > Can you elaborate a bit about how TTM keeps the BOs alive in, for > example, virtio_gpu_transfer_from_host_ioctl? In that function, only > three TTM functions are called: ttm_bo_reserve, ttm_bo_validate, and > ttm_bo_unreserve. I am curious how they keep the BO alive.It can't go away between reserve and unreserve, and I think it also can't be evicted then. Havn't checked how ttm implements that. cheers, Gerd
Apparently Analagous Threads
- [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}
- [PATCH v3 07/12] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}
- [PATCH v2 06/12] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}
- [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve,unreserve}
- [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve,unreserve}