On Fri, Oct 25, 2013 at 12:55:36AM +0100, Paolo Bonzini wrote:
> > + if (hpagesize == (1<<30)) {
> > + unsigned long holesize = 0x100000000ULL - below_4g_mem_size;
> > +
> > + memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g",
> > ram,
> > + 0x100000000ULL,
> > + above_4g_mem_size - holesize);
> > + memory_region_add_subregion(system_memory, 0x100000000ULL,
> > + ram_above_4g);
> > +
> > + ram_above_4g_piecetwo =
> > g_malloc(sizeof(*ram_above_4g_piecetwo));
> > + memory_region_init_alias(ram_above_4g_piecetwo, NULL,
> > + "ram-above-4g-piecetwo", ram,
> > + 0x100000000ULL - holesize, holesize);
> > + memory_region_add_subregion(system_memory,
> > + 0x100000000ULL +
> > + above_4g_mem_size - holesize,
> > + ram_above_4g_piecetwo);
>
> Why break it in two? You can just allocate extra holesize bytes in the
> "ram" MemoryRegion, and not map the part that corresponds to
> [0x100000000ULL - holesize, 0x100000000ULL).
- If the "ram" MemoryRegion is backed with 1GB hugepages, you might not
want to allocate extra holesize bytes (which might require an entire
1GB page).
- 1GB backed RAM can be mapped with 2MB pages.
> Also, as Peter said this cannot depend on host considerations. Just do
> it unconditionally, but only for new machine types (pc-1.8 and q35-1.8,
> since unfortunately we're too close to hard freeze).
Why the description of memory subregions and aliases are part of machine
types?