Increasing KVM on amd64

Tz-Huan Huang tzhuan at csie.org
Sun Jun 8 04:59:25 UTC 2008


On Sun, Jun 8, 2008 at 7:59 AM, Alan Cox <alc at cs.rice.edu> wrote:
> You can download a patch from
> http://www.cs.rice.edu/~alc/amd64_kvm_6GB.patch that increases amd64's
> kernel virtual address space to 6GB.  This patch also increases the default
> for the kmem map to almost 2GB.  I believe that kernel loadable modules
> still work.  However, I suspect that mini-dumps are broken.
>
> I don't plan on committing this patch in its current form.  Some of the
> changes are done in a hackish way.  I am, however, curious to hear whether
> or not it works for you.

Thanks for the patch. I applied it on 7-stable but got failed on pmap.c.

Patching file amd64/amd64/pmap.c using Plan A...
Hunk #1 succeeded at 429 (offset -12 lines).
Hunk #2 failed at 442.
Hunk #3 succeeded at 1505 (offset -168 lines).
Hunk #4 succeeded at 1691 (offset -12 lines).

amd64/amd64/pmap.c.rej:

***************
*** 442,456 ****
  	/* Map from zero to end of allocations under 2M pages */
  	/* This replaces some of the KPTphys entries above */
  	for (i = 0; (i << PDRSHIFT) < *firstaddr; i++) {
- 		((pd_entry_t *)KPDphys)[i] = i << PDRSHIFT;
- 		((pd_entry_t *)KPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G;
  	}

  	/* And connect up the PD to the PDP */
  	for (i = 0; i < NKPDPE; i++) {
- 		((pdp_entry_t *)KPDPphys)[i + KPDPI] = KPDphys +
  		    (i << PAGE_SHIFT);
- 		((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U;
  	}

  	/* Now set up the direct map space using either 2MB or 1GB pages */
--- 442,456 ----
  	/* Map from zero to end of allocations under 2M pages */
  	/* This replaces some of the KPTphys entries above */
  	for (i = 0; (i << PDRSHIFT) < *firstaddr; i++) {
+ 		((pd_entry_t *)KPDphys)[2048 + i] = i << PDRSHIFT;
+ 		((pd_entry_t *)KPDphys)[2048 + i] |= PG_RW | PG_V | PG_PS | PG_G;
  	}

  	/* And connect up the PD to the PDP */
  	for (i = 0; i < NKPDPE; i++) {
+ 		((pdp_entry_t *)KPDPphys)[i + KPDPI - 4] = KPDphys +
  		    (i << PAGE_SHIFT);
+ 		((pdp_entry_t *)KPDPphys)[i + KPDPI - 4] |= PG_RW | PG_V | PG_U;
  	}

  	/* Now set up the direct map space using either 2MB or 1GB pages */


We have no machine running 8-current with more than 6G memory now...

Thanks,
Tz-Huan


More information about the freebsd-hackers mailing list