From owner-p4-projects@FreeBSD.ORG Thu Jul 27 19:14:20 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 35B1A16A4E2; Thu, 27 Jul 2006 19:14:20 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE0E016A4E0 for ; Thu, 27 Jul 2006 19:14:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9FB1C43D5A for ; Thu, 27 Jul 2006 19:14:19 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6RJEJC1012034 for ; Thu, 27 Jul 2006 19:14:19 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6RJEJ1Q012031 for perforce@freebsd.org; Thu, 27 Jul 2006 19:14:19 GMT (envelope-from jhb@freebsd.org) Date: Thu, 27 Jul 2006 19:14:19 GMT Message-Id: <200607271914.k6RJEJ1Q012031@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 102581 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2006 19:14:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=102581 Change 102581 by jhb@jhb_mutex on 2006/07/27 19:13:24 Really fix the hw.physmem stuff. Not only do we have to not change the physmap[], we also have to make sure Maxmem retains the correct value. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#55 edit .. //depot/projects/smpng/sys/i386/i386/machdep.c#111 edit Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#55 (text+ko) ==== @@ -947,6 +947,13 @@ if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) Maxmem = atop(physmem_tunable); + /* + * Don't allow MAXMEM or hw.physmem to extend the amount of memory + * in the system. + */ + if (Maxmem > atop(physmap[physmap_idx + 1])) + Maxmem = atop(physmap[physmap_idx + 1]); + if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); ==== //depot/projects/smpng/sys/i386/i386/machdep.c#111 (text+ko) ==== @@ -1661,6 +1661,7 @@ bzero(&vmf, sizeof(vmf)); bzero(physmap, sizeof(physmap)); basemem = 0; + has_smap = 0; /* * Some newer BIOSes has broken INT 12H implementation which cause @@ -1884,16 +1885,22 @@ if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) Maxmem = atop(physmem_tunable); + /* + * If we have an SMAP, don't allow MAXMEM or hw.physmem to extend + * the amount of memory in the system. + */ + if (has_smap && Maxmem > atop(physmap[physmap_idx + 1])) + Maxmem = atop(physmap[physmap_idx + 1]); + if (atop(physmap[physmap_idx + 1]) != Maxmem && (boothowto & RB_VERBOSE)) printf("Physical memory use set to %ldK\n", Maxmem * 4); /* - * If Maxmem has been increased beyond what the system has detected - * and we didn't get the memory layout via SMAP, extend the last - * memory segment to the new limit. + * If Maxmem has been increased beyond what the system has detected, + * extend the last memory segment to the new limit. */ - if (!has_smap && atop(physmap[physmap_idx + 1]) < Maxmem) + if (atop(physmap[physmap_idx + 1]) < Maxmem) physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem); /* call pmap initialization to make new kernel address space */