qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v8 42/54] Postcopy: Use helpers to map pages dur


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH v8 42/54] Postcopy: Use helpers to map pages during migration
Date: Fri, 30 Oct 2015 12:59:36 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

* Juan Quintela (address@hidden) wrote:
> "Dr. David Alan Gilbert (git)" <address@hidden> wrote:
> > From: "Dr. David Alan Gilbert" <address@hidden>
> >
> > In postcopy, the destination guest is running at the same time
> > as it's receiving pages; as we receive new pages we must put
> > them into the guests address space atomically to avoid a running
> > CPU accessing a partially written page.
> >
> > Use the helpers in postcopy-ram.c to map these pages.
> >
> > qemu_get_buffer_in_place is used to avoid a copy out of qemu_file
> > in the case that postcopy is going to do a copy anyway.
> >
> > Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> > ---
> >  migration/ram.c | 128 
> > +++++++++++++++++++++++++++++++++++++++++++++-----------
> >  1 file changed, 103 insertions(+), 25 deletions(-)
> >
> > diff --git a/migration/ram.c b/migration/ram.c
> > index 487e838..6d9cfb5 100644
> > --- a/migration/ram.c
> > +++ b/migration/ram.c
> > @@ -1848,7 +1848,17 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, 
> > void *host)
> >  /* Must be called from within a rcu critical section.
> >   * Returns a pointer from within the RCU-protected ram_list.
> >   */
> > +/*
> > + * Read a RAMBlock ID from the stream f, find the host address of the
> > + * start of that block and add on 'offset'
> > + *
> > + * f: Stream to read from
> > + * mis: MigrationIncomingState
> > + * offset: Offset within the block
> > + * flags: Page flags (mostly to see if it's a continuation of previous 
> > block)
> > + */
> >  static inline void *host_from_stream_offset(QEMUFile *f,
> > +                                            MigrationIncomingState *mis,
> >                                              ram_addr_t offset,
> >                                              int flags)
> >  {
> 
> 
> Uh, oh, we change the prototype of host_from_stream_offset() but not the
> function itself?  Strange, no?

Ah, that's a straggler from an old version of the patches that needed mis; gone.

<snip - I'll take the other refactoring in a different reply>

> Hahahaha, just change the if or the variable name.
> 
> having a
> 
> if (!cond) {
>    f1();
> } else {
>    f2();
> }
> 
> makes no sense, better to have
> 
> if (cond) {
>    f2()
> } else {
>    f1()
> }
> no?

Done.

Dave

> 
> 
> 
> The patch itself is ok.
> 
> Thanks, Juan.
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

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