dma-buf: Suppress a thread-safety complaint
Subsystems (2)
PATCH v2 1/1 dma-buf: Suppress a thread-safety complaint
Handle all possible dma_resv_lock() return values. This patch prepares for enabling compile-time thread-safety analysis. This will cause the compiler to check whether all dma_resv_lock() return values are handled.
---
Changes compared to v1:
- Removed dead code.
- Removed the return value changes.
- Added a comment and a WARN_ON() statement.
drivers/dma-buf/dma-resv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/dma-buf/dma-resv.c +4 -1
@@ -790,8 +790,11 @@ static int __init dma_resv_lockdep(void)mmap_read_lock (mm);ww_acquire_init (&ctx, &reservation_ww_class); ret =dma_resv_lock (&obj, &ctx); -if (ret == -EDEADLK ) +if (ret) { +/* Only EDEADLK from the error injection is possible here */ +WARN_ON (ret != -EDEADLK );dma_resv_lock_slow (&obj, &ctx); + }fs_reclaim_acquire (GFP_KERNEL );/* for unmap_mapping_range on trylocked buffer objects in shrinkers */ i_mmap_lock_write (&mapping);
Quoted 5 lines · Bart Van Assche
Handle all possible
dma_resv_lock()return values. This patch prepares for enabling compile-time thread-safety analysis. This will cause the compiler to check whether alldma_resv_lock()return values are handled.Signed-off-by Bart Van Assche <[email protected]>
Do you want to push that one upstream through the DMA-buf path or do you want to upstream it through some other branch?
Regards,
Christian.
Quoted 27 lines
---
Changes compared to v1:
- Removed dead code.
- Removed the return value changes.
- Added a comment and aWARN_ON()statement.drivers/dma-buf/dma-resv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/dma-buf/dma-resv.c +4
-1@@ -790,8 +790,11 @@ static int __init dma_resv_lockdep(void)mmap_read_lock (mm);ww_acquire_init (&ctx, &reservation_ww_class); ret =dma_resv_lock (&obj, &ctx); -if (ret == -EDEADLK ) +if (ret) { +/* Only EDEADLK from the error injection is possible here */ +WARN_ON (ret != -EDEADLK );dma_resv_lock_slow (&obj, &ctx); + }fs_reclaim_acquire (GFP_KERNEL );/* for unmap_mapping_range on trylocked buffer objects in shrinkers */ i_mmap_lock_write (&mapping);
Quoted 11 lines · Christian König
Quoted 5 lines · Bart Van Assche
Handle all possible
dma_resv_lock()return values. This patch prepares for enabling compile-time thread-safety analysis. This will cause the compiler to check whether alldma_resv_lock()return values are handled.Signed-off-by Bart Van Assche <[email protected]>Reviewed-by Christian König <[email protected]>Do you want to push that one upstream through the DMA-buf path or do you want to upstream it through some other branch?
The DMA-buf path please. Peter Zijlstra requested this as one can see here:
https://lore.kernel.org/lkml/[email protected]/
Thanks,
Bart.
Quoted 8 lines · Bart Van Assche
Quoted 7 lines · Christian König
Quoted 5 lines · Bart Van Assche
Handle all possible
dma_resv_lock()return values. This patch prepares for enabling compile-time thread-safety analysis. This will cause the compiler to check whether alldma_resv_lock()return values are handled.Signed-off-by Bart Van Assche <[email protected]>
Quoted 7 lines
Quoted 4 lines
Reviewed-by Christian König <[email protected]>Do you want to push that one upstream through the DMA-buf path or do you want to upstream it through some other branch?
The DMA-buf path please. Peter Zijlstra requested this as one can see here:
https://lore.kernel.org/ lkml/[email protected]/
(replying to my own email)
Is my understanding correct that this patch has not yet been queued? If so, please let me know if I'm expected to repost this patch.
Thanks,
Bart.