From owner-freebsd-stable Fri Nov 8 8:32:50 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2C23337B401 for ; Fri, 8 Nov 2002 08:32:48 -0800 (PST) Received: from tasogare.imasy.or.jp (tasogare.imasy.or.jp [202.227.24.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC24D43E42 for ; Fri, 8 Nov 2002 08:32:46 -0800 (PST) (envelope-from iwasaki@jp.FreeBSD.org) Received: from localhost (iwa@tasogare.imasy.or.jp [202.227.24.5]) by tasogare.imasy.or.jp (8.11.6+3.4W/8.11.6/tasogare) with ESMTP/inet id gA8GWZi66490; Sat, 9 Nov 2002 01:32:35 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) Date: Sat, 09 Nov 2002 01:32:30 +0900 (JST) Message-Id: <20021109.013230.98854530.iwasaki@jp.FreeBSD.org> To: gjohnson@srrc.ars.usda.gov Cc: stable@FreeBSD.ORG Subject: Re: machdep.c problem [was Re: SMP broken on PPro] From: Mitsuru IWASAKI In-Reply-To: <20021105202341.GA86211@node1.cluster.srrc.usda.gov> References: <20021105105146.GB57295@HAL9000.homeunix.com> <20021105201738.GA86056@node1.cluster.srrc.usda.gov> <20021105202341.GA86211@node1.cluster.srrc.usda.gov> X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, > > The problem on -STABLE is with /sys/i386/i386/machdep.c, revision > > 1.385.2.26. I am not smart enough to know exactly what is wrong > > with the diff but reverting back to revision 1.385.2.25 of > > /sys/i386/i386/machdep.c fixes the problem. > > > > Apparently, the problem is BIOS specific so that explains why I only > > saw it on one of my machines (the oldest) and not the others. This > > would also explain why other people have not seen the problem. At > > this point I would say that the problem really has nothing to do with > > SMP, it just so happened that I experienced the problem on an SMP > > machine. > > Should I file a PR on this, even though I do not know what the fix is? Now I got spare time for making patches for this :-) Please test the patch, and let me know if any problems or side effects were found. Also suggestions for better solution would be welcome. I'll commit equivalent fix to CURRENT within couple of days, then MFC another couple of days later. Thanks Index: machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.385.2.26 diff -u -r1.385.2.26 machdep.c --- machdep.c 2 Nov 2002 05:07:18 -0000 1.385.2.26 +++ machdep.c 8 Nov 2002 15:30:06 -0000 @@ -1456,6 +1456,7 @@ struct vm86context vmc; vm_offset_t pa, physmap[PHYSMAP_SIZE]; pt_entry_t pte; + unsigned int saved_pte[160]; const char *cp; struct { u_int64_t base; @@ -1468,6 +1469,24 @@ basemem = 0; /* + * Older BIOSes might intend to write to memory below 640kb. + * It is very small region actually, but we cannot determine + * the accurate base memory size here. + * Give enough pages to BIOS temporary during calling + * INT 15:E820 so that BIOS can access them. + */ + for (pa = (4 << PAGE_SHIFT); pa < ISA_HOLE_START; pa += PAGE_SIZE) { + pte = (pt_entry_t)vtopte(pa + KERNBASE); + *pte = pa | PG_RW | PG_V; + } + + pte = (pt_entry_t)vm86paddr; + for (i = 4; i < 160; i++) { + saved_pte[i] = pte[i]; + pte[i] |= PG_V | PG_RW | PG_U; + } + + /* * map page 1 R/W into the kernel page table so we can use it * as a buffer. The kernel will unmap this page later. */ @@ -1537,6 +1556,19 @@ physmap[physmap_idx + 1] = smap->base + smap->length; next_run: } while (vmf.vmf_ebx != 0); + + /* + * Unmap the pages which were given for BIOS. + * Some pages below 640kb will be mapped again if necessary + * after base memory size is determined. + */ + pte = (pt_entry_t)vm86paddr; + for (i = 4; i < 160; i++) + pte[i] = saved_pte[i]; + for (pa = (4 << PAGE_SHIFT); pa < ISA_HOLE_START; pa += PAGE_SIZE) { + pte = (pt_entry_t)vtopte(pa + KERNBASE); + *pte = 0; + } /* * Perform "base memory" related probes & setup To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message