Christian König
2022-Aug-24 15:14 UTC
[PATCH v3 6/9] dma-buf: Move dma-buf attachment to dynamic locking specification
Am 24.08.22 um 17:03 schrieb Dmitry Osipenko:> On 8/24/22 17:08, Christian K?nig wrote: >> Am 24.08.22 um 12:22 schrieb Dmitry Osipenko: >>> Move dma-buf attachment API functions to the dynamic locking >>> specification. >>> The strict locking convention prevents deadlock situations for dma-buf >>> importers and exporters. >>> >>> Previously, the "unlocked" versions of the attachment API functions >>> weren't taking the reservation lock and this patch makes them to take >>> the lock. >> Didn't we concluded that we need to keep the attach and detach callbacks >> without the lock and only move the map/unmap callbacks over? >> >> Otherwise it won't be possible for drivers to lock multiple buffers if >> they have to shuffle things around for a specific attachment. > We did conclude that. The attach/detach dma-buf ops are unlocked, but > the map_dma_buf/unmap_dma_buf must be invoked under lock and > dma_buf_dynamic_attach_unlocked() maps dma-buf if either importer or > exporter can't handle the dynamic mapping [1].Ah! You are confusing me over and over again with that :) Ok in this case that here is fine, I just need to re-read the patch. Thanks, Christian.> > [1] > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv6.0-rc2%2Fsource%2Fdrivers%2Fdma-buf%2Fdma-buf.c%23L869&data=05%7C01%7Cchristian.koenig%40amd.com%7Cdf23d89db8b84bf6d4c008da85e1dc6c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637969502441026991%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=d8kWKjDCFn%2B3KmK135Gcv6%2FMLffEYcipouqWxfc%2BKXM%3D&reserved=0 > > Hence I re-arranged the dma_resv_lock() in > dma_buf_dynamic_attach_unlocked() to move both pinning and mapping under > the held lock. >