Date: Thu, 27 Jul 2006 19:14:19 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 102581 for review Message-ID: <200607271914.k6RJEJ1Q012031@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607271914.k6RJEJ1Q012031>