From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44141 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OP6Yd-0000Jb-1K for qemu-devel@nongnu.org; Thu, 17 Jun 2010 00:18:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OP6YZ-0002Ne-0J for qemu-devel@nongnu.org; Thu, 17 Jun 2010 00:18:26 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:57425) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OP6YY-0002NX-TM for qemu-devel@nongnu.org; Thu, 17 Jun 2010 00:18:22 -0400 Received: by gyd5 with SMTP id 5so4811247gyd.4 for ; Wed, 16 Jun 2010 21:18:21 -0700 (PDT) MIME-Version: 1.0 Sender: camm@ualberta.ca In-Reply-To: <4C18C4B8.6060305@codemonkey.ws> References: <4C16558A.5010005@codemonkey.ws> <1276618603-24184-1-git-send-email-cam@cs.ualberta.ca> <4C17AB1C.7010701@codemonkey.ws> <4C17FFAE.5010000@codemonkey.ws> <4C18C4B8.6060305@codemonkey.ws> Date: Wed, 16 Jun 2010 22:18:21 -0600 Message-ID: Subject: Re: [Qemu-devel] Re: [PATCH RFC] Mark a device as non-migratable From: Cam Macdonell Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On Wed, Jun 16, 2010 at 6:34 AM, Anthony Liguori wr= ote: > On 06/16/2010 12:05 AM, Cam Macdonell wrote: >> >> On Tue, Jun 15, 2010 at 4:33 PM, Anthony Liguori >> =A0wrote: >> >>> >>> On 06/15/2010 05:26 PM, Cam Macdonell wrote: >>> >>>> >>>> On Tue, Jun 15, 2010 at 10:32 AM, Anthony Liguori >>>> =A0wrote: >>>> >>>> >>>>> >>>>> On 06/15/2010 11:16 AM, Cam Macdonell wrote: >>>>> >>>>> >>>>>> >>>>>> How does this look for marking the device as non-migratable? =A0It a= dds >>>>>> a >>>>>> field >>>>>> 'no_migrate' to the SaveStateEntry and tests for it in vmstate_save. >>>>>> =A0This >>>>>> would >>>>>> replace anything that touches memory. >>>>>> >>>>>> Cam >>>>>> >>>>>> --- >>>>>> =A0hw/hw.h =A0| =A0 =A01 + >>>>>> =A0savevm.c | =A0 32 +++++++++++++++++++++++++++++--- >>>>>> =A02 files changed, 30 insertions(+), 3 deletions(-) >>>>>> >>>>>> diff --git a/hw/hw.h b/hw/hw.h >>>>>> index d78d814..7c93f08 100644 >>>>>> --- a/hw/hw.h >>>>>> +++ b/hw/hw.h >>>>>> @@ -263,6 +263,7 @@ int register_savevm_live(const char *idstr, >>>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 void *opaque); >>>>>> >>>>>> =A0void unregister_savevm(const char *idstr, void *opaque); >>>>>> +void mark_no_migrate(const char *idstr, void *opaque); >>>>>> >>>>>> >>>>>> >>>>> >>>>> I'm not thrilled with the name but the functionality is spot on. =A0I >>>>> lack >>>>> the >>>>> creativity to offer a better name suggestion :-) >>>>> >>>>> Regards, >>>>> >>>>> Anthony Liguori >>>>> >>>>> >>>> >>>> Hmmm, in working on this it seems that the memory (from >>>> qemu_ram_map()) is still attached even when the device is removed >>>> (which causes migration to fail because there is an unexpected >>>> memory). >>>> >>>> Is something like cpu_unregister_physical_memory()/qemu_ram_free() >>>> needed? >>>> >>>> >>> >>> Yes. =A0You need to unregister any memory that you have registered upon >>> device >>> removal. >>> >> >> Is there an established way to achieve this? =A0I can't seem find >> another device that unregisters memory registered with >> cpu_register_physical_memory(). =A0Is something like >> cpu_unregister_physical_memory() needed? >> > > cpu_register_physical_memory(IO_MEM_UNASSIGNED). > > If you look at pci.c, you'll see that it automatically unregisters any > mapped io regions on remove. > It appears that the 'peer' migration won't work until memory hotplug is supported, correct? AFAICT the memory sizes will not match between the source and destination VMs after the device is removed and the memory system currently doesn't support gaps. A technique similar to my patch for non-migratable memory would be needed to mark free'd memory pages without Alex's patches in. For the purposes of my patch, can it be merged without the 'peer' case (pending Alex's patches and hotplug)? Thanks, Cam