Resent-Date: Fri, 15 Jan 1999 19:21:20 +0100 (MET)
From: zippel@fh-brandenburg.de (Roman Zippel)
Subject: Re: 2.2.0pre6 small bug
To: MSchmitz@lbl.gov (Michael Schmitz)
Date: Fri, 15 Jan 1999 19:20:52 +0100 (MET)
Cc: jongk@cs.utwente.nl, zippel@fh-brandenburg.de,
        linux-m68k@lists.linux-m68k.org
In-Reply-To: <369EE2EE.7C631F0F@lbl.gov> from "Michael Schmitz" at Jan 14, 99 10:40:46 pm
Resent-From: linux-m68k@phil.uni-sb.de

Hi,

> Tried the same for my 2.2.0pre6 problem (kernel dies on memset(lp, 0,...)
> right after kernel_set_cachemode in mac_sonic_init) and it doesn't help. 

Umm, that can't help there is a bug left in kernel_set_cachemode().
The following patch also reintroduces an extra root table for the swapper
task again, although I can't imagine it's the cause of the problem, but
I can't find anything else and it shouldn't hurt, but I didn't test it yet.

> The panic continues with fun stuff like 'killing interrupt handler'
> repeatedly and logging random garbage to the screen until I'm sick of it and
> reboot. Something's really horribly broken in the MMU code I guess. 

It must be a subtle cache problem and the biggest problem, why doesn't
it crashes on my machine, but on every other???

bye, Roman

--- linux-2.2/arch/m68k/mm/init.c.org	Mon Jan 11 15:19:53 1999
+++ linux-2.2/arch/m68k/mm/init.c	Fri Jan 15 19:13:18 1999
@@ -348,9 +348,16 @@
 	start_mem += PAGE_SIZE;
 	memset((void *)empty_zero_page, 0, PAGE_SIZE);
 
+	/* 
+	 * allocate the "swapper" page directory and
+	 * record in task 0 (swapper) tss 
+	 */
+	init_mm.pgd = (pgd_t *)kernel_ptr_table(&start_mem);
+	memset (init_mm.pgd, 0, sizeof(pgd_t)*PTRS_PER_PGD);
+
 	/* setup CPU root pointer for swapper task */
 	task[0]->tss.crp[0] = 0x80000000 | _PAGE_TABLE;
-	task[0]->tss.crp[1] = virt_to_phys (swapper_pg_dir);
+	task[0]->tss.crp[1] = virt_to_phys(init_mm.pgd);
 
 #ifdef DEBUG
 	printk ("task 0 pagedir at %p virt, %#lx phys\n",
--- linux-2.2/arch/m68k/mm/kmap.c.org	Mon Jan 11 15:19:53 1999
+++ linux-2.2/arch/m68k/mm/kmap.c	Fri Jan 15 18:53:10 1999
@@ -322,7 +322,7 @@
 
 			if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) {
 				pmd_dir->pmd[pmd_off] = (pmd_dir->pmd[pmd_off] &
-							 ~_CACHEMASK040) | cmode;
+							 _CACHEMASK040) | cmode;
 				virtaddr += PTRTREESIZE;
 				size -= PTRTREESIZE;
 				continue;
@@ -336,7 +336,7 @@
 		}
 		pte_dir = pte_offset(pmd_dir, virtaddr);
 
-		pte_val(*pte_dir) = (pte_val(*pte_dir) & ~_CACHEMASK040) | cmode;
+		pte_val(*pte_dir) = (pte_val(*pte_dir) & _CACHEMASK040) | cmode;
 		virtaddr += PAGE_SIZE;
 		size -= PAGE_SIZE;
 	}

