Re: [PATCH 1/2] trace: Add trap entry/exit tracepoints
From: Thomas Gleixner
Date: Thu Apr 28 2011 - 20:33:15 EST
On Fri, 22 Apr 2011, Vaibhav Nagarnaik wrote:
> #include <asm/uaccess.h>
> #include <asm/pgtable.h>
> #include <asm/system.h>
> @@ -1330,8 +1332,10 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
> struct siginfo info;
>
> fill_sigtrap_info(tsk, regs, error_code, si_code, &info);
> + trace_trap_entry(tsk->thread.trap_no);
What the heck? How is that a trap? The code is sending SIGTRAP not
entering a trap at all. What are you trying to measure ? The time it
takes to send SIGTRAP? So how is that useful as an extra event?
> /* Send us the fake SIGTRAP */
> force_sig_info(SIGTRAP, &info, tsk);
> + trace_trap_exit(tsk->thread.trap_no);
> }
>
>
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index 4857ff6..d450349 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -33,6 +33,9 @@
> #include <linux/io.h>
> #include <trace/events/irq.h>
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/trap.h>
> +
> #ifdef CONFIG_EISA
> #include <linux/ioport.h>
> #include <linux/eisa.h>
> @@ -123,6 +126,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
> {
> struct task_struct *tsk = current;
>
> + trace_trap_entry(trapnr);
While the event of do_trap() itself might be interesting, it does not
matter at all how long it takes to handle it. That code is really not
so interesting.
> @@ -286,7 +293,9 @@ do_general_protection(struct pt_regs *regs, long error_code)
> printk("\n");
> }
>
> + trace_trap_entry(tsk->thread.trap_no);
> force_sig(SIGSEGV, tsk);
> + trace_trap_exit(tsk->thread.trap_no);
We really do not care how long the force_sig() call takes. It's
irrelevant. The only interesting thing here is that we ran into a GP
trap.
> +
> +dotraplinkage void __kprobes
> +do_page_fault(struct pt_regs *regs, unsigned long error_code)
> +{
> + trace_trap_entry(14);
Yuck. Magic number 14 ? Why not 42 ?
> + __do_page_fault(regs, error_code);
> + trace_trap_exit(14);
> +}
That page fault thing is the only interesting event in terms of
runtime, but I have yet to see a proper rationale for the whole thing
aside of that completly bogus changelog which tells what output I can
produce, but not why the hell it is a good idea to add all that trace
points.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/