From patchwork Thu Mar 26 14:45:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 455066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 33E3114012F for ; Fri, 27 Mar 2015 01:47:45 +1100 (AEDT) Received: from localhost ([::1]:44834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb94R-0005Xa-6n for incoming@patchwork.ozlabs.org; Thu, 26 Mar 2015 10:47:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb92v-0002h2-PV for qemu-devel@nongnu.org; Thu, 26 Mar 2015 10:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yb92r-0005cq-SJ for qemu-devel@nongnu.org; Thu, 26 Mar 2015 10:46:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yb92r-0005cX-K7 for qemu-devel@nongnu.org; Thu, 26 Mar 2015 10:46:05 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2QEk5hB032008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 26 Mar 2015 10:46:05 -0400 Received: from trasno.mitica (ovpn-116-131.ams2.redhat.com [10.36.116.131]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2QEjxVT010216; Thu, 26 Mar 2015 10:46:04 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Mar 2015 15:45:58 +0100 Message-Id: <1427381158-9069-4-git-send-email-quintela@redhat.com> In-Reply-To: <1427381158-9069-1-git-send-email-quintela@redhat.com> References: <1427381158-9069-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] migration: remove last_sent_block from save_page_header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Compression code (still not on tree) want to call this funtion from outside the migration thread, so we can't write to last_sent_block. Instead of reverting full patch: [PULL 07/11] save_block_hdr: we can recalculate Just revert the parts that touch last_sent_block. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- arch_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch_init.c b/arch_init.c index fcfa328..4c8fcee 100644 --- a/arch_init.c +++ b/arch_init.c @@ -332,19 +332,14 @@ static size_t save_page_header(QEMUFile *f, RAMBlock *block, ram_addr_t offset) { size_t size; - if (block == last_sent_block) { - offset |= RAM_SAVE_FLAG_CONTINUE; - } - qemu_put_be64(f, offset); size = 8; - if (block != last_sent_block) { + if (!(offset & RAM_SAVE_FLAG_CONTINUE)) { qemu_put_byte(f, strlen(block->idstr)); qemu_put_buffer(f, (uint8_t *)block->idstr, strlen(block->idstr)); size += 1 + strlen(block->idstr); - last_sent_block = block; } return size; } @@ -644,6 +639,10 @@ static int ram_save_page(QEMUFile *f, RAMBlock* block, ram_addr_t offset, XBZRLE_cache_lock(); current_addr = block->offset + offset; + + if (block == last_sent_block) { + offset |= RAM_SAVE_FLAG_CONTINUE; + } if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { if (ret != RAM_SAVE_CONTROL_DELAYED) { if (bytes_xmit > 0) { @@ -739,6 +738,7 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage, /* if page is unmodified, continue to the next */ if (pages > 0) { + last_sent_block = block; break; } }