[Cbe-oss-dev] [PATCH 2/2]MARS: Fix workload queue bugs

Yuji Mano yuji.mano at am.sony.com
Wed Oct 8 09:50:32 EST 2008


This fixes a bug in the workload queue internal implementation where the
destroy function was not properly checking for all tasks to be completed,
and some incorrect setting of workload state bits.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
 src/host/lib/workload_queue.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

--- a/src/host/lib/workload_queue.c
+++ b/src/host/lib/workload_queue.c
@@ -113,15 +113,11 @@ int mars_workload_queue_destroy(struct m
 
 		if (MARS_BITS_GET(&queue->block[block].bits[index], STATE) !=
 			MARS_WORKLOAD_STATE_NONE)
-			break;
+			return MARS_ERROR_STATE;
 
 		id++;
 	}
 
-	/* found some task left in workload queue */
-	if (id >= MARS_WORKLOAD_MAX)
-		return MARS_ERROR_STATE;
-
 	/* free workload queue instance */
 	free(queue);
 
@@ -335,8 +331,8 @@ int mars_workload_queue_remove_end(struc
 	}
 
 	/* set state to none */
-	MARS_BITS_SET(&queue->block[block].bits[index], TYPE,
-		MARS_WORKLOAD_TYPE_NONE);
+	MARS_BITS_SET(&queue->block[block].bits[index], STATE,
+		MARS_WORKLOAD_STATE_NONE);
 
 	mars_mutex_unlock((struct mars_mutex *)&queue->block[block]);
 
@@ -369,7 +365,7 @@ int mars_workload_queue_remove_cancel(st
 	}
 
 	/* set state back to finished */
-	MARS_BITS_SET(&queue->block[block].bits[index], TYPE,
+	MARS_BITS_SET(&queue->block[block].bits[index], STATE,
 		MARS_WORKLOAD_STATE_FINISHED);
 
 	mars_mutex_unlock((struct mars_mutex *)&queue->block[block]);






More information about the cbe-oss-dev mailing list