Received: from [140.186.70.92] (port=49948 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzrXI-0005VX-Os for qemu-devel@nongnu.org; Wed, 16 Mar 2011 10:17:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzrXC-00034l-9G for qemu-devel@nongnu.org; Wed, 16 Mar 2011 10:17:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20650) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzrXB-00034c-WF for qemu-devel@nongnu.org; Wed, 16 Mar 2011 10:17:10 -0400 From: Alex Williamson In-Reply-To: <20110316100909.GA12895@redhat.com> References: <20110316100909.GA12895@redhat.com> Content-Type: text/plain; charset="UTF-8" Date: Wed, 16 Mar 2011 08:17:05 -0600 Message-ID: <1300285026.3141.85.camel@x201> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH master, stable] vhost: fix dirty page handling List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Jason Wang , jmforbes@linuxtx.org, qemu-devel@nongnu.org, Juan Quintela On Wed, 2011-03-16 at 12:09 +0200, 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. > > --- > 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; Reviewed-by: Alex Williamson