[Cbe-oss-dev] [PATCH] spufs: not calling spu_run_init onspu_reacquire_runnable

Masato Noguchi Masato.Noguchi at jp.sony.com
Mon Aug 13 16:02:51 EST 2007


"Christoph Hellwig" <hch at lst.de> wrote:
(2007/08/11 12:54)

>On Thu, Aug 09, 2007 at 05:11:56PM -0300, Andre Detsch wrote:
>> Subject: spufs: not calling spu_run_init on spu_reacquire_runnable
>> 
>> From: Andre Detsch <adetsch at br.ibm.com>
>> 
>> This patch fixes a major bug which was happening when a SPU thread
>> advances its execution right after being restored to a SPU. A potentially
>> outdated NPC value was being (re)written to the SPU.
>> 
>> So, spu_run_init, in this case, was either not doing anything relevant,
>> or breaking the execution of the SPU thread.
>> 
>> This fixes a common problem of losing a mailbox write when it was done
>> to a saved context.
>
>Looks fine on bare hardware.  Could anyone who owns a ps3 test a workload
>that requires context switching with this patch?


SPUCTX_UTIL_USER seems to be obsoleted by Andre's commit v2.6.22-3951-g27ec41d:
  [CELL] spufs: add spu stats in sysfs and ctx stat file in spufs

Thus, I applied a modified patch (attached below) to Geoff's
ps3-linux.git, and tested it. It looks fine on PS3 too.


diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/ce
index ac3017d..4127766 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -193,11 +193,7 @@ static int spu_reacquire_runnable(struct spu_context *ctx, 
        if (ret)
                return ret;
 
-       ret = spu_run_init(ctx, npc);
-       if (ret) {
-               spu_release(ctx);
-               return ret;
-       }
+        spuctx_switch_state(ctx, SPU_UTIL_USER);
        return 0;
 }
 


>> Signed-off-by: Andre Detsch <adetsch at br.ibm.com>
>> 
>> Index: linux-2.6.22/arch/powerpc/platforms/cell/spufs/run.c
>> ===================================================================
>> --- linux-2.6.22.orig/arch/powerpc/platforms/cell/spufs/run.c
>> +++ linux-2.6.22/arch/powerpc/platforms/cell/spufs/run.c
>> @@ -196,11 +196,7 @@ static int spu_reacquire_runnable(struct
>>  	if (ret)
>>  		return ret;
>>  
>> -	ret = spu_run_init(ctx, npc);
>> -	if (ret) {
>> -		spu_release(ctx);
>> -		return ret;
>> -	}
>> +        spuctx_switch_state(ctx, SPUCTX_UTIL_USER);
>>  	return 0;
>>  }
>>  
>> _______________________________________________
>> cbe-oss-dev mailing list
>> cbe-oss-dev at ozlabs.org
>> https://ozlabs.org/mailman/listinfo/cbe-oss-dev
>---end quoted text---
>_______________________________________________
>cbe-oss-dev mailing list
>cbe-oss-dev at ozlabs.org
>https://ozlabs.org/mailman/listinfo/cbe-oss-dev




More information about the cbe-oss-dev mailing list