Skip to contentSkip to conversation

Diskdump 1.0 Release

PATCH In review Takao Indoh 4 participants 16 messages Nov 29, 2004 – Dec 1, 2004

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

cover Diskdump 1.0 Release

Hi, all!
I release diskdump 1.0 for kernel 2.6.9. It can be downloaded from the following site. Please feel free to use it!
http://sourceforge.net/projects/lkdump

Diskdump project is a joint development of RedHat and Fujitsu, and I'd like to express my gratitude to a RedHat developers for many comments and advices.

<Supported architecture>
- i386
- x86_64
- ia64
- ppc64 (New features supported by IBM)

<Supported disk>
- IDE disk (New features)
- SCSI disk which is connected to the following adapter
o aic7xxx
o aic79xx
o Fusion MPT ScsiHost Driver
o sym53c8xx (New features supported by IBM)
o IBM Power Linux RAID (New features supported by IBM)

I prepare a mailing list for diskdump development. Please send a mail to this list if you have any comments.
lkdump-develop at lists.sourceforge.net

I'd like to thank IBM, NEC and HITACHI developers for their cooperation. Of course, I'd like to thank all people who gave me comments and advices on LKML.

Best Regards,
Takao Indoh

#1 lore raw

PATCH 1/7 Diskdump 1.0 Release

This is a patch for diskdump common layer.

arch/i386/kernel/nmi.c +1 -0
diff -Nur linux-2.6.9.org/arch/i386/kernel/nmi.c linux-2.6.9/arch/i386/kernel/nmi.c
@@ -564,3 +564,4 @@
 EXPORT_SYMBOL(release_lapic_nmi);
 EXPORT_SYMBOL(disable_timer_nmi_watchdog);
 EXPORT_SYMBOL(enable_timer_nmi_watchdog);
+EXPORT_SYMBOL_GPL(touch_nmi_watchdog);
arch/i386/kernel/reboot.c +2 -1
diff -Nur linux-2.6.9.org/arch/i386/kernel/reboot.c linux-2.6.9/arch/i386/kernel/reboot.c
@@ -330,7 +330,8 @@
 	 * Stop all CPUs and turn off local APICs and the IO-APIC, so
 	 * other OSs see a clean IRQ state.
 	 */
-	smp_send_stop();
+	if (!crashdump_mode())
+		smp_send_stop();
 #elif defined(CONFIG_X86_LOCAL_APIC)
 	if (cpu_has_apic) {
 		local_irq_disable();
arch/i386/kernel/smp.c +1 -1
diff -Nur linux-2.6.9.org/arch/i386/kernel/smp.c linux-2.6.9/arch/i386/kernel/smp.c
@@ -520,7 +520,7 @@
 		return 0;
 
 	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
+	WARN_ON(irqs_disabled() && !crashdump_mode());
 
 	data.func = func;
 	data.info = info;
arch/i386/kernel/traps.c +1 -0
diff -Nur linux-2.6.9.org/arch/i386/kernel/traps.c linux-2.6.9/arch/i386/kernel/traps.c
@@ -349,6 +349,7 @@
 			printk("\n");
 	notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
 		show_registers(regs);
+		try_crashdump(regs);
   	} else
 		printk(KERN_ERR "Recursive die() failure, output suppressed\n");
 
arch/i386/mm/init.c +49 -0

61 lines not on this page · raw message

arch/ia64/kernel/process.c +25 -3
diff -Nur linux-2.6.9.org/arch/ia64/kernel/process.c linux-2.6.9/arch/ia64/kernel/process.c
@@ -38,6 +38,7 @@
 #include <asm/uaccess.h>
 #include <asm/unwind.h>
 #include <asm/user.h>
+#include <asm/diskdump.h>
 
 #ifdef CONFIG_PERFMON
 # include <asm/perfmon.h>
@@ -555,11 +556,13 @@
 }
 
 void
-do_copy_regs (struct unw_frame_info *info, void *arg)
+ia64_do_copy_regs (struct unw_frame_info *info, void *arg)
 {
 	do_copy_task_regs(current, info, arg);
 }
 
+EXPORT_SYMBOL_GPL(ia64_do_copy_regs);
+
 void
 do_dump_fpu (struct unw_frame_info *info, void *arg)
 {
@@ -572,7 +575,7 @@
 	struct unw_frame_info tcore_info;
 
 	if (current == task) {
-		unw_init_running(do_copy_regs, regs);
+		unw_init_running(ia64_do_copy_regs, regs);
 	} else {
 		memset(&tcore_info, 0, sizeof(tcore_info));
 		unw_init_from_blocked_task(&tcore_info, task);
@@ -584,7 +587,7 @@
 void
 ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst)
 {
-	unw_init_running(do_copy_regs, dst);
+	unw_init_running(ia64_do_copy_regs, dst);
 }
 
 int
@@ -775,3 +778,22 @@
 }
 
 EXPORT_SYMBOL(machine_power_off);
+
+void
+ia64_freeze_cpu (struct unw_frame_info *info, void *arg)
+{
+	current->thread.ksp = (__u64)(info->sw) - 16;
+	for (;;) local_irq_disable();
+}
+
+EXPORT_SYMBOL_GPL(ia64_freeze_cpu);
+
+void
+ia64_start_dump (struct unw_frame_info *info, void *arg)
+{
+	struct dump_call_param *param = arg;
+
+	param->func(param->regs, info);
+}
+
+EXPORT_SYMBOL_GPL(ia64_start_dump);
arch/ia64/kernel/smp.c +1 -1
diff -Nur linux-2.6.9.org/arch/ia64/kernel/smp.c linux-2.6.9/arch/ia64/kernel/smp.c
@@ -332,7 +332,7 @@
 		return 0;
 
 	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
+	WARN_ON(irqs_disabled() && !crashdump_mode());
 
 	data.func = func;
 	data.info = info;
arch/ia64/kernel/traps.c +1 -0
diff -Nur linux-2.6.9.org/arch/ia64/kernel/traps.c linux-2.6.9/arch/ia64/kernel/traps.c
@@ -92,6 +92,7 @@
   	} else
 		printk(KERN_ERR "Recursive die() failure, output suppressed\n");
 
+	try_crashdump(regs);
 	bust_spinlocks(0);
 	die.lock_owner = -1;
 	spin_unlock_irq(&die.lock);
arch/ia64/mm/init.c +88 -0

94 lines not on this page · raw message

arch/ppc64/kernel/smp.c +1 -1
diff -Nur linux-2.6.9.org/arch/ppc64/kernel/smp.c linux-2.6.9/arch/ppc64/kernel/smp.c
@@ -684,7 +684,7 @@
 	unsigned long timeout;
 
 	/* Can deadlock when called with interrupts disabled */
-	WARN_ON(irqs_disabled());
+	WARN_ON(irqs_disabled() && !crashdump_mode());
 
 	data.func = func;
 	data.info = info;
arch/ppc64/kernel/traps.c +1 -0
diff -Nur linux-2.6.9.org/arch/ppc64/kernel/traps.c linux-2.6.9/arch/ppc64/kernel/traps.c
@@ -116,6 +116,7 @@
 	if (nl)
 		printk("\n");
 	show_regs(regs);
+	try_crashdump(regs);
 	bust_spinlocks(0);
 	spin_unlock_irq(&die_lock);
 
arch/ppc64/mm/init.c +28 -0
diff -Nur linux-2.6.9.org/arch/ppc64/mm/init.c linux-2.6.9/arch/ppc64/mm/init.c
@@ -593,6 +593,34 @@
 }
 EXPORT_SYMBOL(page_is_ram);
 
+unsigned long next_ram_page(unsigned long pfn)
+{
+	int i;
+	unsigned long paddr, base;
+	unsigned long best_base = (ULONG_MAX << PAGE_SHIFT);
+
+	pfn++;
+	paddr = (pfn << PAGE_SHIFT);
+                                                                                
+	for (i=0; i < lmb.memory.cnt; i++) {
+#ifdef CONFIG_MSCHUNKS
+		base = lmb.memory.region[i].physbase;
+#else
+		base = lmb.memory.region[i].base;
+#endif
+		if ((paddr >= base)
+		    && (paddr < (base + lmb.memory.region[i].size)))
+			return (paddr >> PAGE_SHIFT);
+		if ((paddr < base) && (base < best_base))
+			best_base = base;
+	}
+	if (best_base < (ULONG_MAX << PAGE_SHIFT))
+		return (best_base >> PAGE_SHIFT);
+	else
+		return ULONG_MAX;
+}
+EXPORT_SYMBOL_GPL(next_ram_page);
+
 /*
  * Initialize the bootmem system and give it all the memory we
  * have available.
arch/x86_64/kernel/reboot.c +4 -2
diff -Nur linux-2.6.9.org/arch/x86_64/kernel/reboot.c linux-2.6.9/arch/x86_64/kernel/reboot.c
@@ -130,7 +130,8 @@
 	int i;
 
 #ifdef CONFIG_SMP
-	smp_halt(); 
+	if (!crashdump_mode())
+		smp_halt(); 
 #endif
 
 	local_irq_disable();
@@ -141,7 +142,8 @@
 
 	disable_IO_APIC();
 	
-	local_irq_enable();
+	if (!crashdump_mode())
+		local_irq_enable();
 	
 	/* Tell the BIOS if we want cold or warm reboot */
 	*((unsigned short *)__va(0x472)) = reboot_mode;
arch/x86_64/kernel/traps.c +1 -0
diff -Nur linux-2.6.9.org/arch/x86_64/kernel/traps.c linux-2.6.9/arch/x86_64/kernel/traps.c
@@ -367,6 +367,7 @@
 	oops_begin();
 	handle_BUG(regs);
 	__die(str, regs, err);
+	try_crashdump(regs);
 	oops_end();
 	do_exit(SIGSEGV); 
 }
arch/x86_64/mm/fault.c +1 -0
diff -Nur linux-2.6.9.org/arch/x86_64/mm/fault.c linux-2.6.9/arch/x86_64/mm/fault.c
@@ -484,6 +484,7 @@
 	__die("Oops", regs, error_code);
 	/* Executive summary in case the body of the oops scrolled away */
 	printk(KERN_EMERG "CR2: %016lx\n", address);
+	try_crashdump(regs);
 	oops_end(); 
 	do_exit(SIGKILL);
 
arch/x86_64/mm/init.c +33 -0
diff -Nur linux-2.6.9.org/arch/x86_64/mm/init.c linux-2.6.9/arch/x86_64/mm/init.c
@@ -22,6 +22,7 @@
 #include <linux/pagemap.h>
 #include <linux/bootmem.h>
 #include <linux/proc_fs.h>
+#include <linux/module.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -378,6 +379,35 @@
 	__flush_tlb_all();
 } 
 
+unsigned long next_ram_page (unsigned long pagenr)
+{
+	int i;
+	unsigned long min_pageno = ULONG_MAX;
+
+	pagenr++;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		unsigned long addr, end;
+
+		if (e820.map[i].type != E820_RAM)	/* not usable memory */
+			continue;
+		/*
+		 *	!!!FIXME!!! Some BIOSen report areas as RAM that
+		 *	are not. Notably the 640->1Mb area. We need a sanity
+		 *	check here.
+		 */
+		addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT;
+		end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT;
+		if  ((pagenr >= addr) && (pagenr < end))
+			return pagenr;
+		if ((pagenr < addr) && (addr < min_pageno))
+			min_pageno = addr;
+	}
+	return min_pageno;
+}
+
+EXPORT_SYMBOL_GPL(next_ram_page);
+
 static inline int page_is_ram (unsigned long pagenr)
 {
 	int i;
@@ -400,6 +430,8 @@
 	return 0;
 }
 
+EXPORT_SYMBOL_GPL(page_is_ram);
+
 extern int swiotlb_force;
 
 static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
@@ -557,6 +589,7 @@
 		return 0;
 	return pfn_valid(pte_pfn(*pte));
 }
+EXPORT_SYMBOL_GPL(kern_addr_valid);
 
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
drivers/block/Kconfig +6 -0
diff -Nur linux-2.6.9.org/drivers/block/Kconfig linux-2.6.9/drivers/block/Kconfig
@@ -356,6 +356,12 @@
 	  your machine, or if you want to have a raid or loopback device
 	  bigger than 2TB.  Otherwise say N.
 
+config DISKDUMP
+	tristate "Disk dump support"
+	depends on MODULES && m
+	---help---
+	  Disk dump support.
+
 source "drivers/s390/block/Kconfig"
 
 endmenu
drivers/block/Makefile +1 -0
diff -Nur linux-2.6.9.org/drivers/block/Makefile linux-2.6.9/drivers/block/Makefile
@@ -44,3 +44,4 @@
 obj-$(CONFIG_BLK_DEV_SX8)	+= sx8.o
 obj-$(CONFIG_BLK_DEV_UB)	+= ub.o
 
+obj-$(CONFIG_DISKDUMP)		+= diskdump.o
drivers/block/diskdump.c +1123 -0

1,123 lines not on this page · raw message

drivers/char/sysrq.c +12 -1
diff -Nur linux-2.6.9.org/drivers/char/sysrq.c linux-2.6.9/drivers/char/sysrq.c
@@ -107,6 +107,17 @@
 	.action_msg	= "Resetting",
 };
 
+/* crash sysrq handler */
+static void sysrq_handle_crash(int key, struct pt_regs *pt_regs,
+			       struct tty_struct *tty) {
+	*( (char *) 0) = 0;
+}
+static struct sysrq_key_op sysrq_crash_op = {
+	.handler =       sysrq_handle_crash,
+	.help_msg =      "Crash",
+	.action_msg =    "Crashing the kernel by request",
+};
+
 static void sysrq_handle_sync(int key, struct pt_regs *pt_regs,
 			      struct tty_struct *tty) 
 {
@@ -235,7 +246,7 @@
 		 it is handled specially on the sparc
 		 and will never arrive */
 /* b */	&sysrq_reboot_op,
-/* c */ NULL,
+/* c */ &sysrq_crash_op,
 /* d */	NULL,
 /* e */	&sysrq_term_op,
 /* f */	NULL,
include/asm-generic/crashdump.h +47 -0

47 lines not on this page · raw message

include/asm-generic/diskdump.h +13 -0
diff -Nur linux-2.6.9.org/include/asm-generic/diskdump.h linux-2.6.9/include/asm-generic/diskdump.h
@@ -0,0 +1,13 @@
+#ifndef _ASM_GENERIC_DISKDUMP_H_
+#define _ASM_GENERIC_DISKDUMP_H_
+
+#include <asm-generic/crashdump.h>
+
+const static int platform_supports_diskdump = 0;
+
+struct disk_dump_sub_header {};
+
+#define size_of_sub_header()	1
+#define write_sub_header() 	1
+
+#endif /* _ASM_GENERIC_DISKDUMP_H */
include/asm-i386/crashdump.h +113 -0

113 lines not on this page · raw message

include/asm-i386/diskdump.h +55 -0

55 lines not on this page · raw message

include/asm-i386/kmap_types.h +2 -1
diff -Nur linux-2.6.9.org/include/asm-i386/kmap_types.h linux-2.6.9/include/asm-i386/kmap_types.h
@@ -23,7 +23,8 @@
 D(10)	KM_IRQ1,
 D(11)	KM_SOFTIRQ0,
 D(12)	KM_SOFTIRQ1,
-D(13)	KM_TYPE_NR
+D(13)	KM_CRASHDUMP,
+D(14)	KM_TYPE_NR
 };
 
 #undef D
include/asm-ia64/crashdump.h +76 -0

76 lines not on this page · raw message

include/asm-ia64/diskdump.h +58 -0

58 lines not on this page · raw message

include/asm-ppc/diskdump.h +6 -0
diff -Nur linux-2.6.9.org/include/asm-ppc/diskdump.h linux-2.6.9/include/asm-ppc/diskdump.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_PPC_DISKDUMP_H_
+#define _ASM_PPC_DISKDUMP_H_
+
+#include <asm-generic/diskdump.h>
+
+#endif /* _ASM_PPC_DISKDUMP_H_ */
include/asm-ppc64/crashdump.h +61 -0

61 lines not on this page · raw message

include/asm-ppc64/diskdump.h +55 -0

55 lines not on this page · raw message

include/asm-s390/diskdump.h +6 -0
diff -Nur linux-2.6.9.org/include/asm-s390/diskdump.h linux-2.6.9/include/asm-s390/diskdump.h
@@ -0,0 +1,6 @@
+#ifndef _ASM_S390_DISKDUMP_H_
+#define _ASM_S390_DISKDUMP_H_
+
+#include <asm-generic/diskdump.h>
+
+#endif /* _ASM_S390_DISKDUMP_H_ */
include/asm-x86_64/crashdump.h +86 -0

86 lines not on this page · raw message

include/asm-x86_64/diskdump.h +44 -0

44 lines not on this page · raw message

include/linux/diskdump.h +192 -0

192 lines not on this page · raw message

include/linux/interrupt.h +4 -0
diff -Nur linux-2.6.9.org/include/linux/interrupt.h linux-2.6.9/include/linux/interrupt.h
@@ -247,4 +247,8 @@
 extern int probe_irq_off(unsigned long);	/* returns 0 or negative on failure */
 extern unsigned int probe_irq_mask(unsigned long);	/* returns mask of ISA interrupts */
 
+
+extern void dump_clear_tasklet(void);
+extern void dump_run_tasklet(void);
+
 #endif
include/linux/kernel.h +16 -0
diff -Nur linux-2.6.9.org/include/linux/kernel.h linux-2.6.9/include/linux/kernel.h
@@ -137,6 +137,15 @@
 extern int tainted;
 extern const char *print_tainted(void);
 
+#define crashdump_mode()       unlikely(diskdump_mode)
+
+struct pt_regs;
+extern void try_crashdump(struct pt_regs *);
+extern void (*diskdump_func) (struct pt_regs *regs);
+extern int diskdump_mode;
+
+#define crashdump_func()	unlikely(diskdump_func)
+
 /* Values used for system_state */
 extern enum system_states {
 	SYSTEM_BOOTING,
@@ -144,6 +153,7 @@
 	SYSTEM_HALT,
 	SYSTEM_POWER_OFF,
 	SYSTEM_RESTART,
+	SYSTEM_DUMPING,
 } system_state;
 
 #define TAINT_PROPRIETARY_MODULE	(1<<0)
@@ -164,6 +174,12 @@
 #define pr_info(fmt,arg...) \
 	printk(KERN_INFO fmt,##arg)
 
+#define pr_err(fmt,arg...) \
+	printk(KERN_ERR fmt,##arg)
+
+#define pr_warn(fmt,arg...) \
+	printk(KERN_WARNING fmt,##arg)
+
 /*
  *      Display an IP address in readable format.
  */
include/linux/timer.h +3 -0
diff -Nur linux-2.6.9.org/include/linux/timer.h linux-2.6.9/include/linux/timer.h
@@ -99,4 +99,7 @@
 extern void run_local_timers(void);
 extern void it_real_fn(unsigned long);
 
+extern void dump_clear_timers(void);
+extern void dump_run_timers(void);
+
 #endif
include/linux/workqueue.h +3 -0
diff -Nur linux-2.6.9.org/include/linux/workqueue.h linux-2.6.9/include/linux/workqueue.h
@@ -86,4 +86,7 @@
 	return ret;
 }
 
+extern void dump_clear_workqueue(void);
+extern void dump_run_workqueue(void);
+
 #endif
kernel/Makefile +1 -1
diff -Nur linux-2.6.9.org/kernel/Makefile linux-2.6.9/kernel/Makefile
@@ -7,7 +7,7 @@
 	    sysctl.o capability.o ptrace.o timer.o user.o \
 	    signal.o sys.o kmod.o workqueue.o pid.o \
 	    rcupdate.o intermodule.o extable.o params.o posix-timers.o \
-	    kthread.o
+	    kthread.o dump.o
 
 obj-$(CONFIG_FUTEX) += futex.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
kernel/dump.c +241 -0

241 lines not on this page · raw message

kernel/panic.c +2 -0
diff -Nur linux-2.6.9.org/kernel/panic.c linux-2.6.9/kernel/panic.c
@@ -60,6 +60,8 @@
 	vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 	printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf);
+	if (crashdump_func())
+		BUG();
 	bust_spinlocks(0);
 
 #ifdef CONFIG_SMP
kernel/softirq.c +32 -0
diff -Nur linux-2.6.9.org/kernel/softirq.c linux-2.6.9/kernel/softirq.c
@@ -319,6 +319,38 @@
 
 EXPORT_SYMBOL(tasklet_kill);
 
+struct tasklet_head saved_tasklet;
+
+void dump_clear_tasklet(void)
+{
+	saved_tasklet.list = __get_cpu_var(tasklet_vec).list;
+	__get_cpu_var(tasklet_vec).list = NULL;
+}
+
+EXPORT_SYMBOL_GPL(dump_clear_tasklet);
+
+void dump_run_tasklet(void)
+{
+	struct tasklet_struct *list;
+
+	list = __get_cpu_var(tasklet_vec).list;
+	__get_cpu_var(tasklet_vec).list = NULL;
+
+	while (list) {
+		struct tasklet_struct *t = list;
+		list = list->next;
+
+		if (!atomic_read(&t->count) &&
+		    (test_and_clear_bit(TASKLET_STATE_SCHED, &t->state)))
+				t->func(t->data);
+
+		t->next = __get_cpu_var(tasklet_vec).list;
+		__get_cpu_var(tasklet_vec).list = t;
+	}
+}
+
+EXPORT_SYMBOL_GPL(dump_run_tasklet);
+
 void __init softirq_init(void)
 {
 	open_softirq(TASKLET_SOFTIRQ, tasklet_action, NULL);
kernel/timer.c +39 -4

92 lines not on this page · raw message

kernel/workqueue.c +34 -0
diff -Nur linux-2.6.9.org/kernel/workqueue.c linux-2.6.9/kernel/workqueue.c
@@ -444,6 +444,37 @@
 
 }
 
+static struct cpu_workqueue_struct saved_cwq;
+
+void dump_clear_workqueue(void)
+{
+	int cpu = smp_processor_id();
+	struct cpu_workqueue_struct *cwq = keventd_wq->cpu_wq + cpu;
+
+	memcpy(&saved_cwq, cwq, sizeof(saved_cwq));
+	spin_lock_init(&cwq->lock);
+	INIT_LIST_HEAD(&cwq->worklist);
+	init_waitqueue_head(&cwq->more_work);
+	init_waitqueue_head(&cwq->work_done);
+}
+
+void dump_run_workqueue(void)
+{
+	struct cpu_workqueue_struct *cwq;
+
+	cwq = keventd_wq->cpu_wq + smp_processor_id();
+	while (!list_empty(&cwq->worklist)) {
+		struct work_struct *work = list_entry(cwq->worklist.next,
+						struct work_struct, entry);
+		void (*f) (void *) = work->func;
+		void *data = work->data;
+
+		list_del_init(cwq->worklist.next);
+		clear_bit(0, &work->pending);
+		f(data);
+	}
+}
+
 #ifdef CONFIG_HOTPLUG_CPU
 /* Take the work from this (downed) CPU. */
 static void take_over_work(struct workqueue_struct *wq, unsigned int cpu)
@@ -527,3 +558,6 @@
 EXPORT_SYMBOL(schedule_delayed_work);
 EXPORT_SYMBOL(schedule_delayed_work_on);
 EXPORT_SYMBOL(flush_scheduled_work);
+
+EXPORT_SYMBOL_GPL(dump_clear_workqueue);
+EXPORT_SYMBOL_GPL(dump_run_workqueue);
#2 lore raw
Quoted 1 line · Takao Indoh

This is a patch for diskdump common layer.

...

drivers/block/diskdump.c line 65

Quoted 8 lines
drivers/block/diskdump.c +8 -0
+static int fallback_on_err = 1;
+static int allow_risky_dumps = 1;
+static unsigned int block_order = 2;
+static int sample_rate = 8;
+module_param_named(fallback_on_err, fallback_on_err, bool, S_IRUGO|S_IWUSR);
+module_param_named(allow_risky_dumps, allow_risky_dumps, bool, S_IRUGO|S_IWUSR);
+module_param_named(block_order, block_order, uint, S_IRUGO|S_IWUSR);
+module_param_named(sample_rate, sample_rate, int, S_IRUGO|S_IWUSR);

You can just use "module_param" here (and elsewhere in the patch), since the name is the same as the variable name.

Cheers,
Rusty.

Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman
#3 lore raw
Quoted 4 lines · Rusty Russell
Quoted 1 line · Takao Indoh

This is a patch for diskdump common layer.

...

Quoted 13 lines

drivers/block/diskdump.c line 65

Quoted 10 lines
drivers/block/diskdump.c +5 -0
+static int fallback_on_err = 1;
+static int allow_risky_dumps = 1;
+static unsigned int block_order = 2;
+static int sample_rate = 8;
+module_param_named(fallback_on_err, fallback_on_err, bool, S_IRUGO|

S_IWUSR);
+module_param_named(allow_risky_dumps, allow_risky_dumps, bool, S_IRUGO| S_IWUSR);

drivers/block/diskdump.c +2 -0
+module_param_named(block_order, block_order, uint, S_IRUGO|S_IWUSR);
+module_param_named(sample_rate, sample_rate, int, S_IRUGO|S_IWUSR);

You can just use "module_param" here (and elsewhere in the patch), since the name is the same as the variable name.

I see, thanks!

Best Regards,
Takao Indoh

#4 lore raw

PATCH 2/7 Diskdump 1.0 Release

In reply to Takao Indoh

This is a patch for scsi-dump.

drivers/scsi/Kconfig +6 -0
diff -Nur linux-2.6.9.org/drivers/scsi/Kconfig linux-2.6.9/drivers/scsi/Kconfig
@@ -55,6 +55,12 @@
 	  In this case, do not compile the driver for your SCSI host adapter
 	  (below) as a module either.
 
+config SCSI_DUMP
+	tristate "SCSI dump support"
+	depends on DISKDUMP && SCSI && MODULES && m
+	help
+	   SCSI dump support
+
 config CHR_DEV_ST
 	tristate "SCSI tape support"
 	depends on SCSI
drivers/scsi/Makefile +2 -0
diff -Nur linux-2.6.9.org/drivers/scsi/Makefile linux-2.6.9/drivers/scsi/Makefile
@@ -139,6 +139,8 @@
 obj-$(CONFIG_BLK_DEV_SR)	+= sr_mod.o
 obj-$(CONFIG_CHR_DEV_SG)	+= sg.o
 
+obj-$(CONFIG_SCSI_DUMP)		+= scsi_dump.o
+
 scsi_mod-y			+= scsi.o hosts.o scsi_ioctl.o constants.o \
 				   scsicam.o scsi_error.o scsi_lib.o \
 				   scsi_scan.o scsi_syms.o scsi_sysfs.o \
drivers/scsi/scsi.c +3 -0
diff -Nur linux-2.6.9.org/drivers/scsi/scsi.c linux-2.6.9/drivers/scsi/scsi.c
@@ -714,6 +714,9 @@
 {
 	unsigned long flags;
 
+	if (crashdump_mode())
+		return;
+
 	/*
 	 * Set the serial numbers back to zero
 	 */
drivers/scsi/scsi_dump.c +635 -0

635 lines not on this page · raw message

drivers/scsi/scsi_error.c +3 -0
diff -Nur linux-2.6.9.org/drivers/scsi/scsi_error.c linux-2.6.9/drivers/scsi/scsi_error.c
@@ -419,6 +419,9 @@
  **/
 static void scsi_eh_done(struct scsi_cmnd *scmd)
 {
+	if (crashdump_mode())
+		return;
+
 	/*
 	 * if the timeout handler is already running, then just set the
 	 * flag which says we finished late, and return.  we have no
drivers/scsi/scsi_priv.h +0 -1
diff -Nur linux-2.6.9.org/drivers/scsi/scsi_priv.h linux-2.6.9/drivers/scsi/scsi_priv.h
@@ -102,7 +102,6 @@
 /* scsi_error.c */
 extern void scsi_times_out(struct scsi_cmnd *cmd);
 extern int scsi_error_handler(void *host);
-extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
 extern void scsi_eh_wakeup(struct Scsi_Host *shost);
 extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
 
drivers/scsi/scsi_syms.c +2 -0
diff -Nur linux-2.6.9.org/drivers/scsi/scsi_syms.c linux-2.6.9/drivers/scsi/scsi_syms.c
@@ -95,3 +95,5 @@
  */
 EXPORT_SYMBOL(scsi_add_timer);
 EXPORT_SYMBOL(scsi_delete_timer);
+
+EXPORT_SYMBOL_GPL(scsi_decide_disposition);
drivers/scsi/scsi_sysfs.c +3 -0
diff -Nur linux-2.6.9.org/drivers/scsi/scsi_sysfs.c linux-2.6.9/drivers/scsi/scsi_sysfs.c
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/blkdev.h>
 #include <linux/device.h>
+#include <linux/diskdump.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
@@ -376,6 +377,7 @@
 
 DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field);
 
+static DEVICE_ATTR(dump, S_IRUGO | S_IWUSR, diskdump_sysfs_show, diskdump_sysfs_store);
 
 /* Default template for device attributes.  May NOT be modified */
 static struct device_attribute *scsi_sysfs_sdev_attrs[] = {
@@ -390,6 +392,7 @@
 	&dev_attr_delete,
 	&dev_attr_state,
 	&dev_attr_timeout,
+	&dev_attr_dump,
 	NULL
 };
 
include/scsi/scsi_eh.h +1 -0
diff -Nur linux-2.6.9.org/include/scsi/scsi_eh.h linux-2.6.9/include/scsi/scsi_eh.h
@@ -11,6 +11,7 @@
 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
 extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
 extern int scsi_block_when_processing_errors(struct scsi_device *);
+extern int scsi_decide_disposition(struct scsi_cmnd *);
 
 /*
  * Reset request from external source
include/scsi/scsi_host.h +39 -0
diff -Nur linux-2.6.9.org/include/scsi/scsi_host.h linux-2.6.9/include/scsi/scsi_host.h
@@ -370,6 +370,45 @@
 	 * module_init/module_exit.
 	 */
 	struct list_head legacy_hosts;
+
+	/* operations for dump */
+
+	/*
+	 * dump_sanity_check() checks if the selected device works normally.
+	 * A device which returns an error status will not be selected as
+	 * the dump device.
+	 *
+	 * Status: OPTIONAL
+	 */
+	int (* dump_sanity_check)(struct scsi_device *);
+
+	/*
+	 * dump_quiesce() is called after the device is selected as the
+	 * dump device. Usually, host reset is executed and Write Cache
+	 * Enable bit of the disk device is temporarily set for the
+	 * dump operation.
+	 *
+	 * Status: OPTIONAL
+	 */
+	int (* dump_quiesce)(struct scsi_device *);
+
+	/*
+	 * dump_shutdown() is called after dump is completed. Usually
+	 * "SYNCHRONIZE CACHE" command is issued to the disk.
+	 *
+	 * Status: OPTIONAL
+	 */
+	int (* dump_shutdown)(struct scsi_device *);
+
+	/*
+	 * dump_poll() should call the interrupt handler. It is called
+	 * repeatedly after queuecommand() is issued, and until the command
+	 * is completed. If the low level device driver support crash dump,
+	 * it must have this routine.
+	 *
+	 * Status: OPTIONAL
+	 */
+	void (* dump_poll)(struct scsi_device *);
 };
 
 /*
#5 lore raw

PATCH 3/7 Diskdump 1.0 Release

In reply to Takao Indoh

This is a patch for ide-dump.

drivers/ide/Kconfig +6 -0
diff -Nur linux-2.6.9.org/drivers/ide/Kconfig linux-2.6.9/drivers/ide/Kconfig
@@ -263,6 +263,12 @@
 	  If both this SCSI emulation and native ATAPI support are compiled
 	  into the kernel, the native support will be used.
 
+config BLK_DEV_IDEDUMP
+	tristate "Include IDE disk dump support"
+	depends on DISKDUMP && BLK_DEV_IDE && MODULES && m
+	help
+	  Include IDE disk dump support
+
 config IDE_TASK_IOCTL
 	bool "IDE Taskfile Access"
 	help
drivers/ide/Makefile +1 -0
diff -Nur linux-2.6.9.org/drivers/ide/Makefile linux-2.6.9/drivers/ide/Makefile
@@ -49,6 +49,7 @@
 obj-$(CONFIG_BLK_DEV_IDECD)		+= ide-cd.o
 obj-$(CONFIG_BLK_DEV_IDETAPE)		+= ide-tape.o
 obj-$(CONFIG_BLK_DEV_IDEFLOPPY)		+= ide-floppy.o
+obj-$(CONFIG_BLK_DEV_IDEDUMP)		+= ide-dump.o
 
 obj-$(CONFIG_BLK_DEV_IDE)		+= legacy/ arm/
 obj-$(CONFIG_BLK_DEV_HD)		+= legacy/
drivers/ide/ide-dump.c +421 -0

421 lines not on this page · raw message

drivers/ide/ide.c +26 -1
diff -Nur linux-2.6.9.org/drivers/ide/ide.c linux-2.6.9/drivers/ide/ide.c
@@ -159,6 +159,7 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
+#include <linux/diskdump.h>
 
 
 /* default maximum number of failures */
@@ -190,6 +191,28 @@
 EXPORT_SYMBOL(noautodma);
 
 /*
+ * IDE sysfs interface routines
+ */
+static DEVICE_ATTR(dump, S_IRUGO | S_IWUSR, diskdump_sysfs_show, diskdump_sysfs_store);
+
+/* device attributes */
+static struct device_attribute *ide_sysfs_attrs[] = {
+	&dev_attr_dump,
+	NULL
+};
+
+static int ide_attr_add(ide_drive_t *drive)
+{
+	int i, error = 0;
+	for (i = 0; ide_sysfs_attrs[i]; i++) {
+		error = device_create_file(&drive->gendev, ide_sysfs_attrs[i]);
+		if (error)
+			break;
+	}
+	return error;
+}
+
+/*
  * This is declared extern in ide.h, for access by other IDE modules:
  */
 ide_hwif_t ide_hwifs[MAX_HWIFS];	/* master data repository */
@@ -2363,8 +2386,10 @@
 	list_for_each_safe(list_loop, tmp_storage, &list) {
 		ide_drive_t *drive = container_of(list_loop, ide_drive_t, list);
 		list_del_init(&drive->list);
-		if (drive->present)
+		if (drive->present) {
 			ata_attach(drive);
+			ide_attr_add(drive);
+		}
 	}
 	driver->gen_driver.name = (char *) driver->name;
 	driver->gen_driver.bus = &ide_bus_type;
#6 lore raw
Quoted 1 line · Takao Indoh

This is a patch for ide-dump.

...

drivers/ide/ide-dump.c line 419

Quoted 5 lines
drivers/ide/ide-dump.c +5 -0
+MODULE_AUTHOR("Nobuhiro Tachino <[email protected]>");
+MODULE_DESCRIPTION("IDE diskdump driver");
+MODULE_LICENSE("GPL");
+MODULE_PARM(no_io_32bit, "i");
+MODULE_PARM(pio_mode, "i");

Please use the modern module_param()!

Thanks,
Rusty.

Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman
#7 lore raw

PATCH 4/7 Diskdump 1.0 Release

In reply to Takao Indoh

This is a patch for aic7xxx/aic79xx driver.

drivers/scsi/aic7xxx/aic79xx_osm.c +37 -0
diff -Nur linux-2.6.9.org/drivers/scsi/aic7xxx/aic79xx_osm.c linux-2.6.9/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -781,6 +781,8 @@
 static int	   ahd_linux_bus_reset(Scsi_Cmnd *);
 static int	   ahd_linux_dev_reset(Scsi_Cmnd *);
 static int	   ahd_linux_abort(Scsi_Cmnd *);
+static int	   ahd_linux_sanity_check(struct scsi_device *);
+static void	   ahd_linux_poll(struct scsi_device *);
 
 /*
  * Calculate a safe value for AHD_NSEG (as expressed through ahd_linux_nseg).
@@ -1679,6 +1681,8 @@
 	.slave_alloc		= ahd_linux_slave_alloc,
 	.slave_configure	= ahd_linux_slave_configure,
 	.slave_destroy		= ahd_linux_slave_destroy,
+	.dump_sanity_check	= ahd_linux_sanity_check,
+	.dump_poll		= ahd_linux_poll,
 };
 
 /**************************** Tasklet Handler *********************************/
@@ -4186,6 +4190,39 @@
 	return IRQ_RETVAL(ours);
 }
 
+static int
+ahd_linux_sanity_check(struct scsi_device *device)
+{
+	struct ahd_softc *ahd;
+	struct ahd_linux_device *dev;
+
+	ahd = *(struct ahd_softc **)device->host->hostdata;
+	dev = ahd_linux_get_device(ahd, device->channel,
+				   device->id, device->lun,
+				   /*alloc*/FALSE);
+
+	if (dev == NULL)
+		return -ENXIO;
+	if (ahd->platform_data->qfrozen || dev->qfrozen)
+		return -EBUSY;
+	if (spin_is_locked(&ahd->platform_data->spin_lock))
+		return -EBUSY;
+	return 0;
+}
+
+static void
+ahd_linux_poll(struct scsi_device *device)
+{
+	struct ahd_softc *ahd;
+	int ours;
+
+	ahd = *(struct ahd_softc **)device->host->hostdata;
+	ours = ahd_intr(ahd);
+	if (ahd_linux_next_device_to_run(ahd) != NULL)
+		ahd_schedule_runq(ahd);
+	ahd_linux_run_complete_queue(ahd);
+}
+
 void
 ahd_platform_flushwork(struct ahd_softc *ahd)
 {
drivers/scsi/aic7xxx/aic7xxx_osm.c +39 -0
diff -Nur linux-2.6.9.org/drivers/scsi/aic7xxx/aic7xxx_osm.c linux-2.6.9/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -772,6 +772,8 @@
 static int	   ahc_linux_bus_reset(Scsi_Cmnd *);
 static int	   ahc_linux_dev_reset(Scsi_Cmnd *);
 static int	   ahc_linux_abort(Scsi_Cmnd *);
+static int	   ahc_linux_sanity_check(struct scsi_device *);
+static void	   ahc_linux_poll(struct scsi_device *);
 
 /*
  * Calculate a safe value for AHC_NSEG (as expressed through ahc_linux_nseg).
@@ -1308,6 +1310,8 @@
 	.slave_alloc		= ahc_linux_slave_alloc,
 	.slave_configure	= ahc_linux_slave_configure,
 	.slave_destroy		= ahc_linux_slave_destroy,
+	.dump_sanity_check	= ahc_linux_sanity_check,
+	.dump_poll		= ahc_linux_poll,
 };
 
 /**************************** Tasklet Handler *********************************/
@@ -3861,6 +3865,41 @@
 	return IRQ_RETVAL(ours);
 }
 
+static int
+ahc_linux_sanity_check(struct scsi_device *device)
+{
+	struct ahc_softc *ahc;
+	struct ahc_linux_device *dev;
+
+	ahc = *(struct ahc_softc **)device->host->hostdata;
+	dev = ahc_linux_get_device(ahc, device->channel,
+				   device->id, device->lun,
+					   /*alloc*/FALSE);
+	if (dev == NULL)
+		return -ENXIO;
+	if (ahc->platform_data->qfrozen || dev->qfrozen)
+		return -EBUSY;
+	if (spin_is_locked(&ahc->platform_data->spin_lock))
+		return -EBUSY;
+	return 0;
+}
+
+static void
+ahc_linux_poll(struct scsi_device *device)
+{
+	struct ahc_softc *ahc;
+	struct ahc_linux_device *dev;
+
+	ahc = *(struct ahc_softc **)device->host->hostdata;
+	ahc_intr(ahc);
+	while ((dev = ahc_linux_next_device_to_run(ahc)) != NULL) {
+		TAILQ_REMOVE(&ahc->platform_data->device_runq, dev, links);
+		dev->flags &= ~AHC_DEV_ON_RUN_LIST;
+		ahc_linux_check_device_queue(ahc, dev);
+	}
+	ahc_linux_run_complete_queue(ahc);
+}
+
 void
 ahc_platform_flushwork(struct ahc_softc *ahc)
 {
#8 lore raw

PATCH 5/7 Diskdump 1.0 Release

In reply to Takao Indoh

This is a patch for Fusion-MPT scsi driver.

drivers/message/fusion/mptbase.c +19 -1
diff -Nur linux-2.6.9.org/drivers/message/fusion/mptbase.c linux-2.6.9/drivers/message/fusion/mptbase.c
@@ -3164,7 +3164,7 @@
 		 *
 		 */
 		CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_DISABLE_ARM);
-		mdelay (1);
+		MPT_MDELAY (1);
 
 		/*
 		 * Now hit the reset bit in the Diagnostic register
@@ -5928,6 +5928,23 @@
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+/**
+ *	mpt_poll_interrupt - Check the status of interrupt and if any interrupt
+ *	are triggered, call interrupt handler.
+ *	@ioc: Pointer to MPT_ADAPTER structure
+ */
+void
+mpt_poll_interrupt(MPT_ADAPTER *ioc)
+{
+	u32 intstat;
+
+	intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
+
+	if (intstat & MPI_HIS_REPLY_MESSAGE_INTERRUPT)
+		mpt_interrupt(0, ioc, NULL);
+}
+
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 EXPORT_SYMBOL(ioc_list);
 EXPORT_SYMBOL(mpt_proc_root_dir);
 EXPORT_SYMBOL(DmpService);
@@ -6047,6 +6064,7 @@
 #endif
 }
 
+EXPORT_SYMBOL_GPL(mpt_poll_interrupt);
 
 module_init(fusion_init);
 module_exit(fusion_exit);
drivers/message/fusion/mptbase.h +24 -0
diff -Nur linux-2.6.9.org/drivers/message/fusion/mptbase.h linux-2.6.9/drivers/message/fusion/mptbase.h
@@ -1113,6 +1113,7 @@
 extern void	 mpt_free_fw_memory(MPT_ADAPTER *ioc);
 extern int	 mpt_findImVolumes(MPT_ADAPTER *ioc);
 extern int	 mpt_read_ioc_pg_3(MPT_ADAPTER *ioc);
+extern void	 mpt_poll_interrupt(MPT_ADAPTER *ioc);
 
 /*
  *  Public data decl's...
@@ -1124,6 +1125,29 @@
 extern int		  mpt_lan_index;	/* needed by mptlan.c */
 extern int		  mpt_stm_index;	/* needed by mptstm.c */
 
+/*
+ *  Dump stuff...
+ */
+#include <linux/diskdump.h>
+
+#define MPT_HOST_LOCK(host_lock)		\
+	if (crashdump_mode()) 			\
+		spin_lock(host_lock);		\
+	else					\
+		spin_lock_irq(host_lock);
+
+#define MPT_HOST_UNLOCK(host_lock)		\
+	if (crashdump_mode())			\
+		spin_unlock(host_lock);		\
+	else					\
+		spin_unlock_irq(host_lock);
+
+#define MPT_MDELAY(n)				\
+	if (crashdump_mode())			\
+		diskdump_mdelay(n);		\
+	else					\
+		mdelay(n);
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 #endif		/* } __KERNEL__ */
 
drivers/message/fusion/mptscsih.c +50 -2

82 lines not on this page · raw message

#9 lore raw

PATCH 6/7 Diskdump 1.0 Release

In reply to Takao Indoh

This is a patch for sym53c8xx driver.

drivers/scsi/sym53c8xx_2/sym_glue.c +26 -0
diff -Nur linux-2.6.9.org/drivers/scsi/sym53c8xx_2/sym_glue.c linux-2.6.9/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -956,6 +956,28 @@
 	return sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd);
 }
 
+#if defined(CONFIG_SCSI_DUMP) || defined(CONFIG_SCSI_DUMP_MODULE)
+static int sym53c8xx_sanity_check_handler(struct scsi_device *sd)
+{
+	struct sym_hcb *np = ((struct host_data *)sd->host->hostdata)->ncb;
+
+	if (np == NULL)
+		return -ENXIO;
+
+	del_timer(&np->s.timer);
+	add_timer_on(&np->s.timer, smp_processor_id());
+
+	return 0;
+}
+
+static void sym53c8xx_poll_handler(struct scsi_device *sd)
+{
+	struct sym_hcb *np = ((struct host_data *)sd->host->hostdata)->ncb;
+
+	sym_interrupt(np);
+}
+#endif
+
 /*
  *  Tune device queuing depth, according to various limits.
  */
@@ -2231,6 +2253,10 @@
 	.eh_device_reset_handler = sym53c8xx_eh_device_reset_handler,
 	.eh_bus_reset_handler	= sym53c8xx_eh_bus_reset_handler,
 	.eh_host_reset_handler	= sym53c8xx_eh_host_reset_handler,
+#if defined(CONFIG_SCSI_DUMP) || defined(CONFIG_SCSI_DUMP_MODULE)
+	.dump_sanity_check	= sym53c8xx_sanity_check_handler,
+	.dump_poll		= sym53c8xx_poll_handler,
+#endif
 	.this_id		= 7,
 	.use_clustering		= DISABLE_CLUSTERING,
 #ifdef SYM_LINUX_PROC_INFO_SUPPORT
#10 lore raw

PATCH 7/7 Diskdump 1.0 Release

In reply to Takao Indoh

This is a patch for IBM Power Linux RAID driver.

drivers/scsi/ipr.c +85 -2
diff -Nur linux-2.6.9.org/drivers/scsi/ipr.c linux-2.6.9/drivers/scsi/ipr.c
@@ -71,6 +71,7 @@
 #include <linux/firmware.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/diskdump.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/processor.h>
@@ -1264,7 +1265,13 @@
 		ipr_initiate_ioa_reset(ioa_cfg, shutdown_type);
 
 	spin_unlock_irq(ioa_cfg->host->host_lock);
-	wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
+	if (crashdump_mode()) {
+		while (ioa_cfg->in_reset_reload) {
+			diskdump_update();
+			diskdump_mdelay(1);
+		}
+	} else
+		wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
 	spin_lock_irq(ioa_cfg->host->host_lock);
 
 	/* If we got hit with a host reset while we were already resetting
@@ -3288,6 +3295,80 @@
 }
 
 /**
+ * ipr_poll - Check for command completion
+ * @sdev:	the SCSI device to which the command was queued
+ *
+ * This function is called after the diskdump subsystem has queued an
+ * I/O command to the indicated device.  Since interrupts are disabled,
+ * this function is called periodically to detect command completion.
+ * To report completion, ipr_cmd->done() sets a value that our caller
+ * can monitor.
+ **/
+static void ipr_poll(struct scsi_device *sdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg =
+		(struct ipr_ioa_cfg *) sdev->host->hostdata;
+	u16 cmd_index;
+	struct ipr_cmnd *ipr_cmd;
+	unsigned long lock_flags = 0;
+
+	spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
+
+	while ((be32_to_cpu(*ioa_cfg->hrrq_curr) & IPR_HRRQ_TOGGLE_BIT) ==
+	       ioa_cfg->toggle_bit) {
+		cmd_index = (be32_to_cpu(*ioa_cfg->hrrq_curr) &
+			IPR_HRRQ_REQ_RESP_HANDLE_MASK) >> IPR_HRRQ_REQ_RESP_HANDLE_SHIFT;
+
+		if (unlikely(cmd_index >= IPR_NUM_CMD_BLKS)) {
+			/* FIXME: Need to abort the diskdump. */
+			panic("Command index %u out of range in %s\n",
+				cmd_index, __FUNCTION__);
+			/*NOTREACHED*/
+		}
+
+		ipr_cmd = ioa_cfg->ipr_cmnd_list[cmd_index];
+		list_del(&ipr_cmd->queue);
+		del_timer(&ipr_cmd->timer);
+		ipr_cmd->done(ipr_cmd);
+
+		if (ioa_cfg->hrrq_curr < ioa_cfg->hrrq_end) {
+			ioa_cfg->hrrq_curr++;
+		} else {
+			ioa_cfg->hrrq_curr = ioa_cfg->hrrq_start;
+			ioa_cfg->toggle_bit ^= 1u;
+		}
+	}
+	spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
+}
+
+/**
+ * ipr_sanity_check - Verify that SCSI device can receive dump
+ * @sdev:	the SCSI device
+ *
+ * Called by mid-layer diskdump sanity-check function to determine
+ * whether the indicated device is operational.  Caller has already
+ * verified that scsi_device_online(device) is true.
+ *
+ * Return value:
+ *	0 for a good device, < 0 for a bad one
+ */
+static int ipr_sanity_check(struct scsi_device *sdev)
+{
+	struct ipr_ioa_cfg *ioa_cfg;
+	if (!sdev->host) {
+		return -ENXIO;
+	}
+	ioa_cfg = (struct ipr_ioa_cfg *) sdev->host->hostdata;
+	if (!ioa_cfg) {
+		return -ENXIO;
+	}
+	if (ioa_cfg->ioa_is_dead) {
+		return -EIO;
+	}
+	return 0;
+}
+
+/**
  * ipr_build_ioadl - Build a scatter/gather list and map the buffer
  * @ioa_cfg:	ioa config struct
  * @ipr_cmd:	ipr command struct
@@ -3967,7 +4048,9 @@
 	.use_clustering = ENABLE_CLUSTERING,
 	.shost_attrs = ipr_ioa_attrs,
 	.sdev_attrs = ipr_dev_attrs,
-	.proc_name = IPR_NAME
+	.proc_name = IPR_NAME,
+	.dump_sanity_check = ipr_sanity_check,
+	.dump_poll = ipr_poll
 };
 
 #ifdef CONFIG_PPC_PSERIES
#11 lore raw
In reply to Takao Indoh
Quoted 6 lines · Takao Indoh

Hi, all!
I release diskdump 1.0 for kernel 2.6.9. It can be downloaded from the following site. Please feel free to use it!
http://sourceforge.net/projects/lkdump

Diskdump project is a joint development of RedHat and Fujitsu, and I'd

I think the company name is spelled Red Hat ;)

Quoted 2 lines

like to express my gratitude to a RedHat developers for many comments and advices.

Can you explain to me why anyone would want to use this invasive patch (it requires all drivers to change) instead of the kexec-dump approach? The kexec-dump approach appears on first sight to be far cleaner and far more powerful, so there must be a reason this work was done regardless of that.. I'm curious what those reasons are, eg what's the advantage ???

#12 lore raw
Quoted 9 lines · Arjan van de Ven
Quoted 6 lines · Takao Indoh

Hi, all!
I release diskdump 1.0 for kernel 2.6.9. It can be downloaded from the following site. Please feel free to use it!
http://sourceforge.net/projects/lkdump

Diskdump project is a joint development of RedHat and Fujitsu, and I'd

I think the company name is spelled Red Hat ;)

Sorry.

Quoted 10 lines
Quoted 2 lines

like to express my gratitude to a RedHat developers for many comments and advices.

Can you explain to me why anyone would want to use this invasive patch (it requires all drivers to change) instead of the kexec-dump approach? The kexec-dump approach appears on first sight to be far cleaner and far more powerful,
so there must be a reason this work was done regardless of that.. I'm curious
what those reasons are, eg what's the advantage ???

The problem of kexec-dump is that initialization of devices depends on the quality of device driver when kexec reboots system. Sometimes the device drivers tacitly rely on the firmware to initialize them.

Anyway, most important point is that kexec-dump is not available enough now. I think kexec-dump is not stable yet. I heard that kexec-dump of some architecture (ex. ia64) had some problems and not worked.

Best Regards,
Takao Indoh

#13 lore raw
Quoted 3 lines · Takao Indoh

The problem of kexec-dump is that initialization of devices depends on the quality of device driver when kexec reboots system. Sometimes the device drivers tacitly rely on the firmware to initialize them.

thankfully linux has very very few of those nowadays...

Quoted 3 lines

Anyway, most important point is that kexec-dump is not available enough now.

How is that ?

Quoted 2 lines

I think kexec-dump is not stable yet.

Do you have any facts to back this up? Is your project more stable ? What is the success rate of dumps of diskdump ? How does that compare to kexec-dump under the same circumstances ?

Quoted 2 lines

I heard that kexec-dump of
some architecture (ex. ia64) had some problems and not worked.

wouldn't it be better to then help finish that rather than making an alternative ?

#14 lore raw
Quoted 6 lines · Arjan van de Ven
Quoted 2 lines

I think kexec-dump is not stable yet.

Do you have any facts to back this up? Is your project more stable ? What is the success rate of dumps of diskdump ? How does that compare to kexec-dump under the same circumstances ?

Sorry, a word "stable" was not appropriate. I meant that kexec-dump was under development yet. kexec-dump works well on i386/x86_64, but it is in the development stage on other architectures.

Quoted 5 lines
Quoted 2 lines

I heard that kexec-dump of
some architecture (ex. ia64) had some problems and not worked.

wouldn't it be better to then help finish that rather than making an alternative ?

It is, if diskdump project just started now. But the basic code of diskdump is almost completed. I think it is more efficient to enhance quality of diskdump than help kexec-dump.

Best Regards,
Takao Indoh

#15 lore raw
Quoted 11 lines · Takao Indoh
Quoted 6 lines · Arjan van de Ven
Quoted 2 lines

I think kexec-dump is not stable yet.

Do you have any facts to back this up? Is your project more stable ? What is the success rate of dumps of diskdump ? How does that compare to kexec-dump under the same circumstances ?

Sorry, a word "stable" was not appropriate. I meant that kexec-dump was under development yet.

well diskdump seems to be quite under development as well; only a subset of drivers is supported and your latest release just added initial support for several architectures.

Quoted 2 lines

kexec-dump works well on i386/x86_64, but it is
in the development stage on other architectures.

not too different from diskdump then...

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

I heard that kexec-dump of
some architecture (ex. ia64) had some problems and not worked.

wouldn't it be better to then help finish that rather than making an alternative ?

It is, if diskdump project just started now. But the basic code of diskdump is almost completed. I think it is more efficient to enhance quality of diskdump than help kexec-dump.

You are obviously free to spend your time wherever you want to, even though I do not agree with your reasoning.