Re: [Cbe-oss-dev] [RFC, PATCH] CELL Oprofile SPU profiling updated patch
From: Arnd Bergmann <arnd@arndb.de>
Date: 2007-02-09 19:11:04
Also in:
lkml
On Friday 09 February 2007 19:47, Milton Miller wrote:
On Feb 8, 2007, at 11:21 AM, Arnd Bergmann wrote: =20
quoted
Doing the translation in two stages in user space, as you suggest here, definitely makes sense to me. I think it can be done a little simpler though: Why would you need the accurate dcookie information to be provided by the kernel? The ELF loader is done in user space, and the kernel only reproduces what it thinks that came up with. If the kernel only gives the dcookie information about the SPU ELF binary to the oprofile user space, then that can easily recreate the same mapping.=20 Actually, I was trying to cover issues such as anonymous memory. =A0 If the kernel doesn't generate dcookies for the load segments the information is not recoverable once the task exits. =A0This would also allow the loader to create an artifical elf header that covered both the base executable and a dynamicly linked one. =20 Other alternatives exist, such as a structure for context-id that would have its own identifing magic and an array of elf header pointers.
But _why_ do you want to solve that problem? we don't have dynamically linked binaries and I really don't see why the loader would want to create artificial elf headers...
quoted
The kernel still needs to provide the overlay identifiers though.=20 Yes, which means it needs to parse the header (or libpse be enhanced to write the monitor info to a spufs file).
we thought about this in the past and discarded it because of the complexity of an spufs interface that would handle this correctly.=20
quoted
yes, this sounds nice. But tt does not at all help accuracy, only performance, right?=20 It allows the user space to know when the sample was taken and =A0be aware of the ambiguity. =A0 If the sample rate is high enough in relation to the overlay switch rate, user space could decide to discard the ambiguous samples.
yes, good point.
quoted
quoted
This approach allows multiple objects by its nature. =A0A new elf header could be constructed in memory that contained the union of the elf objects load segments, and the tools will magically work. =A0 Alternatively the object id could point to a new structure, identified via a new header, that it points to other elf headers (easily differentiated by the elf magic headers). =A0 Other binary formats, including several objects in a ar archive, could be supported.Yes, that would be a new feature if the kernel passed dcookie information for every section, but I doubt that it is worth it. I have not seen any program that allows loading code from more than one ELF file. In particular, the ELF format on the SPU is currently lacking the relocation mechanisms that you would need for resolving spu-side symbols at load time=20 Actually, It could check all load segments, and only report those where the dcookie changes (as opposed to the offset).
I'm not really following you here, but probably you misunderstood my point as well.
quoted
This seems to incur a run-time overhead on the SPU even if not profiling, I would consider that not acceptable.=20 It definitely is overhead. =A0Which means it would have to be optional, like gprof.
There is some work going on for another profiler independent of the hardware feature that only relies on instrumenting the spu executable for things like DMA transfers and overlay changes.=20 Arnd <><