qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems
@ 2022-03-21 17:16 Khem Raj
  0 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2022-03-21 17:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Khem Raj

linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures
which include asm-generic/mman.h and mips/powerpc are not including this
file in linux/mman.h, therefore these should be defined for such
architectures on Linux as well. This fixes build on mips/musl/linux

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 util/mmap-alloc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 893d864354..86d3cda248 100644
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -10,14 +10,18 @@
  * later.  See the COPYING file in the top-level directory.
  */
 
+#include "qemu/osdep.h"
 #ifdef CONFIG_LINUX
 #include <linux/mman.h>
-#else  /* !CONFIG_LINUX */
+#endif  /* CONFIG_LINUX */
+
+#ifndef MAP_SYNC
 #define MAP_SYNC              0x0
+#endif /* MAP_SYNC */
+#ifndef MAP_SHARED_VALIDATE
 #define MAP_SHARED_VALIDATE   0x0
-#endif /* CONFIG_LINUX */
+#endif /* MAP_SHARED_VALIDATE */
 
-#include "qemu/osdep.h"
 #include "qemu/mmap-alloc.h"
 #include "qemu/host-utils.h"
 #include "qemu/cutils.h"
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems
@ 2022-03-21 17:20 Khem Raj
  2022-03-22 14:05 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2022-03-21 17:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Zhang Yi, Khem Raj, Michael S . Tsirkin

linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures
which include asm-generic/mman.h and mips/powerpc are not including this
file in linux/mman.h, therefore these should be defined for such
architectures on Linux as well. This fixes build on mips/musl/linux

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Zhang Yi <yi.z.zhang@linux.intel.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
---
 util/mmap-alloc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 893d864354..86d3cda248 100644
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -10,14 +10,18 @@
  * later.  See the COPYING file in the top-level directory.
  */
 
+#include "qemu/osdep.h"
 #ifdef CONFIG_LINUX
 #include <linux/mman.h>
-#else  /* !CONFIG_LINUX */
+#endif  /* CONFIG_LINUX */
+
+#ifndef MAP_SYNC
 #define MAP_SYNC              0x0
+#endif /* MAP_SYNC */
+#ifndef MAP_SHARED_VALIDATE
 #define MAP_SHARED_VALIDATE   0x0
-#endif /* CONFIG_LINUX */
+#endif /* MAP_SHARED_VALIDATE */
 
-#include "qemu/osdep.h"
 #include "qemu/mmap-alloc.h"
 #include "qemu/host-utils.h"
 #include "qemu/cutils.h"
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems
  2022-03-21 17:20 Khem Raj
@ 2022-03-22 14:05 ` Richard Henderson
  2022-03-22 14:44   ` Michael S. Tsirkin
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2022-03-22 14:05 UTC (permalink / raw)
  To: Khem Raj, qemu-devel; +Cc: Zhang Yi, Michael S . Tsirkin

On 3/21/22 10:20, Khem Raj wrote:
> linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures
> which include asm-generic/mman.h and mips/powerpc are not including this
> file in linux/mman.h, therefore these should be defined for such
> architectures on Linux as well.

This is not precisely correct.

MAP_SHARED_VALIDATE is defined in <linux/mman.h> for all architectures.

MAP_SYNC is defined in <asm-generic/mman-common.h>, which is included by powerpc 
<asm/mman.h>.  But you are correct that this is missing for mips.

> @@ -10,14 +10,18 @@
>    * later.  See the COPYING file in the top-level directory.
>    */
>   
> +#include "qemu/osdep.h"
>   #ifdef CONFIG_LINUX
>   #include <linux/mman.h>
> -#else  /* !CONFIG_LINUX */
> +#endif  /* CONFIG_LINUX */
> +
> +#ifndef MAP_SYNC
>   #define MAP_SYNC              0x0
> +#endif /* MAP_SYNC */
> +#ifndef MAP_SHARED_VALIDATE
>   #define MAP_SHARED_VALIDATE   0x0
> -#endif /* CONFIG_LINUX */
> +#endif /* MAP_SHARED_VALIDATE */
>   
> -#include "qemu/osdep.h"

The patch is correct, just need to fix the description.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems
  2022-03-22 14:05 ` Richard Henderson
@ 2022-03-22 14:44   ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2022-03-22 14:44 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Zhang Yi, Khem Raj, qemu-devel

On Tue, Mar 22, 2022 at 07:05:05AM -0700, Richard Henderson wrote:
> On 3/21/22 10:20, Khem Raj wrote:
> > linux only wires MAP_SYNC and MAP_SHARED_VALIDATE for architectures
> > which include asm-generic/mman.h and mips/powerpc are not including this
> > file in linux/mman.h, therefore these should be defined for such
> > architectures on Linux as well.
> 
> This is not precisely correct.
> 
> MAP_SHARED_VALIDATE is defined in <linux/mman.h> for all architectures.
> 
> MAP_SYNC is defined in <asm-generic/mman-common.h>, which is included by
> powerpc <asm/mman.h>.  But you are correct that this is missing for mips.

OK, sounds like the commit log should be tweaked and the patch reposted.
The patch itself looks ok to me

Acked-by: Michael S. Tsirkin <mst@redhat.com>

mips tree I guess?


> > @@ -10,14 +10,18 @@
> >    * later.  See the COPYING file in the top-level directory.
> >    */
> > +#include "qemu/osdep.h"
> >   #ifdef CONFIG_LINUX
> >   #include <linux/mman.h>
> > -#else  /* !CONFIG_LINUX */
> > +#endif  /* CONFIG_LINUX */
> > +
> > +#ifndef MAP_SYNC
> >   #define MAP_SYNC              0x0
> > +#endif /* MAP_SYNC */
> > +#ifndef MAP_SHARED_VALIDATE
> >   #define MAP_SHARED_VALIDATE   0x0
> > -#endif /* CONFIG_LINUX */
> > +#endif /* MAP_SHARED_VALIDATE */
> > -#include "qemu/osdep.h"
> 
> The patch is correct, just need to fix the description.
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> 
> r~



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-22 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-21 17:16 [PATCH] Define MAP_SYNC and MAP_SHARED_VALIDATE on needed linux systems Khem Raj
  -- strict thread matches above, loose matches on Subject: below --
2022-03-21 17:20 Khem Raj
2022-03-22 14:05 ` Richard Henderson
2022-03-22 14:44   ` Michael S. Tsirkin

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).