From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tb33N-00058w-79 for qemu-devel@nongnu.org; Wed, 21 Nov 2012 00:40:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tb33L-0006Ms-TG for qemu-devel@nongnu.org; Wed, 21 Nov 2012 00:40:53 -0500 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:37433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tb33L-0006Mk-9b for qemu-devel@nongnu.org; Wed, 21 Nov 2012 00:40:51 -0500 Date: Wed, 21 Nov 2012 16:42:35 +1100 From: David Gibson Message-ID: <20121121054235.GU18362@truffula.fritz.box> References: <1353473965-30678-1-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1353473965-30678-1-git-send-email-david@gibson.dropbear.id.au> Subject: Re: [Qemu-devel] [PATCH] migration: Fix madvise breakage if host and guest have different page sizes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, quintela@redhat.com Cc: aik@ozlabs.ru On Wed, Nov 21, 2012 at 03:59:25PM +1100, David Gibson wrote: > madvise(DONTNEED) will throw away the contents of the whole page at the > given address, even if the given length is less than the page size. One > can argue about whether that's the correct behaviour, but that's what it's > done for a long time in Linux at least. > > That means that the madvise() in ram_load(), on a setup where > TARGET_PAGE_SIZE is smaller than the host page size, can throw away data > in guest pages adjacent to the one it's actually processing right now, > leading to guest memory corruption on an incoming migration. > > This patch therefore, disables the madvise() if the host page size is > larger than TARGET_PAGE_SIZE. This means we don't get the benefits of that > madvise() in this case, but a more complete fix is more difficult to > accomplish. This at least fixes the guest memory corruption. > > Signed-off-by: David Gibson Sorry, forgot to add: Reported-by: Alexey Kardashevskiy -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson