LTTng : Linux Trace Toolkit Next Generation 0.5.95, kernel 2.6.17
PATCH 10/16 LTTng : Linux Trace Toolkit Next Generation 0.5.95, kernel 2.6.17
10- LTTng architecture dependant instrumentation : i386 patch-2.6.17-lttng-0.5.95-instrumentation-i386.diff
OpenPGP public key: http://krystal.dyndns.org:8080/key/compudj.gpg Key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
arch/i386/kernel/entry.S +12 -0
@@ -237,9 +237,21 @@ no_singlestep: cmpl $(nr_syscalls), %eax jae syscall_badsys syscall_call: +#ifdef CONFIG_LTT + movl %esp, %eax # copy the stack pointer + pushl %eax # pass the stack pointer copy + call trace_real_syscall_entry + addl $4,%esp # return stack to state before pass +no_syscall_entry_trace: + movl ORIG_EAX(%esp),%eax # restore eax to it's original content +#endif call *sys_call_table(,%eax,4) movl %eax,EAX(%esp) # store the return value syscall_exit: +#ifdef CONFIG_LTT + call trace_real_syscall_exit +no_syscall_exit_trace: +#endif cli # make sure we don't miss an interrupt # setting need_resched or sigpending # between sampling and the iret
arch/i386/kernel/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_EFI) += efi.o efi_stub.o obj-$(CONFIG_DOUBLEFAULT) += doublefault.o obj-$(CONFIG_VM86) += vm86.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o +obj-$(CONFIG_LTT) += ltt.o EXTRA_AFLAGS := -traditional
arch/i386/kernel/ltt.c new file +42 -0
42 lines not on this page · raw message
arch/i386/kernel/syscall_table.S +2 -0
@@ -316,3 +316,5 @@ ENTRY(sys_call_table) .long sys_sync_file_range .long sys_tee /* 315 */ .long sys_vmsplice + .long sys_ltt_trace_generic + .long sys_ltt_register_generic
arch/i386/kernel/process.c +10 -1
@@ -38,6 +38,8 @@ #include <linux/module.h>#include <linux/kallsyms.h> #include <linux/ptrace.h> #include <linux/random.h> +#include <linux/kprobes.h> +#include <linux/ltt/ltt-facility-process.h> #include <asm/uaccess.h> #include <asm/pgtable.h>
@@ -337,6 +339,7 @@ __asm__(".section .text\n"int kernel_thread (int (*fn)(void *),void * arg,unsigned long flags) {struct pt_regs regs; +long pid;memset (®s,0 ,sizeof (regs));
@@ -351,7 +354,13 @@ int kernel_thread(int (*fn)(void *), voi regs.eflags =X86_EFLAGS_IF |X86_EFLAGS_SF |X86_EFLAGS_PF |0x2 ;/* Ok, create the new process.. */ -return do_fork (flags |CLONE_VM |CLONE_UNTRACED ,0 , ®s,0 ,NULL ,NULL ); + pid =do_fork (flags |CLONE_VM |CLONE_UNTRACED , +0 , ®s,0 ,NULL ,NULL ); +#ifdef CONFIG_LTT +if (pid >=0 ) +trace_process_kernel_thread (pid, fn); +#endif +return pid; }EXPORT_SYMBOL (kernel_thread);
arch/i386/kernel/sys_i386.c +3 -0
@@ -19,6 +19,7 @@ #include <linux/syscalls.h>#include <linux/mman.h> #include <linux/file.h> #include <linux/utsname.h> +#include <linux/ltt/ltt-facility-ipc.h> #include <asm/uaccess.h> #include <asm/ipc.h>
@@ -129,6 +130,8 @@ asmlinkage int sys_ipc (uint call, int f version = call >>16 ;/* hack for backward compatibility */ call &=0xffff ; +trace_ipc_call (call, first); +switch (call) {case SEMOP :return sys_semtimedop (first, (struct sembuf __user *)ptr, second,NULL );
arch/i386/kernel/traps.c +63 -3
195 lines not on this page · raw message
arch/i386/kernel/time.c +4 -0
@@ -56,6 +56,7 @@ #include <asm/mpspec.h>#include <asm/uaccess.h> #include <asm/processor.h> #include <asm/timer.h> +#include <asm/ltt.h> #include "mach_time.h"
@@ -298,6 +299,9 @@ irqreturn_t timer_interrupt(int irq, voiwrite_seqlock (&xtime_lock); cur_timer->mark_offset (); +#ifdef CONFIG_LTT +ltt_reset_timestamp (); +#endif //CONFIG_LTT do_timer_interrupt (irq, regs);
arch/i386/mm/fault.c +20 -4
@@ -22,6 +22,7 @@ #include <linux/vt_kern.h> /* For unbla#include <linux/highmem.h> #include <linux/module.h> #include <linux/kprobes.h> +#include <linux/ltt/ltt-facility-kernel.h> #include <asm/system.h> #include <asm/uaccess.h>
@@ -319,8 +320,11 @@ fastcall void __kprobes do_page_fault(st* protection error (error_code & 9) == 0. */ if (unlikely (address >=TASK_SIZE )) { -if (!(error_code &0x0000000d ) &&vmalloc_fault (address) >=0 ) +if (!(error_code &0x0000000d ) &&vmalloc_fault (address) >=0 ) { +trace_kernel_trap_entry (14 , (void *)regs->eip); +trace_kernel_trap_exit ();return ; + }if (notify_die (DIE_PAGE_FAULT ,"page fault" , regs, error_code,14 ,SIGSEGV ) ==NOTIFY_STOP )return ;
@@ -349,6 +353,8 @@ fastcall void __kprobes do_page_fault(stif (in_atomic () || !mm) goto bad_area_nosemaphore; +trace_kernel_trap_entry (14 , (void *)regs->eip); +/* When running in the kernel we expect faults to occur only to * addresses in user space. All other faults represent errors in the * kernel and should generate an OOPS. Unfortunatly, in the case of an
@@ -446,6 +452,7 @@ #endif tsk->thread.screen_bitmap |=1 << bit; }up_read (&mm->mmap_sem); +trace_kernel_trap_exit ();return ;/*
@@ -458,6 +465,7 @@ bad_area: bad_area_nosemaphore:/* User mode accesses just cause a SIGSEGV */ if (error_code &4 ) { +trace_kernel_trap_exit ();/* * Valid to do another page fault here because this one came * from user space.
@@ -484,6 +492,7 @@ #ifdef CONFIG_X86_F00F_BUGif (nr ==6 ) {do_invalid_op (regs,0 ); +trace_kernel_trap_exit ();return ; } }
@@ -491,16 +500,20 @@ #endif no_context:/* Are we prepared to handle this kernel fault? */ -if (fixup_exception (regs)) +if (fixup_exception (regs)) { +trace_kernel_trap_exit ();return ; + }/* * Valid to do another page fault here, because if this fault * had been triggered by is_prefetch fixup_exception would have * handled it. */ -if (is_prefetch (regs, address, error_code)) +if (is_prefetch (regs, address, error_code)) { +trace_kernel_trap_exit ();return ; + }/* * Oops. The kernel tried to access some bad page. We'll have to
@@ -579,13 +592,16 @@ do_sigbus: goto no_context;/* User space => ok to do another page fault */ -if (is_prefetch (regs, address, error_code)) +if (is_prefetch (regs, address, error_code)) { +trace_kernel_trap_exit ();return ; + } tsk->thread.cr2 = address; tsk->thread.error_code = error_code; tsk->thread.trap_no =14 ;force_sig_info_fault (SIGBUS ,BUS_ADRERR , address, tsk); +trace_kernel_trap_exit (); }#ifndef CONFIG_X86_PAE
include/asm-i386/unistd.h +2 -0
@@ -322,6 +322,8 @@ #define __NR_splice 313#define __NR_sync_file_range 314#define __NR_tee 315#define __NR_vmsplice 316 +#define __NR_ltt_trace_generic 317 +#define __NR_ltt_register_generic 318#define NR_syscalls 317
include/asm-i386/system.h +42 -4
64 lines not on this page · raw message
include/asm-i386/unistd.h +0 -0