[Fault-injection-developer] [PATCH] 2.5.44-kp2-fi1
Status: Alpha
Brought to you by:
rustyl
From: Zhuang, L. <lou...@in...> - 2002-11-14 02:54:08
|
Dear all, Following is the first fault injection patch against 2.5.x sserials kernel. kernel module part is ongoing. Please review it and give us feedback. - Louis diff -Nur -X /root/dontdiff 44-kp/Makefile 44-kp-fi/Makefile --- 44-kp/Makefile Sat Oct 19 12:01:12 2002 +++ 44-kp-fi/Makefile Wed Nov 13 16:28:48 2002 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 44 -EXTRAVERSION = +EXTRAVERSION =kp-fi # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -Nur -X /root/dontdiff 44-kp/arch/i386/Config.help 44-kp-fi/arch/i386/Config.help --- 44-kp/arch/i386/Config.help Wed Nov 13 16:24:41 2002 +++ 44-kp-fi/arch/i386/Config.help Thu Nov 14 09:43:55 2002 @@ -1108,3 +1108,6 @@ register_kprobe(), and providing a callback function. This is useful for kernel debugging, non-intrusive instrumentation and testing. If in doubt, say "N". + CONFIG_FI + Say Y here if you want to enable Fault Injection (FI) mechanism. The FI + can monitor MMIO/IO access in kernel. diff -Nur -X /root/dontdiff 44-kp/arch/i386/config.in 44-kp-fi/arch/i386/config.in --- 44-kp/arch/i386/config.in Wed Nov 13 16:25:00 2002 +++ 44-kp-fi/arch/i386/config.in Thu Nov 14 09:46:44 2002 @@ -469,6 +469,9 @@ fi bool ' Load all symbols for debugging/kksymoops' CONFIG_KALLSYMS bool ' Kprobes' CONFIG_KPROBES + if [ "$CONFIG_KPROBES" = "y" ]; then + bool ' Fault Injection' CONFIG_FI + fi fi if [ "$CONFIG_X86_LOCAL_APIC" = "y" ]; then diff -Nur -X /root/dontdiff 44-kp/arch/i386/kernel/i386_ksyms.c 44-kp-fi/arch/i386/kernel/i386_ksyms.c --- 44-kp/arch/i386/kernel/i386_ksyms.c Sat Oct 19 12:02:34 2002 +++ 44-kp-fi/arch/i386/kernel/i386_ksyms.c Thu Nov 14 10:25:53 2002 @@ -32,6 +32,7 @@ #include <asm/tlbflush.h> #include <asm/nmi.h> #include <asm/edd.h> +#include <asm/fi.h> extern void dump_thread(struct pt_regs *, struct user *); extern spinlock_t rtc_lock; @@ -207,3 +208,9 @@ EXPORT_SYMBOL(edd); EXPORT_SYMBOL(eddnr); #endif + +#ifdef CONFIG_FI +EXPORT_SYMBOL(irq_desc); +EXPORT_SYMBOL(fi_page_fault); +EXPORT_SYMBOL(fi_post_page_fault); +#endif diff -Nur -X /root/dontdiff 44-kp/arch/i386/kernel/traps.c 44-kp-fi/arch/i386/kernel/traps.c --- 44-kp/arch/i386/kernel/traps.c Wed Nov 13 16:25:00 2002 +++ 44-kp-fi/arch/i386/kernel/traps.c Thu Nov 14 09:34:36 2002 @@ -47,6 +47,7 @@ #include <asm/smp.h> #include <asm/pgalloc.h> #include <asm/arch_hooks.h> +#include <asm/fi.h> #include <linux/irq.h> #include <linux/module.h> @@ -559,6 +560,9 @@ return 0; } +int (*fi_post_page_fault) (unsigned long condition, + struct pt_regs *reg); + /* * Our handling of the processor debug registers is non-trivial. * We do not clear them on entry and exit from the kernel. Therefore @@ -595,6 +599,9 @@ if (kwatch_handler(condition, regs)) return 1; + if (fi_post_page_fault && fi_post_page_fault(condition, regs)) + return 1; + /* Interrupts not disabled for normal trap handling. */ restore_interrupts(regs); diff -Nur -X /root/dontdiff 44-kp/arch/i386/mm/fault.c 44-kp-fi/arch/i386/mm/fault.c --- 44-kp/arch/i386/mm/fault.c Wed Nov 13 16:24:41 2002 +++ 44-kp-fi/arch/i386/mm/fault.c Thu Nov 14 09:33:35 2002 @@ -26,6 +26,7 @@ #include <asm/pgalloc.h> #include <asm/hardirq.h> #include <asm/desc.h> +#include <asm/fi.h> extern void die(const char *,struct pt_regs *,long); @@ -127,6 +128,7 @@ } asmlinkage void do_invalid_op(struct pt_regs *, unsigned long); +int (*fi_page_fault) ( struct pt_regs *regs, unsigned long address); /* * This routine handles page faults. It determines the address, @@ -154,7 +156,9 @@ if (kprobe_running() && kprobe_fault_handler(regs, 14)) return; - + if (fi_page_fault && fi_page_fault(regs, address)) + return; + /* It's safe to allow irq's after cr2 has been saved */ if (regs->eflags & X86_EFLAGS_IF) local_irq_enable(); diff -Nur -X /root/dontdiff 44-kp/drivers/net/e100/e100.h 44-kp-fi/drivers/net/e100/e100.h --- 44-kp/drivers/net/e100/e100.h Sat Oct 19 12:01:20 2002 +++ 44-kp-fi/drivers/net/e100/e100.h Wed Nov 13 17:15:28 2002 @@ -100,7 +100,7 @@ #define E100_MAX_NIC 16 -#define E100_MAX_SCB_WAIT 100 /* Max udelays in wait_scb */ +#define E100_MAX_SCB_WAIT 5000 /* Max udelays in wait_scb */ #define E100_MAX_CU_IDLE_WAIT 50 /* Max udelays in wait_cus_idle */ /* HWI feature related constant */ diff -Nur -X /root/dontdiff 44-kp/include/asm-i386/fi.h 44-kp-fi/include/asm-i386/fi.h --- 44-kp/include/asm-i386/fi.h Thu Jan 1 08:00:00 1970 +++ 44-kp-fi/include/asm-i386/fi.h Thu Nov 14 09:26:53 2002 @@ -0,0 +1,8 @@ +#ifndef _ASM_FI_H +#define _ASM_FI_H +#ifdef CONFIG_FI +extern int (*fi_page_fault) ( struct pt_regs *regs, unsigned long address); +extern int (*fi_post_page_fault) (unsigned long condition, + struct pt_regs *reg); +#endif +#endif /* _ASM_FI_H */ diff -Nur -X /root/dontdiff 44-kp/kernel/ksyms.c 44-kp-fi/kernel/ksyms.c --- 44-kp/kernel/ksyms.c Sat Oct 19 12:01:08 2002 +++ 44-kp-fi/kernel/ksyms.c Thu Nov 14 10:25:32 2002 @@ -601,3 +601,7 @@ /* debug */ EXPORT_SYMBOL(dump_stack); + +#ifdef CONFIG_FI +EXPORT_SYMBOL(module_list); +#endif |