[Cbe-oss-dev] [PATCH 4/5]MARS/base: kernel reduce code size

Yuji Mano yuji.mano at am.sony.com
Tue Jun 16 10:04:07 EST 2009


This patch removes saving/restoring of event mask inside kernel to reduce code
size just enough to allow for a critical kernel bug fix in the following patch.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
 base/src/mpu/kernel/kernel.c |   15 ---------------
 base/src/mpu/kernel/mutex.c  |   15 +--------------
 2 files changed, 1 insertion(+), 29 deletions(-)

--- a/base/src/mpu/kernel/kernel.c
+++ b/base/src/mpu/kernel/kernel.c
@@ -963,13 +963,9 @@ static void workload_module_load(void)
 
 static void idle_wait(void)
 {
-	int mask;
 	struct mars_workload_queue_header *cur_queue_header =
 		&kernel_buffer.workload_queue_header;
 
-	/* save event mask */
-	mask = spu_read_event_mask();
-
 	/* set event mask for the lost event */
 	spu_write_event_mask(MFC_LLR_LOST_EVENT);
 
@@ -985,20 +981,12 @@ static void idle_wait(void)
 		spu_write_event_ack(MFC_LLR_LOST_EVENT);
 	}
 
-	/* restore event mask */
-	spu_write_event_mask(mask);
-
 	/* clear any remnant lost event */
 	spu_write_event_ack(MFC_LLR_LOST_EVENT);
 }
 
 static void get_params(void)
 {
-	int mask;
-
-	/* save event mask */
-	mask = spu_read_event_mask();
-
 	/* set event mask for the lost event */
 	spu_write_event_mask(MFC_LLR_LOST_EVENT);
 
@@ -1037,9 +1025,6 @@ static void get_params(void)
 	/* start decrementer */
 	spu_write_decrementer(0);
 
-	/* restore event mask */
-	spu_write_event_mask(mask);
-
 	/* clear any remnant lost event */
 	spu_write_event_ack(MFC_LLR_LOST_EVENT);
 }
--- a/base/src/mpu/kernel/mutex.c
+++ b/base/src/mpu/kernel/mutex.c
@@ -50,7 +50,6 @@ static struct mars_mutex mutex_buffer;
 
 int mutex_lock_get(uint64_t mutex_ea, struct mars_mutex *mutex)
 {
-	int mask;
 	int state = MARS_MUTEX_STATE_NONE;
 	uint8_t id = 0;
 
@@ -64,9 +63,6 @@ int mutex_lock_get(uint64_t mutex_ea, st
 	if ((uintptr_t)mutex & MARS_MUTEX_ALIGN_MASK)
 		return MARS_ERROR_ALIGN;
 
-	/* save event mask */
-	mask = spu_read_event_mask();
-
 	/* set event mask for the lost event */
 	spu_write_event_mask(MFC_LLR_LOST_EVENT);
 
@@ -100,9 +96,6 @@ int mutex_lock_get(uint64_t mutex_ea, st
 		}
 	}
 
-	/* restore event mask */
-	spu_write_event_mask(mask);
-
 	/* clear any remnant lost event */
 	spu_write_event_ack(MFC_LLR_LOST_EVENT);
 
@@ -111,7 +104,7 @@ int mutex_lock_get(uint64_t mutex_ea, st
 
 int mutex_unlock_put(uint64_t mutex_ea, struct mars_mutex *mutex)
 {
-	int status, mask;
+	int status;
 
 	/* check function params */
 	if (!mutex_ea)
@@ -127,9 +120,6 @@ int mutex_unlock_put(uint64_t mutex_ea, 
 
 	mfc_sync(0);
 
-	/* save event mask */
-	mask = spu_read_event_mask();
-
 	/* set event mask for the lost event */
 	spu_write_event_mask(MFC_LLR_LOST_EVENT);
 
@@ -145,9 +135,6 @@ int mutex_unlock_put(uint64_t mutex_ea, 
 		status = mfc_read_atomic_status() & MFC_PUTLLC_STATUS;
 	} while (status);
 
-	/* restore event mask */
-	spu_write_event_mask(mask);
-
 	/* clear any remnant lost event */
 	spu_write_event_ack(MFC_LLR_LOST_EVENT);
 






More information about the cbe-oss-dev mailing list