[PATCH] drm/radeon: Catch reservation deadlock on same buffer with different handle v2

2013-02-13 Thread j.gli...@gmail.com
From: Jerome Glisse 

This patch print a warning message when trying to reserve same buffer
twice in same cs ioctl (because the buffer is known by userspace under
2 different handle). It does not try to fix the issue like :

https://patchwork.kernel.org/patch/1812991/

Just to make this case easier to debug.

v2: Make message a debug one not an error

Cc: stable at vger.kernel.org
Signed-off-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon_object.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index d3aface..624ea8c 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -355,6 +355,18 @@ int radeon_bo_list_validate(struct list_head *head)

r = ttm_eu_reserve_buffers(head);
if (unlikely(r != 0)) {
+   if (r == -EDEADLK) {
+   /* this is not a GPU lockup, ttm_eu_reserve_buffers
+* can not trigger detection of GPU lockup. This is
+* a dead lock trying to reserve the same buffer again
+* probably because the buffer is know as 2 different
+* handle by userspace. Print a warning message so
+* that we know what's going on.
+*/
+   DRM_DEBUG("Dead lock reserving buffer (one buffer is 
know by userspace under 2 different handle)\n");
+   /* Do not return -EDEADLK to avoid useless GPU reset */
+   return -EINVAL;
+   }
return r;
}
list_for_each_entry(lobj, head, tv.head) {
-- 
1.7.11.7



[PATCH] drm/radeon: Catch reservation deadlock on same buffer with different handle

2013-02-13 Thread j.gli...@gmail.com
From: Jerome Glisse 

This patch print a warning message when trying to reserve same buffer
twice in same cs ioctl (because the buffer is known by userspace under
2 different handle). It does not try to fix the issue like :

https://patchwork.kernel.org/patch/1812991/

Just to make this case easier to debug.

Cc: stable at vger.kernel.org
Signed-off-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon_object.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index d3aface..e40743d 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -355,6 +355,18 @@ int radeon_bo_list_validate(struct list_head *head)

r = ttm_eu_reserve_buffers(head);
if (unlikely(r != 0)) {
+   if (r == -EDEADLK) {
+   /* this is not a GPU lockup, ttm_eu_reserve_buffers
+* can not trigger detection of GPU lockup. This is
+* a dead lock trying to reserve the same buffer again
+* probably because the buffer is know as 2 different
+* handle by userspace. Print a warning message so
+* that we know what's going on.
+*/
+   DRM_ERROR("Dead lock reserving buffer (one buffer is 
know by userspace under 2 different handle)\n");
+   /* Do not return -EDEADLK to avoid useless GPU reset */
+   return -EINVAL;
+   }
return r;
}
list_for_each_entry(lobj, head, tv.head) {
-- 
1.7.11.7



[PATCH] drm/radeon: Catch reservation deadlock on same buffer with different handle v2

2013-02-13 Thread j . glisse
From: Jerome Glisse 

This patch print a warning message when trying to reserve same buffer
twice in same cs ioctl (because the buffer is known by userspace under
2 different handle). It does not try to fix the issue like :

https://patchwork.kernel.org/patch/1812991/

Just to make this case easier to debug.

v2: Make message a debug one not an error

Cc: sta...@vger.kernel.org
Signed-off-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon_object.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index d3aface..624ea8c 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -355,6 +355,18 @@ int radeon_bo_list_validate(struct list_head *head)
 
r = ttm_eu_reserve_buffers(head);
if (unlikely(r != 0)) {
+   if (r == -EDEADLK) {
+   /* this is not a GPU lockup, ttm_eu_reserve_buffers
+* can not trigger detection of GPU lockup. This is
+* a dead lock trying to reserve the same buffer again
+* probably because the buffer is know as 2 different
+* handle by userspace. Print a warning message so
+* that we know what's going on.
+*/
+   DRM_DEBUG("Dead lock reserving buffer (one buffer is 
know by userspace under 2 different handle)\n");
+   /* Do not return -EDEADLK to avoid useless GPU reset */
+   return -EINVAL;
+   }
return r;
}
list_for_each_entry(lobj, head, tv.head) {
-- 
1.7.11.7

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon: Catch reservation deadlock on same buffer with different handle

2013-02-13 Thread j . glisse
From: Jerome Glisse 

This patch print a warning message when trying to reserve same buffer
twice in same cs ioctl (because the buffer is known by userspace under
2 different handle). It does not try to fix the issue like :

https://patchwork.kernel.org/patch/1812991/

Just to make this case easier to debug.

Cc: sta...@vger.kernel.org
Signed-off-by: Jerome Glisse 
---
 drivers/gpu/drm/radeon/radeon_object.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index d3aface..e40743d 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -355,6 +355,18 @@ int radeon_bo_list_validate(struct list_head *head)
 
r = ttm_eu_reserve_buffers(head);
if (unlikely(r != 0)) {
+   if (r == -EDEADLK) {
+   /* this is not a GPU lockup, ttm_eu_reserve_buffers
+* can not trigger detection of GPU lockup. This is
+* a dead lock trying to reserve the same buffer again
+* probably because the buffer is know as 2 different
+* handle by userspace. Print a warning message so
+* that we know what's going on.
+*/
+   DRM_ERROR("Dead lock reserving buffer (one buffer is 
know by userspace under 2 different handle)\n");
+   /* Do not return -EDEADLK to avoid useless GPU reset */
+   return -EINVAL;
+   }
return r;
}
list_for_each_entry(lobj, head, tv.head) {
-- 
1.7.11.7

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel