From owner-freebsd-hackers Fri Jun 30 9:30: 8 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from eclogite.eps.nagoya-u.ac.jp (eclogite.eps.nagoya-u.ac.jp [133.6.124.145]) by hub.freebsd.org (Postfix) with ESMTP id B7DF737B618 for ; Fri, 30 Jun 2000 09:29:43 -0700 (PDT) (envelope-from kato@ganko.eps.nagoya-u.ac.jp) Received: from localhost (gneiss.eps.nagoya-u.ac.jp [133.6.124.148]) by eclogite.eps.nagoya-u.ac.jp (8.9.3/3.7W) with ESMTP id BAA21764 for ; Sat, 1 Jul 2000 01:29:41 +0900 (JST) To: hackers@FreeBSD.ORG Subject: invlpg produces strange sig11 on PentiumPro box From: KATO Takenori X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA) X-PGP-Fingerprint: 03 72 85 36 62 46 23 03 52 B1 10 22 44 10 0D 9E Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20000701012941S.kato@gneiss.eps.nagoya-u.ac.jp> Date: Sat, 01 Jul 2000 01:29:41 +0900 X-Dispatcher: imput version 20000228(IM140) Lines: 170 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG The invlpg instruction causes strange signal 11 problem on some PentiumPro box. This problem seems to hapen when (1) mother board is very old and (2) BIOS update is not available and (3) cpuid < 0x619. Following patch automatically disables invlpg when PentiumPro with cpuid < 0x619 is found. Please comment to this patch. ---------- BEGIN ---------- *** sys/i386/isa/initcpu.c.ORIG Sat Jul 1 01:03:40 2000 --- sys/i386/isa/initcpu.c Sat Jul 1 01:06:28 2000 *************** *** 46,51 **** --- 46,55 ---- void enable_K6_2_wt_alloc(void); #endif + #ifdef I686_CPU + extern int invlpgbug; + #endif + #ifdef I486_CPU static void init_5x86(void); static void init_bluelightning(void); *************** *** 449,454 **** --- 453,462 ---- apicbase = rdmsr(0x1b); apicbase &= ~0x800LL; wrmsr(0x1b, apicbase); + #endif + #ifndef CPU_DONT_DISABLE_INVLPG + if (cpu_id < 0x619) + invlpgbug = 1; #endif } *** sys/i386/isa/pmap.c.ORIG Sat Jul 1 01:06:46 2000 --- sys/i386/isa/pmap.c Sat Jul 1 01:13:37 2000 *************** *** 171,176 **** --- 171,181 ---- static struct pv_entry *pvinit; /* + * When invlpgbug = 1, we don't use invlpg instruction. + */ + int invlpgbug; + + /* * All those kernel PT submaps that BSD is so fond of */ pt_entry_t *CMAP1 = 0; *************** *** 358,364 **** pgeflag = 0; #if !defined(SMP) ! if (cpu_feature & CPUID_PGE) { pgeflag = PG_G; } #endif --- 363,369 ---- pgeflag = 0; #if !defined(SMP) ! if (cpu_feature & CPUID_PGE && !invlpg) { pgeflag = PG_G; } #endif *************** *** 581,587 **** } else #endif { ! invlpg(va); } } --- 586,595 ---- } else #endif { ! if (invlpgbug) ! invltlb(); ! else ! invlpg(va); } } *************** *** 884,890 **** */ *(ptek + i) = VM_PAGE_TO_PHYS(m) | PG_RW | PG_V | pgeflag; if (oldpte) { ! if ((oldpte & PG_G) || (cpu_class > CPUCLASS_386)) { invlpg((vm_offset_t) up + i * PAGE_SIZE); } else { updateneeded = 1; --- 892,899 ---- */ *(ptek + i) = VM_PAGE_TO_PHYS(m) | PG_RW | PG_V | pgeflag; if (oldpte) { ! if (((oldpte & PG_G) || (cpu_class > CPUCLASS_386)) && ! !invlpgbug) { invlpg((vm_offset_t) up + i * PAGE_SIZE); } else { updateneeded = 1; *************** *** 925,931 **** oldpte = *(ptek + i); *(ptek + i) = 0; ! if ((oldpte & PG_G) || (cpu_class > CPUCLASS_386)) invlpg((vm_offset_t) p->p_addr + i * PAGE_SIZE); vm_page_unwire(m, 0); vm_page_free(m); --- 934,940 ---- oldpte = *(ptek + i); *(ptek + i) = 0; ! if (((oldpte & PG_G) || (cpu_class > CPUCLASS_386)) && !invlpgbug) invlpg((vm_offset_t) p->p_addr + i * PAGE_SIZE); vm_page_unwire(m, 0); vm_page_free(m); *************** *** 933,938 **** --- 942,950 ---- #if defined(I386_CPU) if (cpu_class <= CPUCLASS_386) invltlb(); + #else + if (invlpgbug) + invltlb(); #endif } *************** *** 2785,2792 **** } else #endif { ! invlpg((u_int)CADDR1); ! invlpg((u_int)CADDR2); } bcopy(CADDR1, CADDR2, PAGE_SIZE); --- 2797,2808 ---- } else #endif { ! if (invlpgbug) ! invltlb(); ! else { ! invlpg((u_int)CADDR1); ! invlpg((u_int)CADDR2); ! } } bcopy(CADDR1, CADDR2, PAGE_SIZE); ---------- END ---------- -----------------------------------------------+--------------------------+ KATO Takenori | FreeBSD | Dept. Earth Planet. Sci, Nagoya Univ. | The power to serve! | Nagoya, 464-8602, Japan | http://www.FreeBSD.org/ | ++++ FreeBSD(98) 4.0R-Rev. 01 available! |http://www.jp.FreeBSD.org/| ++++ FreeBSD(98) 3.4R-Rev. 01 available! +==========================+ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message