Skip to contentSkip to conversation

drm: nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout()

PATCH In review Kulikov Vasiliy 2 participants 2 messages Jul 26, 2010 – Jul 30, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout()

set_current_state() is called only once before the first iteration. After return from schedule_timeout() current state is TASK_RUNNING. If we are going to wait again, set_current_state() must be called.

---
 drivers/gpu/drm/nouveau/nouveau_fence.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_fence.c +2 -1
index 813d853..b7777ae 100644
@@ -186,7 +186,6 @@ nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
 	unsigned long timeout = jiffies + (3 * DRM_HZ);
 	int ret = 0;
 
-	__set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
 
 	while (1) {
 		if (nouveau_fence_signalled(sync_obj, sync_arg))
@@ -197,6 +196,8 @@ nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
 			break;
 		}
 
+		__set_current_state(intr ? TASK_INTERRUPTIBLE
+			: TASK_UNINTERRUPTIBLE);
 		if (lazy)
 			schedule_timeout(1);
 
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 9 lines · Kulikov Vasiliy

set_current_state() is called only once before the first iteration. After return from schedule_timeout() current state is TASK_RUNNING. If we are going to wait again, set_current_state() must be called.

---
 drivers/gpu/drm/nouveau/nouveau_fence.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Thanks, I've pushed this patch to the Nouveau kernel tree.

Quoted 20 lines
drivers/gpu/drm/nouveau/nouveau_fence.c +2 -1
index 813d853..b7777ae 100644
@@ -186,7 +186,6 @@ nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
 	unsigned long timeout = jiffies + (3 * DRM_HZ);
 	int ret = 0;
 
-	__set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
 
 	while (1) {
 		if (nouveau_fence_signalled(sync_obj, sync_arg))
@@ -197,6 +196,8 @@ nouveau_fence_wait(void *sync_obj, void *sync_arg, bool lazy, bool intr)
 			break;
 		}
 
+		__set_current_state(intr ? TASK_INTERRUPTIBLE
+			: TASK_UNINTERRUPTIBLE);
 		if (lazy)
 			schedule_timeout(1);