* Gonglei (Arei) (arei.gong...@huawei.com) wrote: > > Best regards, > -Gonglei > >
<snip> > > } else if (!ram_bulk_stage && migrate_use_xbzrle()) { > > - current_addr = block->offset + offset; > > bytes_sent = save_xbzrle_page(f, p, current_addr, block, > > offset, cont, > > last_stage); > > if (!last_stage) { > > + /* We must send exactly what's in the xbzrle cache > > + * even if the page wasn't xbzrle compressed, so > > that > > + * it's right next time. > > + */ > > p = get_cached_data(XBZRLE.cache, current_addr); > > + > > + /* Can't send this cached data async, since the cache > > page > > + * might get updated before it gets to the wire > > + */ > > + send_async = false; > > } > > } > > > > /* XBZRLE overflow or normal page */ > > if (bytes_sent == -1) { > > bytes_sent = save_block_hdr(f, block, offset, cont, > > RAM_SAVE_FLAG_PAGE); > > - qemu_put_buffer_async(f, p, TARGET_PAGE_SIZE); > > + if (send_async) { > > + qemu_put_buffer_async(f, p, TARGET_PAGE_SIZE); > > + } else { > > + qemu_put_buffer(f, p, TARGET_PAGE_SIZE); > > + } > > bytes_sent += TARGET_PAGE_SIZE; > > acct_info.norm_pages++; > > } > > if a page that was cached by XBZRLE but XBZRLE overflow,qemu should send the > page in the cache rather then original page.Because the original page might > change . Which it already does - see the line above which is: p = get_cached_data(XBZRLE.cache, current_addr); That changes the 'p' to point to the page in the cache and thus forces that qemu_put_buffer to send the page in the cache; my patch doesn't change that, it just stops it using the qemu_put_buffer_async so that the cache is read immediately not at some point in the future when the cache may have changed. Dave -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK