diff mbox series

[ndctl,1/2] autoconf: Check for MAP_SHARED_VALIDATE

Message ID 20190214163422.15221-1-elliott@hpe.com (mailing list archive)
State New, archived
Headers show
Series [ndctl,1/2] autoconf: Check for MAP_SHARED_VALIDATE | expand

Commit Message

Elliott, Robert (Servers) Feb. 14, 2019, 4:34 p.m. UTC
Some ndctl tests use two new mmap() flags named MAP_SHARED_VALIDATE
and MAP_SYNC that were added by linux kernel-4.15, intended to be
defined for applications by sys/mman.h. However, these do not exist
unless the distro has glibc-2.28.

In addition to the existing check for MAP_SYNC, check that
MAP_SHARED_VALIDATE is provided.

Fixes: 94679e6b78aa ("ndctl, test: check availability of MAP_SYNC for poison test")
Signed-off-by: Robert Elliott <elliott@hpe.com>
---
 configure.ac | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Dan Williams Feb. 14, 2019, 4:53 p.m. UTC | #1
On Thu, Feb 14, 2019 at 8:29 AM Robert Elliott <elliott@hpe.com> wrote:
>
> Some ndctl tests use two new mmap() flags named MAP_SHARED_VALIDATE
> and MAP_SYNC that were added by linux kernel-4.15, intended to be
> defined for applications by sys/mman.h. However, these do not exist
> unless the distro has glibc-2.28.
>
> In addition to the existing check for MAP_SYNC, check that
> MAP_SHARED_VALIDATE is provided.
>
> Fixes: 94679e6b78aa ("ndctl, test: check availability of MAP_SYNC for poison test")
> Signed-off-by: Robert Elliott <elliott@hpe.com>

Does this really fix anything? How can a system have MAP_SYNC without
MAP_SHARED_VALIDATE?
Elliott, Robert (Servers) Feb. 14, 2019, 5:03 p.m. UTC | #2
> -----Original Message-----
> From: Dan Williams [mailto:dan.j.williams@intel.com]
> Sent: Thursday, February 14, 2019 10:54 AM
> To: Elliott, Robert (Persistent Memory) <elliott@hpe.com>
> Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
> Subject: Re: [ndctl PATCH 1/2] autoconf: Check for MAP_SHARED_VALIDATE
> 
> On Thu, Feb 14, 2019 at 8:29 AM Robert Elliott <elliott@hpe.com> wrote:
> >
> > Some ndctl tests use two new mmap() flags named MAP_SHARED_VALIDATE
> > and MAP_SYNC that were added by linux kernel-4.15, intended to be
> > defined for applications by sys/mman.h. However, these do not exist
> > unless the distro has glibc-2.28.
> >
> > In addition to the existing check for MAP_SYNC, check that
> > MAP_SHARED_VALIDATE is provided.
> >
> > Fixes: 94679e6b78aa ("ndctl, test: check availability of MAP_SYNC for poison test")
> > Signed-off-by: Robert Elliott <elliott@hpe.com>
> 
> Does this really fix anything? How can a system have MAP_SYNC without
> MAP_SHARED_VALIDATE?

In glibc, MAP_SHARED_VALIDATE went into all architectures while
MAP_SYNC did not - these are left out: 
    alpha hppa mips powerpc sparc tile 

Checking both provides a breadcrumb about whether it's an overall
glibc version problem or an architecture-specific problem.

BTW, the glibc patches at git://sourceware.org/git/glibc.git are
these on 2018-02-06:
    e76def72eb74 ("Add MAP_SYNC from Linux 4.15.")
    92669d6ee3f2 ("Add MAP_SHARED_VALIDATE from Linux 4.15.")
Dan Williams Feb. 14, 2019, 5:54 p.m. UTC | #3
On Thu, Feb 14, 2019 at 9:04 AM Elliott, Robert (Persistent Memory)
<elliott@hpe.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Dan Williams [mailto:dan.j.williams@intel.com]
> > Sent: Thursday, February 14, 2019 10:54 AM
> > To: Elliott, Robert (Persistent Memory) <elliott@hpe.com>
> > Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
> > Subject: Re: [ndctl PATCH 1/2] autoconf: Check for MAP_SHARED_VALIDATE
> >
> > On Thu, Feb 14, 2019 at 8:29 AM Robert Elliott <elliott@hpe.com> wrote:
> > >
> > > Some ndctl tests use two new mmap() flags named MAP_SHARED_VALIDATE
> > > and MAP_SYNC that were added by linux kernel-4.15, intended to be
> > > defined for applications by sys/mman.h. However, these do not exist
> > > unless the distro has glibc-2.28.
> > >
> > > In addition to the existing check for MAP_SYNC, check that
> > > MAP_SHARED_VALIDATE is provided.
> > >
> > > Fixes: 94679e6b78aa ("ndctl, test: check availability of MAP_SYNC for poison test")
> > > Signed-off-by: Robert Elliott <elliott@hpe.com>
> >
> > Does this really fix anything? How can a system have MAP_SYNC without
> > MAP_SHARED_VALIDATE?
>
> In glibc, MAP_SHARED_VALIDATE went into all architectures while
> MAP_SYNC did not - these are left out:
>     alpha hppa mips powerpc sparc tile
>
> Checking both provides a breadcrumb about whether it's an overall
> glibc version problem or an architecture-specific problem.
>
> BTW, the glibc patches at git://sourceware.org/git/glibc.git are
> these on 2018-02-06:
>     e76def72eb74 ("Add MAP_SYNC from Linux 4.15.")
>     92669d6ee3f2 ("Add MAP_SHARED_VALIDATE from Linux 4.15.")

Ah, thanks for the clarification. Lets roll these details into the changelog.
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index d27a2b1..efbdcde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,12 +103,13 @@  AS_IF([test "x$enable_test" = "xyes"],
 AM_CONDITIONAL([ENABLE_TEST], [test "x$enable_test" = "xyes"])
 
 AC_CHECK_DECLS([BUS_MCEERR_AR], [enable_bus_mc_err=yes], [], [[#include <signal.h>]])
+AC_CHECK_DECLS([MAP_SHARED_VALIDATE], [enable_map_shared_validate=yes], [], [[#include <sys/mman.h>]])
 AC_CHECK_DECLS([MAP_SYNC], [enable_map_sync=yes], [], [[#include <sys/mman.h>]])
 
-AS_IF([test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes"],
+AS_IF([test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes" -a "x$enable_map_shared_validate" = "xyes"],
 	[AC_DEFINE([ENABLE_POISON], [1], [ndctl test poison support])])
 AM_CONDITIONAL([ENABLE_POISON],
-	[test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes"])
+	[test "x$enable_bus_mc_err" = "xyes" -a "x$enable_map_sync" = "xyes" -a "x$enable_map_shared_validate" = "xyes"])
 
 PKG_CHECK_MODULES([KMOD], [libkmod])
 PKG_CHECK_MODULES([UDEV], [libudev])