[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v14 1/2] util/mmap-alloc: support MAP_SYNC in qe
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v14 1/2] util/mmap-alloc: support MAP_SYNC in qemu_ram_mmap() |
Date: |
Thu, 25 Apr 2019 09:26:09 +0100 |
User-agent: |
Mutt/1.11.3 (2019-02-01) |
On Wed, Apr 24, 2019 at 09:01:05AM +0800, Wei Yang wrote:
> On Tue, Apr 23, 2019 at 10:25:18AM +0100, Stefan Hajnoczi wrote:
> [...]
> >> +#ifdef CONFIG_LINUX
> >> +#include <linux/mman.h>
> >> +#else /* !CONFIG_LINUX */
> >> +#define MAP_SYNC 0x0
> >> +#define MAP_SHARED_VALIDATE 0x0
> >> +#endif /* CONFIG_LINUX */
> >
> >MAP_SHARED_VALIDATE is is from 2017:
> >
> > commit 1c9725974074a047f6080eecc62c50a8e840d050
> > Author: Dan Williams <address@hidden>
> > Date: Wed Nov 1 16:36:30 2017 +0100
> >
> > mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap
> > flags
> >
> >This code fails to compile on Linux hosts with pre-4.15 headers.
> >
>
> Ok, qemu build will fail on pre-4.15 linux.
>
> >Instead you could use the following (even on Linux!):
> >
> > #ifndef MAP_SYNC
> > #define MAP_SYNC 0
> > #endif
> > #ifndef MAP_SHARED_VALIDATE
> > #define MAP_SHARED_VALIDATE 0
> > #endif
> >
> >Either way:
>
> You mean replace the above code to:
>
> #ifdef CONFIG_LINUX
> #include <linux/mman.h>
> #endif /* CONFIG_LINUX */
>
> #ifndef MAP_SYNC
> #define MAP_SYNC 0
> #endif
> #ifndef MAP_SHARED_VALIDATE
> #define MAP_SHARED_VALIDATE 0
> #endif
Yes, please.
This is not critical but I bet someone will hit this issue when
compiling a new QEMU on an old host. This small tweak will save them
time.
Stefan
signature.asc
Description: PGP signature