Messages in this thread Patch in this message | | | From | Akinobu Mita <> | Subject | Re: [mm patch] oprofile: backtrace operation does not initialized | Date | Wed, 8 Dec 2004 18:34:38 +0900 |
| |
On Wednesday 08 December 2004 18:30, Akinobu Mita wrote:
> Please apply this patch, or make oprofile initialize the backtrace > operation in case of using timer interrupt in your preferable way.
Acutually, I want this change to work my own tailor-made profiler. It simply moves the point where timer_hook is called.
e.g. move timer_hook to the entry point of schedule().
--- 2.6-mm/kernel/profile.c.orig 2004-12-07 23:52:56.000000000 +0900 +++ 2.6-mm/kernel/profile.c 2004-12-07 23:53:29.000000000 +0900 @@ -383,8 +383,6 @@ void profile_hit(int type, void *__pc) void profile_tick(int type, struct pt_regs *regs) { - if (type == CPU_PROFILING && timer_hook) - timer_hook(regs); if (!user_mode(regs) && cpu_isset(smp_processor_id(), prof_cpu_mask)) profile_hit(type, (void *)profile_pc(regs)); } --- 2.6-mm/kernel/sched.c.orig 2004-12-08 16:08:13.000000000 +0900 +++ 2.6-mm/kernel/sched.c 2004-12-08 16:10:01.000000000 +0900 @@ -2665,6 +2665,30 @@ EXPORT_SYMBOL(sub_preempt_count); #endif +#ifdef __i386__ +#define GET_CURRENT_REGS(regs) \ +do { \ + __asm__ __volatile__("movl %%ebx,%0" : "=m"(regs.ebx)); \ + __asm__ __volatile__("movl %%ecx,%0" : "=m"(regs.ecx)); \ + __asm__ __volatile__("movl %%edx,%0" : "=m"(regs.edx)); \ + __asm__ __volatile__("movl %%esi,%0" : "=m"(regs.esi)); \ + __asm__ __volatile__("movl %%edi,%0" : "=m"(regs.edi)); \ + __asm__ __volatile__("movl %%ebp,%0" : "=m"(regs.ebp)); \ + __asm__ __volatile__("movl %%eax,%0" : "=m"(regs.eax)); \ + __asm__ __volatile__("movl %%esp,%0" : "=m"(regs.esp)); \ + __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(regs.xss)); \ + __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(regs.xcs)); \ + __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(regs.xds)); \ + __asm__ __volatile__("movw %%es, %%ax;" :"=a"(regs.xes)); \ + __asm__ __volatile__("pushfl; popl %0" :"=m"(regs.eflags)); \ + \ + regs.eip = (unsigned long)current_text_addr(); \ +} while(0) + +#else +#error please define get_current_regs() +#endif + /* * schedule() is the main scheduler function. */ @@ -2692,7 +2716,12 @@ asmlinkage void __sched schedule(void) dump_stack(); } } - profile_hit(SCHED_PROFILING, __builtin_return_address(0)); + if (timer_hook) { + struct pt_regs regs; + + GET_CURRENT_REGS(regs); + timer_hook(®s); + } need_resched: preempt_disable();
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |