[Cbe-oss-dev] spu sched problems

Ishizaki Kou kou.ishizaki at toshiba.co.jp
Wed Mar 7 20:11:46 EST 2007


Christoph,
Thank you for your suggestion and sending the patch.

> On Tue, Mar 06, 2007 at 09:57:30PM +0900, Ishizaki Kou wrote:
> > Hi,
> > 
> > We met two problems about spu scheduler when we tested
> > atomic_op_sample in CellSDK 2.0.
> > 
> > We tested on a hardware that has only 7 spus. These problems occur
> > when number of spu threads is greater than number of physical spus.
> > 
> > 
> > Case #1 BUG: soft lockup detected
> > 
> > When spu_run syscall is executed and spu scheduler cannot find idle
> > spu, the calling thread falls in busy loop in spu_activate() and
> > it causes 'BUG: soft lockup detected'.
> 
> This should be fixed in Arnd's current tree.  The actual patch is
> attached below.

We tested your patch. But, it doesn't solve the problem.

We show a test code below. It uses libspe 1.2. We have not tried
with libspe2 yet.

On linux-2.6.21-rc2 without regard for your patch, it shows problem #1
and #2 every time when it runs.
On linux-2.6.20, it shows problem #2.

------------------------------------------------------ ppu side --
#define NUM_PHYSICAL_SPUS	8

#define DELAY1			5
#define DELAY2			20
#define	SPU_PROGRAM		"spu-helloworld"

#include <stdio.h>
#include <stdlib.h>
#include <libspe.h>
#include <unistd.h>
#include <string.h>

main()
{
    spe_program_handle_t *speprog;
    speid_t spe_thread[NUM_PHYSICAL_SPUS + 1];
    int status[NUM_PHYSICAL_SPUS + 1];
    int i;

    speprog = spe_open_image(SPU_PROGRAM);
    if (!speprog) {
	perror(SPU_PROGRAM);
	exit(1);
    }

    for (i = 0; i < NUM_PHYSICAL_SPUS; i++) {
        spe_thread[i] = spe_create_thread(SPE_DEF_GRP, speprog, NULL,
NULL, -1, 0);
	if (!spe_thread[i]) {
	    perror("spe_create_thread");
	    exit(1);
	}
    }

    sleep(DELAY1); /* to wait for all spe threads done */

    /* !!! this thread is not scheduled */
    spe_thread[i] = spe_create_thread(SPE_DEF_GRP, speprog, NULL, NULL,
-1, 0);
    if (!spe_thread[i]) {
	perror("spe_create_thread");
	exit(1);
    }

    sleep(DELAY2);

    for (i = 0; i < NUM_PHYSICAL_SPUS + 1; i++) {
	spe_wait(spe_thread[i], &status[i], 0);
	printf("spe thread %d done: %04x\n", i, status[i]);
    }
    spe_close_image(speprog);
	
    exit(0);
}
------------------------------------------------------------------
------------------------------------------------------ spu side --
/*
 * This program should be named as spu-helloworld.
 */
#include <stdio.h>

main()
{
    printf("hello world\n");
}
------------------------------------------------------------------

Beat regards,
Kou Ishizaki



More information about the cbe-oss-dev mailing list