diff options
author | Christian König <christian.koenig@amd.com> | 2018-10-04 14:45:17 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2018-10-25 13:45:23 +0200 |
commit | 99fe21a76f0f2d36e5f9afc95ce6ed5cc354ebad (patch) | |
tree | 128be2859e481029bfa3b33e4903c5b38b489e28 /include/linux/reservation.h | |
parent | ca05359f1e64cf8303ee532e50efe4ab7563d4a9 (diff) | |
download | lwn-99fe21a76f0f2d36e5f9afc95ce6ed5cc354ebad.tar.gz lwn-99fe21a76f0f2d36e5f9afc95ce6ed5cc354ebad.zip |
dma-buf: test shared slot allocation when mutex debugging is active
Set shared_max to the number of shared fences right before we release
the lock.
This way every attempt to add a shared fence without previously
reserving a slot will cause an error.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Junwei Zhang <Jerry.Zhang@amd.com>
Link: https://patchwork.kernel.org/patch/10626147/
Diffstat (limited to 'include/linux/reservation.h')
-rw-r--r-- | include/linux/reservation.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/reservation.h b/include/linux/reservation.h index 5ddb0e143721..2f0ffca35780 100644 --- a/include/linux/reservation.h +++ b/include/linux/reservation.h @@ -214,6 +214,11 @@ reservation_object_trylock(struct reservation_object *obj) static inline void reservation_object_unlock(struct reservation_object *obj) { +#ifdef CONFIG_DEBUG_MUTEXES + /* Test shared fence slot reservation */ + if (obj->fence) + obj->fence->shared_max = obj->fence->shared_count; +#endif ww_mutex_unlock(&obj->lock); } |