qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Haozhong Zhang <haozhong.zhang@intel.com>
Cc: qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	dgilbert@redhat.com,
	Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/3] util/mmap-alloc: support MAP_SYNC in qemu_ram_mmap()
Date: Wed, 24 Jan 2018 22:20:57 +0200	[thread overview]
Message-ID: <20180124221602-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180117081325.11924-2-haozhong.zhang@intel.com>

> index 50385e3f81..dd5876471f 100644
> --- a/include/qemu/mmap-alloc.h
> +++ b/include/qemu/mmap-alloc.h
> @@ -7,7 +7,8 @@ size_t qemu_fd_getpagesize(int fd);
>  
>  size_t qemu_mempath_getpagesize(const char *mem_path);
>  
> -void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared);
> +void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared,
> +                    OnOffAuto sync);
>  
>  void qemu_ram_munmap(void *ptr, size_t size);
>  

And Marcel plans to add a remappable flag ...  Is it time we
switched to a flags field?

> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index adb3758275..0ff10cb529 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -372,6 +372,24 @@ void qemu_anon_ram_free(void *ptr, size_t size);
>  #  define QEMU_VMALLOC_ALIGN getpagesize()
>  #endif
>  
> +/*
> + * MAP_SHARED_VALIDATE and MAP_SYNC were introduced in Linux kernel
> + * 4.15, so they may not be defined when compiling on older kernels.
> + */
> +#ifdef CONFIG_LINUX
> +#ifndef MAP_SHARED_VALIDATE
> +#define MAP_SHARED_VALIDATE   0x3
> +#endif
> +#ifndef MAP_SYNC
> +#define MAP_SYNC              0x80000
> +#endif
> +#define QEMU_HAS_MAP_SYNC     true
> +#else  /* !CONFIG_LINUX */
> +#define MAP_SHARED_VALIDATE   0x0
> +#define MAP_SYNC              0x0
> +#define QEMU_HAS_MAP_SYNC     false
> +#endif /* CONFIG_LINUX */
> +
>  #ifdef CONFIG_POSIX
>  struct qemu_signalfd_siginfo {
>      uint32_t ssi_signo;   /* Signal number */

Please just import this into standard-headers from Linux.

  reply	other threads:[~2018-01-24 20:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  8:13 [Qemu-devel] [PATCH v3 0/3] nvdimm: support MAP_SYNC for memory-backend-file Haozhong Zhang
2018-01-17  8:13 ` [Qemu-devel] [PATCH v3 1/3] util/mmap-alloc: support MAP_SYNC in qemu_ram_mmap() Haozhong Zhang
2018-01-24 20:20   ` Michael S. Tsirkin [this message]
2018-01-25  0:14     ` Haozhong Zhang
2018-01-17  8:13 ` [Qemu-devel] [PATCH v3 2/3] hostmem: add more information in error messages Haozhong Zhang
2018-01-24 20:23   ` Michael S. Tsirkin
2018-01-17  8:13 ` [Qemu-devel] [PATCH v3 3/3] hostmem-file: add 'sync' option Haozhong Zhang
2018-01-24 20:22   ` Michael S. Tsirkin
2018-01-24 20:23   ` Michael S. Tsirkin
2018-01-25  0:24     ` Haozhong Zhang
2018-01-24  8:12 ` [Qemu-devel] [PATCH v3 0/3] nvdimm: support MAP_SYNC for memory-backend-file Haozhong Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180124221602-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=haozhong.zhang@intel.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiaoguangrong.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).