From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51963 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzqNo-0007e8-Ir for qemu-devel@nongnu.org; Wed, 16 Mar 2011 09:03:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzqG8-00089o-Aa for qemu-devel@nongnu.org; Wed, 16 Mar 2011 08:55:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzqG8-00089R-1W for qemu-devel@nongnu.org; Wed, 16 Mar 2011 08:55:28 -0400 From: Juan Quintela In-Reply-To: <20110316100909.GA12895@redhat.com> (Michael S. Tsirkin's message of "Wed, 16 Mar 2011 12:09:10 +0200") References: <20110316100909.GA12895@redhat.com> Date: Wed, 16 Mar 2011 13:53:46 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH master, stable] vhost: fix dirty page handling Reply-To: quintela@redhat.com List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Jason Wang , Alex Williamson , jmforbes@linuxtx.org, qemu-devel@nongnu.org "Michael S. Tsirkin" wrote: > vhost was passing a physical address to cpu_physical_memory_set_dirty, > which is wrong: we need to translate to ram address first. > > Signed-off-by: Michael S. Tsirkin > > Note: this lead to crashes during migration, so the patch > is needed on the stable branch too. Reviewed-by: Juan Quintela We have been having strange migration corruptions for some time, this can explain what was going on. > --- > hw/vhost.c | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > > diff --git a/hw/vhost.c b/hw/vhost.c > index aaa34e4..97a1299 100644 > --- a/hw/vhost.c > +++ b/hw/vhost.c > @@ -49,8 +49,10 @@ static void vhost_dev_sync_region(struct vhost_dev *dev, > log = __sync_fetch_and_and(from, 0); > while ((bit = sizeof(log) > sizeof(int) ? > ffsll(log) : ffs(log))) { > + ram_addr_t ram_addr; > bit -= 1; > - cpu_physical_memory_set_dirty(addr + bit * VHOST_LOG_PAGE); > + ram_addr = cpu_get_physical_page_desc(addr + bit * VHOST_LOG_PAGE); > + cpu_physical_memory_set_dirty(ram_addr); > log &= ~(0x1ull << bit); > } > addr += VHOST_LOG_CHUNK; <#secure method=pgpmime mode=sign>