qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v8 41/54] postcopy_ram.c: place_page and helpers


From: Dr. David Alan Gilbert
Subject: Re: [Qemu-devel] [PATCH v8 41/54] postcopy_ram.c: place_page and helpers
Date: Wed, 28 Oct 2015 13:11:11 +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>
> >
> > postcopy_place_page (etc) provide a way for postcopy to place a page
> > into guests memory atomically (using the copy ioctl on the ufd).
> >
> > Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> > Reviewed-by: Amit Shah <address@hidden>
> 
> 
> Reviewed-by: Juan Quintela <address@hidden>
> 
> > +int postcopy_place_page_zero(MigrationIncomingState *mis, void *host)
> > +{
> > +    struct uffdio_zeropage zero_struct;
> > +
> > +    zero_struct.range.start = (uint64_t)(uintptr_t)host;
> > +    zero_struct.range.len = getpagesize();
> > +    zero_struct.mode = 0;
> > +
> > +    if (ioctl(mis->userfault_fd, UFFDIO_ZEROPAGE, &zero_struct)) {
> > +        int e = errno;
> > +        error_report("%s: %s zero host: %p",
> > +                     __func__, strerror(e), host);
> > +
> > +        return -e;
> > +    }
> > +
> > +    trace_postcopy_place_page_zero(host);
> > +    return 0;
> > +}
> 
> Would this be faster than normal precopy way of just copying a zero page?

For postcopy we have to do an ioctl anyway (to release any paused tasks
waiting on the page), and we can't just write to the page because it's not
mapped yet.  We could do a UFFDIO_COPY of a zero page but that would
take a copy; here the kernel maps the zero page and releases the paused task
without needing a zero page to copy from.

Dave

--
Dr. David Alan Gilbert / address@hidden / Manchester, UK



reply via email to

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