All of lore.kernel.org
 help / color / mirror / Atom feed
* completely rework the dma_resv semantic
@ 2021-11-23 14:20 ` Christian König
  0 siblings, 0 replies; 74+ messages in thread
From: Christian König @ 2021-11-23 14:20 UTC (permalink / raw)
  To: sumit.semwal, daniel; +Cc: linux-media, dri-devel, linaro-mm-sig

Hi guys,

as discussed before this set of patches completely rework the dma_resv semantic
and spreads the new handling over all the existing drivers and users.

First of all this drops the DAG approach because it requires that every single
driver implements those relatively complicated rules correctly and any
violation of that immediately leads to either corruption of freed memory or
even more severe security problems.

Instead we just keep all fences around all the time until they are signaled.
Only fences with the same context are assumed to be signaled in the correct
order since this is exercised elsewhere as well. Replacing fences is now only
supported for hardware mechanism like VM page table updates where the hardware
can guarantee that the resource can't be accessed any more.

Then the concept of a single exclusive fence and multiple shared fences is
dropped as well.

Instead the dma_resv object is now just a container for dma_fence objects where
each fence has associated usage flags. Those use flags describe how the
operation represented by the dma_fence object is using the resource protected
by the dma_resv object. This allows us to add multiple fences for each usage
type.

Additionally to the existing WRITE/READ usages this patch set also adds the new
KERNEL and OTHER usages. The KERNEL usages is used in cases where the kernel
needs to do some operation with the resource protected by the dma_resv object,
like copies or clears. Those are mandatory to wait for when dynamic memory
management is used.

The OTHER usage is for cases where we don't want that the operation represented
by the dma_fence object participate in any implicit sync but needs to be
respected by the kernel memory management. Examples for those are VM page table
updates and preemption fences.

While doing this the new implementation cleans up existing workarounds all over
the place, but especially amdgpu and TTM. Surprisingly I also found two use
cases for the KERNEL/OTHER usage in i915 and Nouveau, those might need more
thoughts.

In general the existing functionality should been preserved, the only downside
is that we now always need to reserve a slot before adding a fence. The newly
added call to the reservation function can probably use some more cleanup.

TODOs: Testing, testing, testing, doublechecking the newly added
kerneldoc for any typos.

Please review and/or comment,
Christian.



^ permalink raw reply	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2021-11-30  8:31 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 14:20 completely rework the dma_resv semantic Christian König
2021-11-23 14:20 ` Christian König
2021-11-23 14:20 ` [PATCH 01/26] drm/amdgpu: partially revert "svm bo enable_signal call condition" Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 02/26] dma-buf: cleanup pruning of dma_resv objects Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 03/26] dma-buf: make fence mandatory for dma_resv_add_excl_fence Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 04/26] drm/qxl: use iterator instead of dma_resv_shared_list Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 05/26] dma-buf: add dma_resv_replace_fences Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 06/26] dma-buf: finally make the dma_resv_list private Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 07/26] dma-buf: drop excl_fence parameter from dma_resv_get_fences Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 08/26] dma-buf: add dma_resv_get_singleton Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 09/26] RDMA: use dma_resv_wait() instead of extracting the fence Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 10/26] drm/etnaviv: stop using dma_resv_excl_fence Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 11/26] drm/nouveau: " Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 12/26] drm/vmwgfx: " Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 13/26] drm/radeon: " Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:20 ` [PATCH 14/26] drm/amdgpu: remove excl as shared workarounds Christian König
2021-11-23 14:20   ` Christian König
2021-11-23 14:21 ` [PATCH 15/26] drm/amdgpu: use dma_resv_for_each_fence for CS workaround Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 16/26] dma-buf: finally make dma_resv_excl_fence private Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 17/26] dma-buf: drop the DAG approach for the dma_resv object Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 18/26] dma-buf/drivers: make reserving a shared slot mandatory Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 19/26] drm: support more than one write fence in drm_gem_plane_helper_prepare_fb Christian König
2021-11-23 14:21   ` Christian König
2021-11-25 15:47   ` Daniel Vetter
2021-11-25 15:47     ` Daniel Vetter
2021-11-26 10:30     ` Christian König
2021-11-26 10:30       ` Christian König
2021-11-26 15:37       ` Daniel Vetter
2021-11-26 15:37         ` Daniel Vetter
2021-11-23 14:21 ` [PATCH 20/26] drm/nouveau: support more than one write fence in fenv50_wndw_prepare_fb Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 21/26] drm/amdgpu: use dma_resv_get_singleton in amdgpu_pasid_free_cb Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 22/26] dma-buf: add enum dma_resv_usage Christian König
2021-11-23 14:21   ` Christian König
2021-11-25 15:50   ` Daniel Vetter
2021-11-25 15:50     ` Daniel Vetter
2021-11-25 15:59   ` Daniel Vetter
2021-11-25 15:59     ` Daniel Vetter
2021-11-29 12:19     ` Christian König
2021-11-29 12:19       ` Christian König
2021-11-30  8:31       ` Daniel Vetter
2021-11-30  8:31         ` Daniel Vetter
2021-11-23 14:21 ` [PATCH 23/26] dma-buf: specify usage while adding fences to dma_resv obj Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 24/26] dma-buf: wait for map to complete for static attachments Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 25/26] amdgpu: remove DMA-buf fence workaround Christian König
2021-11-23 14:21   ` Christian König
2021-11-23 14:21 ` [PATCH 26/26] drm/ttm: remove bo->moving Christian König
2021-11-23 14:21   ` Christian König
2021-11-24  8:31 ` completely rework the dma_resv semantic Pekka Paalanen
2021-11-24  8:31   ` Pekka Paalanen
2021-11-24  8:39   ` Christian König
2021-11-24  8:39     ` Christian König
2021-11-25 16:04 ` Daniel Vetter
2021-11-25 16:04   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.