On 03/19/2018 03:56 PM, jiang.biao2@xxxxxxxxxx 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. :(