[Cbe-oss-dev] spufs, ppu-gdb: ppu-gdb's info spu mailbox shows garbage
Kazunori Asayama
asayama at sm.sony.co.jp
Tue Oct 16 18:31:57 EST 2007
I found (maybe) unexpected behaviors in SPUFS and ppu-gdb regarding
displaying contents of mailbox queues as below:
1. the current implementation of read operation on wbox_info node is
inconsistent with the spec in the man page.
The read operation on "wbox_info" is defined in the man page as:
The wbox_info file contains an array of four-byte mailbox
messages, which have been sent to the SPU. With current CBEA
machines, the array is four items in length, so up to 4 * 4 =
16 bytes can be read from this file. If any mailbox queue entry
is empty, then the bytes read at the corresponding location are
undefined.
However, only up to 4 * (# of valid entries) can be read in the
current implementation of SPUFS, while 4 bytes can always be read
on "mbox_info" and "ibox_info" regardless of number of valid
entries and this behavior satisfies the spec:
The mbox_info and ibox_info files each contain the four-byte
mailbox message that has been written by the SPU. If no message
has been written to these mailboxes, then contents of these
files is unde- fined. The mbox_stat, ibox_stat and wbox_stat
files contain the available message count.
That is,
man page:
- mbox_info, ibox_info and wbox_info retun all entries of
the queues.
implementation:
- wbox_info returns only valid entries.
- mbox_info and ibox_info return all entries.
It seems odd that there is such difference between the
actual behaviors of wbox_info, mbox_info and ibox_info...
2. ppu-gdb's "info spu mailbox" command shows garbage when there are
invalid entries in "ibox_info" and/or "mbox_info".
The current "info spu mailbox" command implementation,
i.e. info_spu_mailbox_command() in gdb/spu-tdep.c, shows all data
returned by mbox_info, ibox_info and wbox_info.
However, garbage can be displayed because mbox_info and ibox_info
return invalid values when they are not full.
My question is "what is the intended behavior?" I guess that one of
following a. or b. is intended one:
a. - mbox_info, ibox_info and wbox_info should return only valid
entries; i.e. the man page is incorrect.
- gdb should show the all data returned by mbox_info, ibox_info
and wbox_info; i.e. the current implementation is correct.
b. - mbox_info, ibox_info and wbox_info should return 4 * (queue's
length) bytes regardless of number of valid entries; i.e. the
man page is correct.
- gdb should show only valid entries in the returned data by
mbox_info, ibox_info and wbox_info by checking mbox_stat,
ibox_stat and wbox_stat; i.e. the current implementation is
incorrect.
Or any other one ?
--
(ASAYAMA Kazunori
(asayama at sm.sony.co.jp))
t
More information about the cbe-oss-dev
mailing list