LTT for 2.5.38 8/9: MIPS trace support
Subsystems (2)
PATCH 1/1 LTT for 2.5.38 8/9: MIPS trace support
This patch adds MIPS trace support.
Here are the file modifications:
arch/mips/baget/irq.c | 5 + arch/mips/config.in | 2 arch/mips/ddb5476/irq.c | 10 +++ arch/mips/dec/irq.c | 5 + arch/mips/kernel/i8259.c | 4 + arch/mips/kernel/ipc.c | 3 + arch/mips/kernel/irq.c | 5 + arch/mips/kernel/scall_o32.S | 22 +++++++ arch/mips/kernel/time.c | 5 + arch/mips/kernel/traps.c | 123 +++++++++++++++++++++++++++++++++++++++++-- arch/mips/kernel/unaligned.c | 10 +++ arch/mips/mm/fault.c | 9 +++ include/asm-mips/trace.h | 15 +++++ 13 files changed, 212 insertions, 6 deletions
arch/mips/baget/irq.c +5 -0
@@ -18,6 +18,7 @@#include <linux/random.h> #include <linux/delay.h> #include <linux/seq_file.h> +#include <linux/trace.h> #include <asm/bitops.h> #include <asm/bootinfo.h>
@@ -178,6 +179,8 @@ static void do_IRQ(int irq, struct pt_restruct irqaction *action;int do_random, cpu; +TRACE_IRQ_ENTRY (irq, !user_mode (regs)); + cpu =smp_processor_id ();irq_enter (cpu, irq); kstat.irqs[cpu][irq]++;
@@ -202,6 +205,8 @@ static void do_IRQ(int irq, struct pt_re }unmask_irq (irq);irq_exit (cpu, irq); + +TRACE_IRQ_EXIT ();/* unmasking and bottom half handling is done magically for us. */ }
arch/mips/config.in +2 -0
@@ -477,6 +477,8 @@ fi source drivers/usb/Config.in +source drivers/trace/Config.in + mainmenu_option next_comment comment 'Kernel hacking'
arch/mips/ddb5476/irq.c +10 -0
@@ -3,6 +3,10 @@* * Copyright (C) 2000 Geert Uytterhoeven <[email protected]> * Sony Software Development Center Europe (SDCE), Brussels +* +* ---- for LTT patch ---- +* Copyright (C) 2001 Takuzo O'Hara ([email protected]). +* */ #include <linux/config.h> #include <linux/init.h>
@@ -12,6 +16,8 @@#include <linux/interrupt.h> #include <linux/ioport.h> +#include <linux/trace.h> +#include <asm/io.h> #include <asm/irq.h> #include <asm/ptrace.h>
@@ -184,6 +190,7 @@ void ddb_local0_irqdispatch(struct pt_re/* Handle the timer interrupt first */ if (mask & (1 <<NILE4_INT_GPT )) {nile4_disable_irq (NILE4_INT_GPT ); +TRACE_IRQ_ENTRY (nile4_to_irq (NILE4_INT_GPT ), ((regs->cp0_status &ST0_KSU ) ==KSU_KERNEL ));do_IRQ (nile4_to_irq (NILE4_INT_GPT ), regs);nile4_enable_irq (NILE4_INT_GPT ); mask &= ~(1 <<NILE4_INT_GPT );
@@ -193,8 +200,10 @@ void ddb_local0_irqdispatch(struct pt_renile4_disable_irq (nile4_irq);if (nile4_irq ==NILE4_INT_INTC ) {int i8259_irq =nile4_i8259_iack (); +TRACE_IRQ_ENTRY (i8259_irq, ((regs->cp0_status &ST0_KSU ) ==KSU_KERNEL ));i8259_do_irq (i8259_irq, regs); }else { +TRACE_IRQ_ENTRY (nile4_to_irq (nile4_irq), ((regs->cp0_status &ST0_KSU ) ==KSU_KERNEL ));do_IRQ (nile4_to_irq (nile4_irq), regs); }nile4_enable_irq (nile4_irq);
@@ -204,6 +213,7 @@ void ddb_local0_irqdispatch(struct pt_reddb5476_led_d3 (0 );ddb5476_led_hex (nesting <16 ? nesting :15 );#endif +TRACE_IRQ_EXIT (); }void ddb_local1_irqdispatch (void )
arch/mips/dec/irq.c +5 -0
@@ -16,6 +16,7 @@#include <linux/slab.h> #include <linux/random.h> #include <linux/seq_file.h> +#include <linux/trace.h> #include <asm/bitops.h> #include <asm/bootinfo.h>
@@ -128,6 +129,8 @@ asmlinkage void do_IRQ(int irq, struct pstruct irqaction *action;int do_random, cpu; +TRACE_IRQ_ENTRY (irq, !user_mode (regs)); + cpu =smp_processor_id ();irq_enter (cpu, irq); kstat.irqs[cpu][irq]++;
@@ -150,6 +153,8 @@ asmlinkage void do_IRQ(int irq, struct punmask_irq (irq); }irq_exit (cpu, irq); + +TRACE_IRQ_EXIT ();/* unmasking and bottom half handling is done magically for us. */ }
arch/mips/kernel/i8259.c +4 -0
@@ -15,6 +15,7 @@#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/spinlock.h> +#include <linux/trace.h> #include <asm/io.h>
@@ -267,6 +268,9 @@ void __init init_8259A(int auto_eoi) asmlinkage void i8259_do_irq(int irq, struct pt_regs regs) {panic ("i8259_do_irq: I want to be implemented" ); + +TRACE_IRQ_ENTRY (irq, !user_mode (regs)); +TRACE_IRQ_EXIT (); }/*
arch/mips/kernel/ipc.c +3 -0
@@ -13,6 +13,7 @@#include <linux/sem.h> #include <linux/msg.h> #include <linux/shm.h> +#include <linux/trace.h> #include <asm/ipc.h> #include <asm/uaccess.h>
@@ -29,6 +30,8 @@ asmlinkage int sys_ipc (uint call, int f version = call >>16 ;/* hack for backward compatibility */ call &=0xffff ; + +TRACE_IPC (TRACE_EV_IPC_CALL , call, first);switch (call) {case SEMOP :
arch/mips/kernel/irq.c +5 -0
@@ -18,6 +18,7 @@#include <linux/random.h> #include <linux/sched.h> #include <linux/seq_file.h> +#include <linux/trace.h> #include <asm/system.h>
@@ -244,6 +245,8 @@ asmlinkage unsigned int do_IRQ(int irq,struct irqaction * action;unsigned int status; +TRACE_IRQ_ENTRY (irq, !user_mode (regs)); + kstat.irqs[cpu][irq]++;spin_lock (&desc->lock); desc->handler->ack (irq);
@@ -302,6 +305,8 @@ out:*/ desc->handler->end (irq);spin_unlock (&desc->lock); + +TRACE_IRQ_EXIT ();if (softirq_pending (cpu))do_softirq ();
arch/mips/kernel/scall_o32.S +22 -0
@@ -5,6 +5,7 @@ * * Copyright (C) 1997, 1998, 1999, 2000 by Ralf Baechle */ + #include <asm/asm.h> #include <linux/errno.h> #include <asm/current.h>
@@ -49,6 +50,19 @@ NESTED(handle_sys, PT_SIZE, sp) stack_done: sw a3, PT_R26(sp) # save for syscall restart + +#if (CONFIG_TRACE || CONFIG_TRACE_MODULE) + sw t2, PT_R1(sp) + move a0, sp + jal trace_real_syscall_entry + lw t2, PT_R1(sp) + + lw a0, PT_R4(sp) # Restore argument registers + lw a1, PT_R5(sp) + lw a2, PT_R6(sp) + lw a3, PT_R7(sp) +#endif /* (CONFIG_TRACE || CONFIG_TRACE_MODULE) */ + #error lw t0, TASK_PTRACE($28) # syscall tracing enabled? andi t0, PT_TRACESYS bnez t0, trace_a_syscall
@@ -64,6 +78,10 @@ stack_done: sw v0, PT_R0(sp) # set flag for syscall restarting 1: sw v0, PT_R2(sp) # result +#if (CONFIG_TRACE || CONFIG_TRACE_MODULE) + jal trace_real_syscall_exit +#endif /* (CONFIG_TRACE || CONFIG_TRACE_MODULE) */ + EXPORT(o32_ret_from_sys_call) mfc0 t0, CP0_STATUS # need_resched and signals atomic test ori t0, t0, 1
@@ -118,6 +136,10 @@ trace_a_syscall: negu v0 # error sw v0, PT_R0(sp) # set flag for syscall restarting 1: sw v0, PT_R2(sp) # result + +#if (CONFIG_TRACE || CONFIG_TRACE_MODULE) + jal trace_real_syscall_exit +#endif /* (CONFIG_TRACE || CONFIG_TRACE_MODULE) */ #error jal syscall_trace j ret_from_sys_call
arch/mips/kernel/time.c +5 -0
@@ -21,6 +21,7 @@#include <linux/kernel_stat.h> #include <linux/spinlock.h> #include <linux/interrupt.h> +#include <linux/trace.h> #include <asm/bootinfo.h> #include <asm/cpu.h>
@@ -368,6 +369,8 @@ asmlinkage void ll_timer_interrupt(int i {int cpu =smp_processor_id (); +TRACE_TRAP_ENTRY (irq,CAUSE_EPC (regs)); +irq_enter (cpu, irq); kstat.irqs[cpu][irq]++;
@@ -375,6 +378,8 @@ asmlinkage void ll_timer_interrupt(int itimer_interrupt (irq,NULL , regs);irq_exit (cpu, irq); + +TRACE_IRQ_EXIT ();if (softirq_pending (cpu))do_softirq ();
arch/mips/kernel/traps.c +118 -5
269 lines not on this page · raw message
arch/mips/kernel/unaligned.c +9 -1
@@ -77,6 +77,7 @@#include <linux/signal.h> #include <linux/smp.h> #include <linux/smp_lock.h> +#include <linux/trace.h> #include <asm/asm.h> #include <asm/branch.h>
@@ -388,6 +389,8 @@ asmlinkage void do_ade(struct pt_regs *runsigned long pc;extern int do_dsemulret (struct pt_regs *); +TRACE_TRAP_ENTRY (CAUSE_EXCCODE (regs),CAUSE_EPC (regs)); +/* * Address errors may be deliberately induced * by the FPU emulator to take retake control
@@ -397,6 +400,7 @@ asmlinkage void do_ade(struct pt_regs *rif ((unsigned long )regs->cp0_epc == current->thread.dsemul_aerpc) {do_dsemulret (regs); +TRACE_TRAP_EXIT ();return ; }
@@ -409,8 +413,10 @@ asmlinkage void do_ade(struct pt_regs *r goto sigbus; pc = regs->cp0_epc + ((regs->cp0_cause &CAUSEF_BD ) ?4 :0 ); -if (compute_return_epc (regs)) +if (compute_return_epc (regs)) { +TRACE_TRAP_EXIT ();return ; + }if ((current->thread.mflags &MF_FIXADE ) ==0 ) goto sigbus;
@@ -419,11 +425,13 @@ asmlinkage void do_ade(struct pt_regs *r unaligned_instructions++;#endif +TRACE_TRAP_EXIT ();return ; sigbus:die_if_kernel ("Kernel unaligned instruction access" , regs);force_sig (SIGBUS , current); +TRACE_TRAP_EXIT ();return ; }
arch/mips/mm/fault.c +9 -0
@@ -18,6 +18,7 @@#include <linux/smp.h> #include <linux/smp_lock.h> #include <linux/version.h> +#include <linux/trace.h> #include <asm/hardirq.h> #include <asm/pgalloc.h>
@@ -25,6 +26,7 @@#include <asm/softirq.h> #include <asm/system.h> #include <asm/uaccess.h> +#include <asm/mipsregs.h> #define development_version (LINUX_VERSION_CODE & 0x100)
@@ -49,6 +51,8 @@ asmlinkage void do_page_fault(struct pt_unsigned long fixup;siginfo_t info; +TRACE_TRAP_ENTRY (CAUSE_EXCCODE (regs),CAUSE_EPC (regs)); +/* * We fault-in kernel-space virtual memory on-demand. The * 'reference' page table is init_mm.pgd.
@@ -116,6 +120,7 @@ good_area: }up_read (&mm->mmap_sem); +TRACE_TRAP_EXIT ();return ;/*
@@ -144,6 +149,7 @@ bad_area_nosemaphore:/* info.si_code has been set above */ info.si_addr = (void *) address;force_sig_info (SIGSEGV , &info, tsk); +TRACE_TRAP_EXIT ();return ; }
@@ -159,6 +165,7 @@ no_context:printk (KERN_DEBUG "%s: Exception at [<%lx>] (%lx)\n" , tsk->comm, regs->cp0_epc, new_epc); regs->cp0_epc = new_epc; +TRACE_TRAP_EXIT ();return ; }
@@ -201,6 +208,7 @@ do_sigbus:if (!user_mode (regs)) goto no_context; +TRACE_TRAP_EXIT ();return ; vmalloc_fault:
@@ -230,4 +238,5 @@ vmalloc_fault: goto bad_area_nosemaphore;set_pmd (pmd, *pmd_k); } +TRACE_TRAP_EXIT (); }
include/asm-mips/trace.h +15 -0
@@ -0,0 +1,15 @@ +/* +* linux/include/asm-mips/trace.h +* +* Copyright (C) 2002, Karim Yaghmour +* +* MIPS definitions for tracing system +*/ + +#include <linux/trace.h> + +/* Current arch type */ +#define TRACE_ARCH_TYPE TRACE_ARCH_TYPE_MIPS + +/* Current variant type */ +#define TRACE_ARCH_VARIANT TRACE_ARCH_VARIANT_NONE
Quoted 1 line · Karim Yaghmour
This patch adds MIPS trace support.
The MIPS stuff is all looking drastically different now so while your patch may apply to Linus's sources (which don't compile for MIPS anyway) but not to any actually working copy of the MIPS kernel.
Sorry ...
Ralf