Received: from eggs.gnu.org ([2001:4830:134:3::10]:36575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXqbj-00072D-3t for qemu-devel@nongnu.org; Tue, 17 Mar 2015 08:28:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXqbf-000707-Q5 for qemu-devel@nongnu.org; Tue, 17 Mar 2015 08:28:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXqbf-000702-KR for qemu-devel@nongnu.org; Tue, 17 Mar 2015 08:28:23 -0400 From: Juan Quintela In-Reply-To: (Liang Z. Li's message of "Tue, 17 Mar 2015 03:13:02 +0000") References: <1426513272-20070-1-git-send-email-quintela@redhat.com> <1426513272-20070-8-git-send-email-quintela@redhat.com> Date: Tue, 17 Mar 2015 13:00:23 +0100 Message-ID: <871tknltpk.fsf@neno.neno> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: Re: [Qemu-devel] [PULL 07/11] save_block_hdr: we can recalculate the cont parameter here Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Li, Liang Z" Cc: "qemu-devel@nongnu.org" --=-=-= Content-Type: text/plain "Li, Liang Z" wrote: > Hi Juan > > This patch will make my work more difficult, as we discussed > before, after modification, > I have to use a lock before I can reuse the function save_block_hdr in > my compression threads, > this will lead to low efficiency. Could help to revert this patch? > > Liang Sorry, my intention was to just revert the bits that you neded, what does this patch works for you? I just moved back the uses of last_sent_block() where there were before. Thanks, Juan. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-migration-remove-last_sent_block-from-save_page_head.patch >From 76bdb0c98e345dcc4777d4b034efd4ccd71489ba Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Tue, 17 Mar 2015 12:56:13 +0100 Subject: [PATCH] migration: remove last_sent_block from save_page_header 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 --- arch_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch_init.c b/arch_init.c index c3f7d3f..c779957 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; } } -- 2.1.0 --=-=-=--