Subject: RE: custom ide driver causes "Badness in smp_call_function"

From: "Bryan Althouse" <[email-masked]>
Date: Thu, 1 Sep 2005 12:15:31 -0400

Ralf,

I've done more testing with your patch.  When I use it with my non-SMP
kernel, disk access will cause a panic with a cache error message.  Is this
patch only intended for SMP, or is this a legitimate problem?

Bryan

Index: include/asm-mips/mach-generic/ide.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/mach-generic/ide.h,v
retrieving revision 1.9
diff -u -r1.9 ide.h
--- include/asm-mips/mach-generic/ide.h	19 Apr 2005 12:26:59 -0000	1.9
+++ include/asm-mips/mach-generic/ide.h	26 Aug 2005 14:04:38 -0000
@@ -19,6 +19,7 @@
 #include <linux/pci.h>
 #include <linux/stddef.h>
 #include <asm/processor.h>
+#include <asm/cacheflush.h>
 
 #ifndef MAX_HWIFS
 # ifdef CONFIG_BLK_DEV_IDEPCI
@@ -105,12 +106,14 @@
 
 /* MIPS port and memory-mapped I/O string operations.  */
 
-static inline void __ide_flush_dcache_range(unsigned long addr, unsigned
long size)
+static inline void __ide_flush_dcache_range(unsigned long addr,
+	unsigned long size)
 {
-	if (cpu_has_dc_aliases) {
-		unsigned long end = addr + size;
-		for (; addr < end; addr += PAGE_SIZE)
-			flush_dcache_page(virt_to_page(addr));
+	unsigned long end = addr + size;
+
+	while (addr < end) {
+		SetPageDcacheDirty(virt_to_page(addr));
+		addr += PAGE_SIZE;
 	}
 }

---

From: Ralf Baechle DL5RB <[email-masked]>
Date: Thu, 1 Sep 2005 17:52:35 +0100

> patch only intended for SMP, or is this a legitimate problem?

There is a real problem but it only hits on SMP.

(The implementation is a hack though, it makes assumptions about the IDE
code's internal workings)

  Ralf

---

From: Atsushi Nemoto <[email-masked]>
Date: Fri, 02 Sep 2005 21:48:59 +0900 (JST)

>>>>> On Fri, 26 Aug 2005 15:10:47 +0100, Ralf Baechle <[email-masked]> said:
ralf> Try this patch below and let me know.  I would also like to ask
ralf> those people who used to suffer from aliases with IDE PIO to try
ralf> this patch.

I'm using CPU which suffer from dcache aliasing.
I tried this patch for IDE PIO and it seems work fine too.

Maybe Cobalt user can try it.  Anyone?  :-)

---
Atsushi Nemoto