[Cbe-oss-dev] [RFC/PATCH] libspe2: use mapped mailbox registers to speed up mailbox communication

Kazunori Asayama asayama at sm.sony.co.jp
Fri May 18 22:35:32 EST 2007


Arnd Bergmann <arnd at arndb.de> wrote:
> > +		// now write the remaining via spufs
> > +		while (total < count) {
> > +			aux = mbox_data + total;
> >  			rc = write(open_if_closed(spectx,FD_WBOX, 0),
> > -					(const char *)mbox_data + total, 4*count - total);
> > +				  aux, 4*(count - total));
> >  			if (rc == -1) {
> >  				break;
> >  			}
> > -			total += rc;
> > +			total += (rc/4);
> >  		}
> >  		break;
> 
> You need to hold the lock around the "write" system call, since it modifies the
> same registers that you are trying to protect with the lock.

Such lock around the "write" may cause blocking in spe_in_mbox_write()
with SPE_MBOX_ANY_NONBLOCKING in other threads...

I propose:

  - always to use _base_spe_in_mbox_write_ps() to write to mbox, if PS
    map is enabled, and,

  - to wait for the mbox by poll(), if mbox is full.

What do you think ?

--
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list