On Fri, Oct 03, 2014 at 06:47:31PM +0100, Dr. David Alan Gilbert (git) wrote: > From: "Dr. David Alan Gilbert" <dgilb...@redhat.com> > > Provide a check to see if the OS we're running on has all the bits > needed for postcopy. > > Creates postcopy-ram.c which will get most of the other helpers we need. > > Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com> > --- > Makefile.objs | 2 +- > include/migration/postcopy-ram.h | 19 +++++ > postcopy-ram.c | 160 > +++++++++++++++++++++++++++++++++++++++ > savevm.c | 6 ++ > 4 files changed, 186 insertions(+), 1 deletion(-) > create mode 100644 include/migration/postcopy-ram.h > create mode 100644 postcopy-ram.c > > diff --git a/Makefile.objs b/Makefile.objs > index 97db978..fa0a3a0 100644 > --- a/Makefile.objs > +++ b/Makefile.objs > @@ -54,7 +54,7 @@ common-obj-y += qemu-file.o > common-obj-$(CONFIG_RDMA) += migration-rdma.o > common-obj-y += qemu-char.o #aio.o > common-obj-y += block-migration.o > -common-obj-y += page_cache.o xbzrle.o > +common-obj-y += page_cache.o xbzrle.o postcopy-ram.o > > common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o > migration-fd.o > > diff --git a/include/migration/postcopy-ram.h > b/include/migration/postcopy-ram.h > new file mode 100644 > index 0000000..dcd1afa > --- /dev/null > +++ b/include/migration/postcopy-ram.h > @@ -0,0 +1,19 @@ > +/* > + * Postcopy migration for RAM > + * > + * Copyright 2013 Red Hat, Inc. and/or its affiliates > + * > + * Authors: > + * Dave Gilbert <dgilb...@redhat.com> > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + * > + */ > +#ifndef QEMU_POSTCOPY_RAM_H > +#define QEMU_POSTCOPY_RAM_H > + > +/* Return 0 if the host supports everything we need to do postcopy-ram */ > +int postcopy_ram_hosttest(void);
Maybe postcopy_supported_by_host() would be a bit clearer? [snip] > +#ifdef HOST_X86_64 > + /* NOTE: These are Andrea's 3.15.0 world */ I thought the usual approach in qemu was to import the updated headers first in a separate patch, rather than embeddeding new defines. > +#ifndef MADV_USERFAULT > +#define MADV_USERFAULT 18 > +#define MADV_NOUSERFAULT 19 > +#endif > + > +#ifndef __NR_remap_anon_pages > +#define __NR_remap_anon_pages 321 > +#endif > + > +#ifndef __NR_userfaultfd > +#define __NR_userfaultfd 322 > +#endif > + > +#endif > + > +#ifndef USERFAULTFD_PROTOCOL > +#define USERFAULTFD_PROTOCOL (uint64_t)0xaa > +#endif > + > +#endif -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
pgpnfh71XPYSM.pgp
Description: PGP signature