From owner-freebsd-stable Tue Sep 10 0:10:22 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 6B3D537B400 for ; Tue, 10 Sep 2002 00:10:15 -0700 (PDT) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by mx1.FreeBSD.org (Postfix) with SMTP id 73D9343E4A for ; Tue, 10 Sep 2002 00:10:14 -0700 (PDT) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 10 Sep 2002 08:10:13 +0100 (BST) To: Santos Cc: stable Subject: Re: Problem Report kern/28418, problems with X in AMD mobos In-reply-to: Your message of "Tue, 10 Sep 2002 06:46:35 BST." <3D7D873B.7050301@myrealbox.com> X-Request-Do: Date: Tue, 10 Sep 2002 08:10:12 +0100 From: David Malone Message-ID: <200209100810.aa15711@salmon.maths.tcd.ie> 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 > Yes. I removed that "return;" trick, compiled the kernel, it > crashed/freezed when starting X. Commented out the APM_ENABLE="YES" in > /etc/rc.conf (apm was compiled in the kernel, tough), X started fine. > It's related to APM. I only used it so "shutdown -p now" really could > power off the pc :). OK - I think X is changing MTRR values which are being used to control the mapping of APM into memory. [printf patch] > Tried that but didnt't work. But here is the XFree log: It must crash too quickly to see what the values are. Santos has tested the patch below for me, and it seems to fix the problem. (It just refuses to change unknown MTRR values unless you give it a "force" flag). David. Index: sys/sys/memrange.h =================================================================== RCS file: /cvs/FreeBSD-CVS/src/sys/sys/memrange.h,v retrieving revision 1.5 diff -u -r1.5 memrange.h --- sys/sys/memrange.h 14 Apr 2002 20:19:05 -0000 1.5 +++ sys/sys/memrange.h 9 Sep 2002 20:21:19 -0000 @@ -20,6 +20,7 @@ #define MDF_BOGUS (1<<28) /* we don't like it */ #define MDF_FIXACTIVE (1<<29) /* can't be turned off */ #define MDF_BUSY (1<<30) /* range is in use */ +#define MDF_FORCE (1<<31) /* force risky changes */ struct mem_range_desc { Index: sys/i386/i386/k6_mem.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/sys/i386/i386/k6_mem.c,v retrieving revision 1.8 diff -u -r1.8 k6_mem.c --- sys/i386/i386/k6_mem.c 8 Dec 2000 21:50:08 -0000 1.8 +++ sys/i386/i386/k6_mem.c 2 Sep 2002 10:35:20 -0000 @@ -79,7 +79,7 @@ return EINVAL; if (desc->mr_len < 131072 || !powerof2(desc->mr_len)) return EINVAL; - if (desc->mr_flags &~ (MDF_WRITECOMBINE|MDF_UNCACHEABLE)) + if (desc->mr_flags &~ (MDF_WRITECOMBINE|MDF_UNCACHEABLE|MDF_FORCE)) return EOPNOTSUPP; for (bit = ffs(desc->mr_len >> 17) - 1; bit < 15; bit++) Index: sys/i386/i386/i686_mem.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/sys/i386/i386/i686_mem.c,v retrieving revision 1.14 diff -u -r1.14 i686_mem.c --- sys/i386/i386/i686_mem.c 14 Apr 2002 20:13:08 -0000 1.14 +++ sys/i386/i386/i686_mem.c 9 Sep 2002 20:22:33 -0000 @@ -392,6 +398,13 @@ ((last_md = i686_mtrrfixsearch(sc, mrd->mr_base + mrd->mr_len - 1)) == NULL)) return(EINVAL); + /* check we aren't doing something risky */ + if (!(mrd->mr_flags & MDF_FORCE)) + for (curr_md = first_md; curr_md <= last_md; curr_md++) { + if ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN) + return (EACCES); + } + /* set flags, clear set-by-firmware flag */ for (curr_md = first_md; curr_md <= last_md; curr_md++) { curr_md->mr_flags = mrcopyflags(curr_md->mr_flags & ~MDF_FIRMWARE, mrd->mr_flags); @@ -431,6 +444,10 @@ /* whoops, owned by someone */ if (curr_md->mr_flags & MDF_BUSY) return(EBUSY); + /* check we aren't doing something risky */ + if (!(mrd->mr_flags & MDF_FORCE) && + ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN)) + return (EACCES); /* Ok, just hijack this entry */ free_md = curr_md; break; Index: usr.sbin/memcontrol/memcontrol.8 =================================================================== RCS file: /cvs/FreeBSD-CVS/src/usr.sbin/memcontrol/memcontrol.8,v retrieving revision 1.8 diff -u -r1.8 memcontrol.8 --- usr.sbin/memcontrol/memcontrol.8 14 Jul 2002 14:44:12 -0000 1.8 +++ usr.sbin/memcontrol/memcontrol.8 9 Sep 2002 20:31:01 -0000 @@ -83,7 +83,8 @@ .It Fl o Ar owner Text identifier for this setting (7 char max) .It Ar attribute -Attributes applied to this range; one of +Attributes applied to this range; combinations of +.Ar force , .Ar uncacheable , .Ar write-combine , .Ar write-through , Index: usr.sbin/memcontrol/memcontrol.c =================================================================== RCS file: /cvs/FreeBSD-CVS/src/usr.sbin/memcontrol/memcontrol.c,v retrieving revision 1.7 diff -u -r1.7 memcontrol.c --- usr.sbin/memcontrol/memcontrol.c 14 Apr 2002 20:19:13 -0000 1.7 +++ usr.sbin/memcontrol/memcontrol.c 9 Sep 2002 20:32:40 -0000 @@ -50,6 +50,7 @@ {"write-through", MDF_WRITETHROUGH, MDF_SETTABLE}, {"write-back", MDF_WRITEBACK, MDF_SETTABLE}, {"write-protect", MDF_WRITEPROTECT, MDF_SETTABLE}, + {"force", MDF_FORCE, MDF_SETTABLE}, {"unknown", MDF_UNKNOWN, 0}, {"fixed-base", MDF_FIXBASE, 0}, {"fixed-length", MDF_FIXLEN, 0}, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message