From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=43082 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PznfU-0008N1-M3 for qemu-devel@nongnu.org; Wed, 16 Mar 2011 06:09:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PznfT-00047s-A2 for qemu-devel@nongnu.org; Wed, 16 Mar 2011 06:09:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PznfT-00047l-1p for qemu-devel@nongnu.org; Wed, 16 Mar 2011 06:09:27 -0400 Date: Wed, 16 Mar 2011 12:09:10 +0200 From: "Michael S. Tsirkin" Message-ID: <20110316100909.GA12895@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [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: qemu-devel@nongnu.org, Anthony Liguori , jmforbes@linuxtx.org, Juan Quintela , Alex Williamson , Jason Wang 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; -- 1.7.3.2.91.g446ac