Re: [Mesa-dev] [PATCH] anv: Add missing unlock in anv_scratch_pool_alloc

2018-01-04 Thread Jason Ekstrand

Wow, I have no idea how that hasn't been caught yet.  Rb


On January 4, 2018 05:33:53 Alex Smith  wrote:


Fixes hangs seen due to the lock not being released here.

Signed-off-by: Alex Smith 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/intel/vulkan/anv_allocator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_allocator.c 
b/src/intel/vulkan/anv_allocator.c

index 33bd3c68c5..fe14d6cfab 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1088,8 +1088,10 @@ anv_scratch_pool_alloc(struct anv_device *device, 
struct anv_scratch_pool *pool,

pthread_mutex_lock(>mutex);

__sync_synchronize();
-   if (bo->exists)
+   if (bo->exists) {
+  pthread_mutex_unlock(>mutex);
   return >bo;
+   }

const struct anv_physical_device *physical_device =
   >instance->physicalDevice;
--
2.13.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] anv: Add missing unlock in anv_scratch_pool_alloc

2018-01-04 Thread Lionel Landwerlin

Thanks Alex,

Reviewed-by: Lionel Landwerlin 

On 04/01/18 11:33, Alex Smith wrote:

Fixes hangs seen due to the lock not being released here.

Signed-off-by: Alex Smith 
Cc: mesa-sta...@lists.freedesktop.org
---
  src/intel/vulkan/anv_allocator.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 33bd3c68c5..fe14d6cfab 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1088,8 +1088,10 @@ anv_scratch_pool_alloc(struct anv_device *device, struct 
anv_scratch_pool *pool,
 pthread_mutex_lock(>mutex);
  
 __sync_synchronize();

-   if (bo->exists)
+   if (bo->exists) {
+  pthread_mutex_unlock(>mutex);
return >bo;
+   }
  
 const struct anv_physical_device *physical_device =

>instance->physicalDevice;



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] anv: Add missing unlock in anv_scratch_pool_alloc

2018-01-04 Thread Alex Smith
Fixes hangs seen due to the lock not being released here.

Signed-off-by: Alex Smith 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/intel/vulkan/anv_allocator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 33bd3c68c5..fe14d6cfab 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1088,8 +1088,10 @@ anv_scratch_pool_alloc(struct anv_device *device, struct 
anv_scratch_pool *pool,
pthread_mutex_lock(>mutex);
 
__sync_synchronize();
-   if (bo->exists)
+   if (bo->exists) {
+  pthread_mutex_unlock(>mutex);
   return >bo;
+   }
 
const struct anv_physical_device *physical_device =
   >instance->physicalDevice;
-- 
2.13.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev