From patchwork Sun Apr 4 23:26:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Izik Eidus X-Patchwork-Id: 90591 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o34NLktt002351 for ; Sun, 4 Apr 2010 23:22:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752198Ab0DDXVW (ORCPT ); Sun, 4 Apr 2010 19:21:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57867 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836Ab0DDXU7 convert rfc822-to-8bit (ORCPT ); Sun, 4 Apr 2010 19:20:59 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o34NKw1r024825 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 4 Apr 2010 19:20:58 -0400 Received: from localhost (dhcp-1-211.tlv.redhat.com [10.35.1.211]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o34NKsrx020425 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 4 Apr 2010 19:20:57 -0400 Date: Mon, 5 Apr 2010 02:26:37 +0300 From: Izik Eidus To: avi@redhat.com, kvm@vger.kernel.org Subject: [PATCH] fix migration with big mem guests Message-ID: <20100405022637.75dbdc73@redhat.com> Organization: redhat Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 04 Apr 2010 23:23:10 +0000 (UTC) diff --git a/vl.c b/vl.c index d959fdb..777988d 100644 --- a/vl.c +++ b/vl.c @@ -174,6 +174,8 @@ int main(int argc, char **argv) #define DEFAULT_RAM_SIZE 128 +#define MAX_SAVE_BLOCK_READ 10 * 1024 * 1024 + #define MAX_VIRTIO_CONSOLES 1 static const char *data_dir; @@ -2854,6 +2856,7 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) uint64_t bytes_transferred_last; double bwidth = 0; uint64_t expected_time = 0; + int data_read = 0; if (stage < 0) { cpu_physical_memory_set_dirty_tracking(0); @@ -2883,10 +2886,11 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) bytes_transferred_last = bytes_transferred; bwidth = qemu_get_clock_ns(rt_clock); - while (!qemu_file_rate_limit(f)) { + while (!qemu_file_rate_limit(f) && data_read < MAX_SAVE_BLOCK_READ) { int ret; ret = ram_save_block(f); + data_read += ret * TARGET_PAGE_SIZE; bytes_transferred += ret * TARGET_PAGE_SIZE; if (ret == 0) /* no more blocks */ break;