2022-05-31 19:43:43

by Christian König

[permalink] [raw]
Subject: Re: [PATCH] dma-fence: allow dma fence to have their own lock

Hi Sergey,

I'm removing most of the mail because you have a very fundamental
misunderstanding about what this dma_fence lock is all about.

Am 30.05.22 um 16:22 schrieb Sergey Senozhatsky:
> [SNIP]
> So the `lock` should have at least same lifespan as the DMA fence
> that borrows it, which is impossible to guarantee in our case.

Nope, that's not correct. The lock should have at least same lifespan as
the context of the DMA fence.

The idea here is that DMA fence signaling and callback calling
serializes. E.g. when you have fence a,b,c,d... they must signal in the
order a,b,c,d... and that's what this lock is good for.

If you just want to create a single dma_fence which is also only bound
to a single context you can embed the lock into the fence without much
problem.

See how the dma_fence_array does that for example:
https://elixir.bootlin.com/linux/latest/source/include/linux/dma-fence-array.h#L37

Regards,
Christian.