Received: from eggs.gnu.org ([2001:4830:134:3::10]:51895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTSyM-00030M-HY for qemu-devel@nongnu.org; Fri, 07 Jul 2017 09:07:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTSyL-00010E-Gu for qemu-devel@nongnu.org; Fri, 07 Jul 2017 09:07:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dTSyL-0000zv-An for qemu-devel@nongnu.org; Fri, 07 Jul 2017 09:07:01 -0400 Date: Fri, 7 Jul 2017 15:06:54 +0200 From: Igor Mammedov Message-ID: <20170707150654.6c0aca0d@nial.brq.redhat.com> In-Reply-To: References: <1499187763-8211-1-git-send-email-peter.maydell@linaro.org> <3c48839d-063b-36f6-1620-16042a1b451d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/3] Add new utility function memory_region_allocate_aux_memory() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , Marcel Apfelbaum , QEMU Developers , Eduardo Habkost , "patches@linaro.org" On Thu, 6 Jul 2017 15:52:44 +0100 Peter Maydell wrote: > On 5 July 2017 at 13:21, Paolo Bonzini wrote: > > > > > > On 04/07/2017 19:02, Peter Maydell wrote: > >> Many board models and several devices need to create auxiliary > >> regions of RAM (in addition to the main lump of 'system' memory), > >> to model static RAMs, video memory, ROMs, etc. Currently they do > >> this with a sequence like: > >> memory_region_init_ram(sram, NULL, "sram", 0x10000, &error_fatal); > >> vmstate_register_ram_global(sram); > > > > Instead of vmstate_register_ram_global, you should use > > > > vmstate_register_ram(mr, owner); > > > > You should even do it for all memory regions, probably. > > This sounds like a good thing, but it's awkward for migration > compatibility, because these callers to memory_region_init_ram() > don't call vmstate_register_ram(): > > hw/arm/highbank.c (a bug) > hw/mips/mips_malta.c (region is ro) > hw/net/dp3893x.c (prom, ro, contains mac address) > hw/pci-host/xilinx-pcie.c (dummy region; migrating wouldn't hurt) > backends/hostmem-ram.c (bug, or is migration handled elsewhere?) > > and if we add an implicit call then we break migration compat > for those boards/devices. > > > Only memory_region_init_ram_device_ptr (which sets mr->ram_device) must > > not call vmstate_register_ram. This is a bit ugly because it requires > > inlining memory_region_init_ram_ptr into it. > > > > memory_region_init_ram_from_fd probably needs to be excluded, as well, > > based on its sole user. > > Callers of memory_region_init_ram_from_file() which don't > call vmstate_register_ram(): > backends/hostmem-ram.c if backend is used by pc-dimm, then it's pc-dimm job to (un)register vmstate: pc_dimm_memory_plug()->vmstate_register_ram(vmstate_mr, dev); > Callers of memory_region_init_ram_ptr() which don't call > vmstate_register_ram(): > hw/misc/mmio_interface.c > -- seems to be an implementation detail of the exceute-from-device > support so maybe it doesn't need migration support ?? > > thanks > -- PMM >