On Sun, Oct 25, 2009 at 11:48 AM, Wu Zhangjin <wuzhangjin@xxxxxxxxx> wrote: > > do you mean if enabling PROFILE_BEFORE_PROLOGUE, there will be some > problems with module support using -mlong-calls? > No, there are no problems. I've tested it on friday, and function graph tracing was working correctly. I meant to say that 4.2.1 we use does not generate correct profile calls from kernel modules. Maybe this issue was fixed in newer releases, I did not check. I've applied a patch (don't remember where have I found that, maybe it was created by you) to our toolchain several months ago. I was thinking about dynamic tracing, and I think a toolchain patch can be avoided completely. We only need to make difference between "jal _mcount" and "jalr v1"-style mcount calls when replacing them with "nop" instructions in the code-patching function called by ftrace_convert_nops(). This can be done in 2 ways: 1) keeping old instructions - takes extra memory, not an option 2) using 2 separate instructions to replace with. One of them could be the normal NOP instruction, which expands to "sll r0, r0, 0". For the other we could use "sll r0, r0, 1" but as it has already special meaning (SSNOP) a better candidate could be something like "sll r1, r1, 0". This way we can decide which instruction to patch in when tracing is enabled for a function, eg. when the code patcher encounters a "sll r0, r0, 0" it emits a function call using JAL and when it encounters "sll r1, r1, 0" it emits a function call using "JALR v1". Regards, Patrik