From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZvkDc-0001sA-IN for qemu-devel@nongnu.org; Mon, 09 Nov 2015 06:02:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZvkDb-0002aw-Jb for qemu-devel@nongnu.org; Mon, 09 Nov 2015 06:02:36 -0500 References: <1446747358-18214-1-git-send-email-peter.maydell@linaro.org> <1446747358-18214-12-git-send-email-peter.maydell@linaro.org> <56407BA1.3070304@redhat.com> From: Paolo Bonzini Message-ID: <56407D3C.9030501@redhat.com> Date: Mon, 9 Nov 2015 12:02:20 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 11/16] memory: Add address_space_init_shareable() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Patch Tracking , QEMU Developers , qemu-arm@nongnu.org, "Edgar E. Iglesias" , =?UTF-8?Q?Alex_Benn=c3=a9e?= , =?UTF-8?Q?Andreas_F=c3=a4rber?= On 09/11/2015 11:59, Peter Maydell wrote: >>> >> + as = g_malloc0(sizeof *as); >>> >> + address_space_init(as, root, name); >>> >> + as->malloced = true; >>> >> + return as; >>> >> } >> > >> > You shouldn't return a non-shareable address space here, I think, >> > because it might be contained into another object and that object might >> > disappear. I haven't thought this through very much, but adding an " && >> > as->malloced" to the conditional seems easy and safe. > That would prevent sharing the system address space, which is one > you really commonly want to share. I guess we could make that one > be alloced-shareable. You would only allocate one duplicate of the system address space though. The second call to address_space_init_shareable would not create a new AS. Paolo