Am 30.05.22 um 17:45 schrieb Sergey Senozhatsky:
On (22/05/30 16:55), Christian König wrote:
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
Christian, I'm not sure I'm following you on the "embed the lock into the
fence without much problem" part. If I understand it correctly this should
be something like:
fences = kmalloc_array(1, sizeof(*fences), GFP_KERNEL);
for_each_fence(...) {
// what spinlock should I use here?
dma_fence_init(&fences[i], .. &lock ..);
dma_fence_get(&fences[i]);
}
fence_array = dma_fence_array_create(1, fences, ....);
sync_file_create(&fence_array->base);
Well no, that's the high level usage of the dma_fence_array.
What I meant was this here:
struct dma_fence_array {
struct dma_fence base;
spinlock_t lock;
...
};
Regards,
Christian.
_______________________________________________
Linaro-mm-sig mailing list -- linaro-mm-sig@xxxxxxxxxxxxxxxx
To unsubscribe send an email to linaro-mm-sig-leave@xxxxxxxxxxxxxxxx