Skip to contentSkip to conversation

LTT for 2.5.45 7/10: S/390 trace support

PATCH New Karim Yaghmour 1 participant 1 message Oct 31, 2002

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LTT for 2.5.45 7/10: S/390 trace support

D: This patch adds the bare-minimum S/390-specific low-level trace
D: statements.

diffstat:

 arch/s390/kernel/entry.S    |   18 ++++++
 arch/s390/kernel/process.c  |    5 +
 arch/s390/kernel/sys_s390.c |    3 +
 arch/s390/kernel/traps.c    |  117 ++++++++++++++++++++++++++++++++++++++++++++
 arch/s390/mm/fault.c        |   12 ++++
 drivers/s390/cio/cio.c      |    4 +
 drivers/s390/s390mach.c     |   12 ++++
 include/asm-s390/trace.h    |   16 ++++++
 8 files changed, 187 insertions(+)
arch/s390/kernel/entry.S +18 -0
diff -urpN linux-2.5.45/arch/s390/kernel/entry.S linux-2.5.45-ltt/arch/s390/kernel/entry.S
@@ -7,6 +7,7 @@
  *    Author(s): Martin Schwidefsky ([email protected]),
  *               Hartmut Penner ([email protected]),
  *               Denis Joseph Barrow ([email protected],[email protected]),
+ *  Portions added by T. Halloran: (C) Copyright 2002 IBM Poughkeepsie, IBM Corporation
  */
 
 #include <linux/sys.h>
@@ -181,6 +182,14 @@ system_call:
         GET_THREAD_INFO           # load pointer to task_struct to R9
 	sll	%r7,2
         stosm   24(%r15),0x03     # reenable interrupts
+/* call to ltt trace done here.  R8 has the syscall (svc) number to trace */
+#if (CONFIG_TRACE) /* tjh - ltt port */
+        /* add call to trace_real_syscall_entry */                          
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter     
+        l       %r1,BASED(.Ltracesysent)                                    
+        basr    %r14,%r1                                                    
+        lm      %r0,%r6,SP_R0(%r15) /* restore call clobbered regs tjh */   
+#endif
         l       %r8,sys_call_table-entry_base(%r7,%r13) # get system call addr.
 	tm	__TI_flags+3(%r9),_TIF_SYSCALL_TRACE
         bo      BASED(sysc_tracesys)
@@ -189,6 +198,13 @@ system_call:
                                   # ATTENTION: check sys_execve_glue before
                                   # changing anything here !!
 
+#if (CONFIG_TRACE) /* tjh - ltt port */
+        /* add call to trace_real_syscall_exit */ 
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter  
+        l       %r1,BASED(.Ltracesysext)                                 
+        basr    %r14,%r1                                                 
+        lm      %r0,%r6,SP_R0(%r15) /* restore call clobbered regs */
+#endif                                                                   
 sysc_return:
 	stnsm   24(%r15),0xfc     # disable I/O and ext. interrupts
 	tm	__TI_flags+3(%r9),_TIF_WORK_MASK
@@ -928,6 +944,8 @@ restart_go:
 .Lsigaltstack: .long  sys_sigaltstack
 .Ltrace:       .long  syscall_trace
 .Lvfork:       .long  sys_vfork
+.Ltracesysent: .long  trace_real_syscall_entry
+.Ltracesysext: .long  trace_real_syscall_exit 
 #if CONFIG_SMP || CONFIG_PREEMPT
 .Lschedtail:   .long  schedule_tail
 #endif
arch/s390/kernel/process.c +5 -0
diff -urpN linux-2.5.45/arch/s390/kernel/process.c linux-2.5.45-ltt/arch/s390/kernel/process.c
@@ -33,6 +33,7 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/trace.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -147,6 +148,10 @@ int kernel_thread(int (*fn)(void *), voi
 
 	/* Ok, create the new process.. */
 	p = do_fork(flags | CLONE_VM, 0, &regs, 0, NULL);
+#if (CONFIG_TRACE)
+	if(!IS_ERR(p))
+		TRACE_PROCESS(TRACE_EV_PROCESS_KTHREAD, p->pid, (int) fn);
+#endif
 	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
 }
 
arch/s390/kernel/sys_s390.c +3 -0
diff -urpN linux-2.5.45/arch/s390/kernel/sys_s390.c linux-2.5.45-ltt/arch/s390/kernel/sys_s390.c
@@ -24,6 +24,7 @@
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#include <linux/trace.h>
 
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
@@ -145,6 +146,8 @@ asmlinkage int sys_ipc (uint call, int f
         struct ipc_kludge tmp;
 	int ret;
 
+        TRACE_IPC(TRACE_EV_IPC_CALL, call, first);
+
         switch (call) {
         case SEMOP:
                 return sys_semop (first, (struct sembuf *)ptr, second);
arch/s390/kernel/traps.c +117 -0

212 lines not on this page · raw message

arch/s390/mm/fault.c +12 -0
diff -urpN linux-2.5.45/arch/s390/mm/fault.c linux-2.5.45-ltt/arch/s390/mm/fault.c
@@ -5,6 +5,7 @@
  *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
  *    Author(s): Hartmut Penner ([email protected])
  *               Ulrich Weigand ([email protected])
+ *  Portions added by T. Halloran: (C) Copyright 2002 IBM Poughkeepsie, IBM Corporation
  *
  *  Derived from "arch/i386/mm/fault.c"
  *    Copyright (C) 1995  Linus Torvalds
@@ -25,6 +26,7 @@
 #include <linux/compatmac.h>
 #include <linux/init.h>
 #include <linux/console.h>
+#include <linux/trace.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -153,6 +155,8 @@ extern inline void do_exception(struct p
 	int user_address;
         unsigned long fixup;
 	int si_code = SEGV_MAPERR;
+        trapid_t ltt_interruption_code;                 
+        char * ic_ptr = (char *) &ltt_interruption_code; 
 
         tsk = current;
         mm = tsk->mm;
@@ -200,6 +204,9 @@ extern inline void do_exception(struct p
 	 */
 	local_irq_enable();
 
+        memset(&ltt_interruption_code,0,sizeof(ltt_interruption_code));
+        memcpy(ic_ptr+4,&error_code,sizeof(error_code));
+        TRACE_TRAP_ENTRY(ltt_interruption_code,(regs->psw.addr & PSW_ADDR_MASK));
         down_read(&mm->mmap_sem);
 
         vma = find_vma(mm, address);
@@ -248,6 +255,7 @@ survive:
 	}
 
         up_read(&mm->mmap_sem);
+        TRACE_TRAP_EXIT();
         return;
 
 /*
@@ -262,6 +270,7 @@ bad_area:
                 tsk->thread.prot_addr = address;
                 tsk->thread.trap_no = error_code;
 		force_sigsegv(regs, error_code, si_code, address);
+                TRACE_TRAP_EXIT();
                 return;
 	}
 
@@ -269,6 +278,7 @@ no_context:
         /* Are we prepared to handle this kernel fault?  */
         if ((fixup = search_exception_table(regs->psw.addr)) != 0) {
                 regs->psw.addr = fixup;
+                TRACE_TRAP_EXIT();
                 return;
         }
 
@@ -316,6 +326,8 @@ do_sigbus:
 	/* Kernel mode? Handle exceptions or die */
 	if (!(regs->psw.mask & PSW_MASK_PSTATE))
 		goto no_context;
+
+	TRACE_TRAP_EXIT();
 }
 
 void do_protection_exception(struct pt_regs *regs, unsigned long error_code)
drivers/s390/cio/cio.c +4 -0
diff -urpN linux-2.5.45/drivers/s390/cio/cio.c linux-2.5.45-ltt/drivers/s390/cio/cio.c
@@ -18,6 +18,8 @@
 #include <linux/config.h>
 #include <linux/slab.h>
 
+#include <linux/trace.h>
+
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/delay.h>
@@ -945,9 +947,11 @@ do_IRQ (struct pt_regs regs)
 			}
 
 			irq_enter ();
+			TRACE_IRQ_ENTRY(irq, !(((regs).psw.mask&PSW_PROBLEM_STATE) != 0));
 			s390irq_spin_lock (irq);
 			s390_process_IRQ (irq);
 			s390irq_spin_unlock (irq);
+			TRACE_IRQ_EXIT();
 			irq_exit ();
 		}
 
drivers/s390/s390mach.c +12 -0
diff -urpN linux-2.5.45/drivers/s390/s390mach.c linux-2.5.45-ltt/drivers/s390/s390mach.c
@@ -5,6 +5,7 @@
  *  S390 version
  *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
  *    Author(s): Ingo Adlung ([email protected])
+ *  Portions added by T. Halloran: (C) Copyright 2002 IBM Poughkeepsie, IBM Corporation
  */
 
 #include <linux/config.h>
@@ -12,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/completion.h>
+#include <linux/trace.h>
 #ifdef CONFIG_SMP
 #include <linux/smp.h>
 #endif
@@ -179,10 +181,20 @@ s390_do_machine_check(void)
 {
 	int crw_count;
 	mcic_t mcic;
+        trapid_t ltt_interruption_code;
+        uint32_t ltt_old_psw;
 
 	DBG(KERN_INFO "s390_do_machine_check : starting ...\n");
 
 	memcpy(&mcic, &S390_lowcore.mcck_interruption_code, sizeof (__u64));
+	memcpy( &ltt_interruption_code,
+	        &S390_lowcore.mcck_interruption_code,
+	        sizeof(__u64));
+	memcpy( &ltt_old_psw,
+	        &S390_lowcore.mcck_old_psw,
+	        sizeof(uint32_t));
+        ltt_old_psw &=  PSW_ADDR_MASK;
+        TRACE_TRAP_ENTRY(ltt_interruption_code,ltt_old_psw);
 
 	if (mcic.mcc.mcd.sd)	/* system damage */
 		s390_handle_damage("received system damage machine check\n");
include/asm-s390/trace.h +16 -0
diff -urpN linux-2.5.45/include/asm-s390/trace.h linux-2.5.45-ltt/include/asm-s390/trace.h
@@ -0,0 +1,16 @@
+/*
+ * linux/include/asm-s390/trace.h
+ *
+ * Copyright (C) 2002, Karim Yaghmour
+ *
+ * S/390 definitions for tracing system
+ */
+
+#include <linux/trace.h>
+#include <asm-generic/trace.h>
+
+/* Current arch type */
+#define TRACE_ARCH_TYPE TRACE_ARCH_TYPE_S390
+
+/* Current variant type */
+#define TRACE_ARCH_VARIANT TRACE_ARCH_VARIANT_NONE