s390 instrumentation

Mathieu Desnoyers <[email protected]>
Newsgroups gmane.linux.kernel.tracing
Message-ID <20070206141234.GA12245@Krystal>
Hi,

I just switched the s390 platform specific instrumentation from the old
LTT to the new markers. I guess there may be a subtility I have missed
about endianness, therefore it would be great to have a s390 expert
reviewing this code.

Someone will have to code the s390-specific probes if we want to claim
at supporting this architecture.

Thanks,

Mathieu

Signed-off-by: Mathieu Desnoyers <[email protected]>

--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -31,7 +31,6 @@
 #include <linux/kallsyms.h>
 #include <linux/reboot.h>
 #include <linux/kprobes.h>
-#include <linux/ltt-events.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -324,9 +323,6 @@ static void __kprobes inline do_trap(long interruption_code, int signr,
 					char *str, struct pt_regs *regs,
 					siginfo_t *info)
 {
-         trapid_t ltt_interruption_code;
-         char * ic_ptr = (char *) &ltt_interruption_code;
-
 	/*
 	 * We got all needed information from the lowcore and can
 	 * now safely switch on interrupts.
@@ -338,9 +334,8 @@ static void __kprobes inline do_trap(long interruption_code, int signr,
 				interruption_code, signr) == NOTIFY_STOP)
 		return;
 
-	memset(&ltt_interruption_code,0,sizeof(ltt_interruption_code));
-	memcpy(ic_ptr+4,&interruption_code,sizeof(interruption_code));
-	ltt_ev_trap_entry(ltt_interruption_code, (regs->psw.addr & PSW_ADDR_INSN));
+	MARK(kernel_trap_entry, "%lu %p[struct pt_regs]",
+		interruption_code & 0xffff, regs);
 
         if (regs->psw.mask & PSW_MASK_PSTATE) {
                 struct task_struct *tsk = current;
@@ -356,7 +351,7 @@ static void __kprobes inline do_trap(long interruption_code, int signr,
                 else
                         die(str, regs, interruption_code);
         }
-	ltt_ev_trap_exit();
+	MARK(kernel_trap_exit, MARK_NOARGS);
 }
 
 static inline void __user *get_check_address(struct pt_regs *regs)
@@ -457,8 +452,6 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
 	siginfo_t info;
         __u8 opcode[6];
 	__u16 __user *location;
-        trapid_t ltt_interruption_code;
-        char * ic_ptr = (char *) &ltt_interruption_code;
 	int signal = 0;
 
 	location = get_check_address(regs);
@@ -470,6 +463,9 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
 	if (regs->psw.mask & PSW_MASK_PSTATE)
 		local_irq_enable();
 
+	MARK(kernel_trap_entry, "%lu %p[struct pt_regs]",
+		interruption_code & 0xffff, regs);
+
 	if (regs->psw.mask & PSW_MASK_PSTATE) {
 		if (get_user(*((__u16 *) opcode), (__u16 __user *) location))
 			return;
@@ -527,7 +523,7 @@ asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
 		do_trap(interruption_code, signal,
 			"illegal operation", regs, &info);
 	}
-	ltt_ev_trap_exit();
+	MARK(kernel_trap_exit, MARK_NOARGS);
 }
 
 
@@ -537,8 +533,6 @@ specification_exception(struct pt_regs * regs, long interruption_code)
 {
         __u8 opcode[6];
 	__u16 __user *location = NULL;
-        trapid_t ltt_interruption_code;
-        char * ic_ptr = (char *) &ltt_interruption_code;
 	int signal = 0;
 
 	location = (__u16 __user *) get_check_address(regs);
@@ -550,6 +544,9 @@ specification_exception(struct pt_regs * regs, long interruption_code)
         if (regs->psw.mask & PSW_MASK_PSTATE)
 		local_irq_enable();
 
+	MARK(kernel_trap_entry, "%lu %p[struct pt_regs]",
+		interruption_code & 0xffff, regs);
+
         if (regs->psw.mask & PSW_MASK_PSTATE) {
 		get_user(*((__u16 *) opcode), location);
 		switch (opcode[0]) {
@@ -594,7 +591,7 @@ specification_exception(struct pt_regs * regs, long interruption_code)
 		do_trap(interruption_code, signal, 
 			"specification exception", regs, &info);
 	}
-	ltt_ev_trap_exit();
+	MARK(kernel_trap_exit, MARK_NOARGS);
 }
 #else
 DO_ERROR_INFO(SIGILL, "specification exception", specification_exception,
@@ -604,8 +601,6 @@ DO_ERROR_INFO(SIGILL, "specification exception", specification_exception,
 asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
 {
 	__u16 __user *location;
-        trapid_t ltt_interruption_code;
-        char * ic_ptr = (char *) &ltt_interruption_code;
 	int signal = 0;
 
 	location = get_check_address(regs);
@@ -617,9 +612,8 @@ asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
 	if (regs->psw.mask & PSW_MASK_PSTATE)
 		local_irq_enable();
 
-	memset(&ltt_interruption_code,0,sizeof(ltt_interruption_code));
-	memcpy(ic_ptr+4,&interruption_code,sizeof(interruption_code));
-	ltt_ev_trap_entry(ltt_interruption_code, (regs->psw.addr & PSW_ADDR_INSN));
+	MARK(kernel_trap_entry, "%lu %p[struct pt_regs]",
+		interruption_code & 0xffff, regs);
 
 	if (MACHINE_HAS_IEEE)
 		asm volatile("stfpc %0" : "=m" (current->thread.fp_regs.fpc));
@@ -695,7 +689,7 @@ asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
 		do_trap(interruption_code, signal, 
 			"data exception", regs, &info);
 	}
-	ltt_ev_trap_exit();
+	MARK(kernel_trap_exit, MARK_NOARGS);
 }
 
 asmlinkage void space_switch_exception(struct pt_regs * regs, long int_code)
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -205,8 +205,6 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection)
 	int user_address;
 	const struct exception_table_entry *fixup;
 	int si_code = SEGV_MAPERR;
-	trapid_t ltt_interruption_code;
-	char * ic_ptr = (char *) &ltt_interruption_code;
 
         tsk = current;
         mm = tsk->mm;
@@ -258,9 +256,9 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int is_protection)
 	 */
 	local_irq_enable();
 
-        memset(&ltt_interruption_code,0,sizeof(ltt_interruption_code));
-        memcpy(ic_ptr+4,&error_code,sizeof(error_code));
-        ltt_ev_trap_entry(ltt_interruption_code,(regs->psw.addr & PSW_ADDR_INSN));
+	MARK(kernel_trap_entry, "%lu %p[struct pt_regs]",
+		error_code & 0xffff, regs);
+
         down_read(&mm->mmap_sem);
 
         vma = find_vma(mm, address);
@@ -328,7 +326,7 @@ bad_area:
                 tsk->thread.prot_addr = address;
                 tsk->thread.trap_no = error_code;
 		do_sigsegv(regs, error_code, si_code, address);
-                ltt_ev_trap_exit();
+		MARK(kernel_trap_exit, MARK_NOARGS);
                 return;
 	}
 
@@ -386,7 +384,7 @@ do_sigbus:
 	if (!(regs->psw.mask & PSW_MASK_PSTATE))
 		goto no_context;
 
-	ltt_ev_trap_exit();
+	MARK(kernel_trap_exit, MARK_NOARGS);
 }
 
 void do_protection_exception(struct pt_regs *regs, unsigned long error_code)
-- 
Mathieu Desnoyers
Computer Engineering Graduate Student, École Polytechnique de Montréal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.