From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H7h5f-0007mI-JD for qemu-devel@nongnu.org; Thu, 18 Jan 2007 18:54:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H7h5e-0007lt-69 for qemu-devel@nongnu.org; Thu, 18 Jan 2007 18:54:42 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7h5e-0007lq-3s for qemu-devel@nongnu.org; Thu, 18 Jan 2007 18:54:42 -0500 Received: from [128.83.139.10] (helo=mail.cs.utexas.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H7h5d-0006Fc-KA for qemu-devel@nongnu.org; Thu, 18 Jan 2007 18:54:41 -0500 Received: from [192.168.1.104] (cpe-70-112-17-156.austin.res.rr.com [70.112.17.156]) (authenticated bits=0) by mail.cs.utexas.edu (8.13.8/8.13.8) with ESMTP id l0INscSx008384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 18 Jan 2007 17:54:40 -0600 (CST) Message-ID: <45B008B5.9070907@cs.utexas.edu> Date: Thu, 18 Jan 2007 17:54:29 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Tracking memory dirtying in QEMU References: <45AECBF9.1090209@cs.utexas.edu> <45AFC4FB.80504@bellard.org> In-Reply-To: <45AFC4FB.80504@bellard.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Fabrice Bellard wrote: > Anthony Liguori wrote: >> Howdy, >> >> I've been working on migration for QEMU and have run into a snag. >> I've got a non-live migration patch that works quite happily[1]. I >> modified the save/restore code to not seek at all, and then basically >> pipe a save over a pipe to a subprocess (usually, ssh). > > qumranet has written some code to do live migration too. Yes, I looked at their code before starting. They don't currently do live migration (only offline migration which is really just a save/restore over the network). I found their implementation to be a bit overly complicated so I decided to try my own. > IMHO, client/server code should be integrated in QEMU in order to ease > the use of live migration. Agreed. What I'd like to eventually have is a migrate command that took a URL. For instance: (qemu) migrate ssh://woolly (qemu) migrate tcp://woolly:8001 While still maintaining the ability to specific a full ssh command. This is useful if for many things (like changing to location of disks in case you mount an NFS partition in different locations). While I see the value in a TCP transport, I personally want an SSH transport so I don't to bother setting up a server. The current code is just something that works. >> Can anyone provide me with some advice on how to do this? Am I right >> in assuming that all IO will go through some function? > > RAM access is not handled via I/O for efficiency, but the > phys_ram_dirty flags are always up to date. In order to use it, you > must allocate one bit in the dirty flags not used by QEMU and kqemu. > Then you can use: > > cpu_physical_memory_reset_dirty() to mark a page as not dirty and > cpu_physical_memory_get_dirty() to test for dirtiness. I didn't realize that you could reset an individual bit and it would be updated appropriately--but it definitely works. This simplifies things a lot. Thanks! > Note that for performance reasons the dirty bits are not handled while > QEMU modifies the A and D bits in the PTEs and it can be a problem for > your application. Right, I saw that. For now, I've modified the stl_phys_notdirty() function to update the dirty bitmap iff there is an active migration going on. I can wrap this check in an unexpected() so there should be very little performance impact. I've noticed that while this works fine for QEMU and user KQEMU, it doesn't work with kernel KQEMU. I suspect this is because kernel KQEMU is updating A/D bits without updating the dirty bitmap. Hopefully you could fix that once we get migration working. > FYI, the dirty bits are currently used in QEMU to optimize VGA > refreshs and to track self modifying code. They are also used > internally by kqemu. Does KQEMU use bits other than 1,2 (VGA_DIRTY_FLAG, CODE_DIRTY_FLAG)? I've added a MIGRATION_DIRTY_FLAG as bit 3 and there doesn't seem to be a conflict. Thanks again Fabrice, Anthony Liguori > Regards, > > Fabrice. > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel