freedreno/drm/virtio: Defer flush on BO free
Freeing BOs tends to be bursty (ie. when a submit is retired, or expiring entries from BO cache). Sending lots of small SET_IOVA messages to the host can quickly eat up the available virtqueue slots, resulting in (eventually) starving the guest waiting for free virtqueue space. By batching, we can avoid this and handle things more efficiently on the host (ie. in a single wakeup rather than many). Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19832>
This commit is contained in:
@@ -107,7 +107,10 @@ fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time)
|
||||
}
|
||||
}
|
||||
|
||||
if (dev)
|
||||
/* Note: when called in bo_del_or_recycle() -> fd_bo_cache_free() path,
|
||||
* the caller will handle bo_del_flush().
|
||||
*/
|
||||
if (time && dev)
|
||||
bo_del_flush(dev);
|
||||
|
||||
cache->time = time;
|
||||
|
@@ -280,12 +280,6 @@ virtio_bo_destroy(struct fd_bo *bo)
|
||||
set_iova(bo, 0);
|
||||
|
||||
virtio_dev_free_iova(bo->dev, bo->iova, bo->size);
|
||||
|
||||
/* Need to flush batched ccmds to ensure the host sees the iova
|
||||
* release before the GEM handle is closed (ie. detach_resource()
|
||||
* on the host side)
|
||||
*/
|
||||
virtio_execbuf_flush(bo->dev);
|
||||
}
|
||||
|
||||
free(virtio_bo);
|
||||
|
@@ -43,6 +43,7 @@ static const struct fd_device_funcs funcs = {
|
||||
.bo_new = virtio_bo_new,
|
||||
.bo_from_handle = virtio_bo_from_handle,
|
||||
.pipe_new = virtio_pipe_new,
|
||||
.flush = virtio_execbuf_flush,
|
||||
.destroy = virtio_device_destroy,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user