aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazunori Asayama <asayama@sm.sony.co.jp>2009-03-13 18:18:38 -0700
committerYuji Mano <yuji.mano@am.sony.com>2009-03-17 11:09:16 -0700
commite37585940916ded5de9575c40097102f0a6cafc8 (patch)
treeb4ba4229aab36946d3a08504b8243e5fbce13513
parentd8fb128a98995bca2cffaaefc50296e554cce87a (diff)
downloadmars-src-e37585940916ded5de9575c40097102f0a6cafc8.tar.gz
base: Idle wait fix
Avoid unexpected idle wait The current scheduler has possibility to missing 'ready' workload and to deadlock, since the static variable 'queue_header' is overwritten in the 'update_header_bits_counter' function. This patch fixes the problem by retrying the search in case that no 'ready' workload is found in a 'ready' workload block. Signed-off-by: Kazunori Asayama <asayama@sm.sony.co.jp> Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
-rw-r--r--base/src/common/kernel_internal_types.h5
-rw-r--r--base/src/mpu/kernel/kernel.c9
2 files changed, 8 insertions, 6 deletions
diff --git a/base/src/common/kernel_internal_types.h b/base/src/common/kernel_internal_types.h
index 4df701e..eec536e 100644
--- a/base/src/common/kernel_internal_types.h
+++ b/base/src/common/kernel_internal_types.h
@@ -46,9 +46,10 @@
#define MARS_KERNEL_ID_NONE 0xffff
-#define MARS_KERNEL_STATUS_BUSY 0x0
+#define MARS_KERNEL_STATUS_EXIT 0x0
#define MARS_KERNEL_STATUS_IDLE 0x1
-#define MARS_KERNEL_STATUS_EXIT 0x2
+#define MARS_KERNEL_STATUS_BUSY 0x2
+#define MARS_KERNEL_STATUS_RETRY 0x3
#define MARS_KERNEL_TICKS_FLAG_SYNC_BEGIN 0x1
#define MARS_KERNEL_TICKS_FLAG_SYNC_END 0x2
diff --git a/base/src/mpu/kernel/kernel.c b/base/src/mpu/kernel/kernel.c
index 8ed045d..c3506c3 100644
--- a/base/src/mpu/kernel/kernel.c
+++ b/base/src/mpu/kernel/kernel.c
@@ -730,7 +730,7 @@ static int workload_reserve(void)
/* search block for workload index to run */
index = search_block(block, 1);
if (index < 0)
- return MARS_KERNEL_STATUS_IDLE;
+ return MARS_KERNEL_STATUS_RETRY;
/* set global workload info based on workload block and index */
workload_id = MARS_WORKLOAD_PER_BLOCK * block + index;
@@ -938,13 +938,14 @@ int main(unsigned long long mpu_context_id,
int status = scheduler();
switch (status) {
- case MARS_KERNEL_STATUS_BUSY:
+ case MARS_KERNEL_STATUS_EXIT:
+ exit_flag = 1;
break;
case MARS_KERNEL_STATUS_IDLE:
scheduler_idle_wait();
break;
- case MARS_KERNEL_STATUS_EXIT:
- exit_flag = 1;
+ case MARS_KERNEL_STATUS_BUSY:
+ case MARS_KERNEL_STATUS_RETRY:
break;
}
}