From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 3/8] migration: support to detect compressionand decompression errors Date: Mon, 19 Mar 2018 16:01:30 +0800 Message-ID: <1d1dea5a-2d1d-97cd-a777-a63df0417fbb@gmail.com> References: <201803191556183250813@zte.com.cn> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mst@redhat.com, mtosatti@redhat.com, xiaoguangrong@tencent.com, qemu-devel@nongnu.org, pbonzini@redhat.com To: jiang.biao2@zte.com.cn Return-path: In-Reply-To: <201803191556183250813@zte.com.cn> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel2=m.gmane.org@nongnu.org Sender: "Qemu-devel" List-Id: kvm.vger.kernel.org On 03/19/2018 03:56 PM, jiang.biao2@zte.com.cn wrote: > Hi, guangrong >> @@ -1051,11 +1052,13 @@ static int do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block, >> { >> RAMState *rs = ram_state; >> int bytes_sent, blen; >> - uint8_t *p = block->host + (offset & TARGET_PAGE_MASK); >> + uint8_t buf[TARGET_PAGE_SIZE], *p; > >> + p = block->host + (offset & TARGET_PAGE_MASK); >> bytes_sent = save_page_header(rs, f, block, offset | >> RAM_SAVE_FLAG_COMPRESS_PAGE); >> - blen = qemu_put_compression_data(f, stream, p, TARGET_PAGE_SIZE); >> + memcpy(buf, p, TARGET_PAGE_SIZE); >> + blen = qemu_put_compression_data(f, stream, buf, TARGET_PAGE_SIZE); > Memory copy operation for every page to be compressed is not cheap, especially > when the page number is huge, and it may be not necessary for pages never > updated during migration. This is only for 4k page. > Is there any possibility that we can distinguish the real compress/decompress > errors from those being caused by source VM updating? Such as the return > value of qemu_uncompress(distinguish Z_DATA_ERROR and other error codes > returned by inflate())? Unfortunately, no. :(