qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix two XBZRLE corruption issues


From: Gonglei (Arei)
Subject: Re: [Qemu-devel] [PATCH] Fix two XBZRLE corruption issues
Date: Fri, 14 Feb 2014 09:49:55 +0000

> -----Original Message-----
> From: Dr. David Alan Gilbert [mailto:address@hidden
> Sent: Friday, February 14, 2014 5:35 PM
> To: Gonglei (Arei)
> Cc: address@hidden; address@hidden; address@hidden
> Subject: Re: [Qemu-devel] [PATCH] Fix two XBZRLE corruption issues
> 
> * Gonglei (Arei) (address@hidden) 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 / address@hidden / Manchester, UK
Thanks, you are right.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]