From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZZTn-0004J9-JM for qemu-devel@nongnu.org; Fri, 25 Oct 2013 00:58:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZZTh-0006Lm-Jl for qemu-devel@nongnu.org; Fri, 25 Oct 2013 00:58:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZZTh-0006Lf-C3 for qemu-devel@nongnu.org; Fri, 25 Oct 2013 00:58:29 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9P4wRSf023753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 25 Oct 2013 00:58:27 -0400 Date: Fri, 25 Oct 2013 02:58:05 -0200 From: Marcelo Tosatti Message-ID: <20131025045805.GA18280@amt.cnet> References: <20131024211158.064049176@amt.cnet> <20131024211249.723543071@amt.cnet> <5269B378.6040409@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5269B378.6040409@redhat.com> Subject: Re: [Qemu-devel] [patch 2/2] i386: pc: align gpa<->hpa on 1GB boundary List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aarcange@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com 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?