Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH 2/9] Remove HAVE_VALGRIND_MEMCHECK_H/INCLUDE_VALGRIND
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Hefty, Hal Rosenstock, Doug Ledford, Yishai Hadas,
	Vladimir Sokolovsky, Bart Van Assche
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

The cmake build system guarantees that valgrind/memcheck.h is present.
If the system does not have it, or valgrind is disabled, then it is
replaced with a dummy header full of empty stubs.

Thus all the copy&paste boiler plate is consolidated into buildlib.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/config.h.in               |  4 ----
 libibcm/src/cm.c                   | 11 +----------
 libibumad/src/umad.c               | 14 +-------------
 libibverbs/src/ibverbs.h           | 14 +-------------
 libmlx4/src/mlx4.h                 | 18 +-----------------
 libmlx5/src/mlx5.h                 | 18 +-----------------
 libmthca/src/mthca.h               | 18 +-----------------
 librdmacm/src/cma.h                | 11 +----------
 srp_daemon/srp_daemon/srp_daemon.h |  5 -----
 9 files changed, 7 insertions(+), 106 deletions(-)

diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 0a87457e6d7a..a02be9cfb0f7 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -21,10 +21,6 @@
 // FIXME: Remove this, The cmake version hard-requires new style CLOEXEC support
 #define STREAM_CLOEXEC "e"
 
-// FIXME: Remove this, cmake always provides a valgrind/memcheck.h
-#define HAVE_VALGRIND_MEMCHECK_H 1
-#define INCLUDE_VALGRIND 1
-
 #define IBV_CONFIG_DIR "@CONFIG_DIR@"
 #define RS_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket"
 #define IWPM_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf"
diff --git a/libibcm/src/cm.c b/libibcm/src/cm.c
index ebe36bef89e6..f775923aa73c 100644
--- a/libibcm/src/cm.c
+++ b/libibcm/src/cm.c
@@ -49,16 +49,7 @@
 #include <infiniband/driver.h>
 #include <infiniband/marshall.h>
 
-#ifdef INCLUDE_VALGRIND
-#   include <valgrind/memcheck.h>
-#   ifndef VALGRIND_MAKE_MEM_DEFINED
-#       warning "Valgrind requested, but VALGRIND_MAKE_MEM_DEFINED undefined"
-#   endif
-#endif
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#   define VALGRIND_MAKE_MEM_DEFINED(addr,len)
-#endif
+#include <valgrind/memcheck.h>
 
 #define PFX "libibcm: "
 
diff --git a/libibumad/src/umad.c b/libibumad/src/umad.c
index 176d112e125b..0c969f1eb8ad 100644
--- a/libibumad/src/umad.c
+++ b/libibumad/src/umad.c
@@ -52,19 +52,7 @@
 
 #define IB_OPENIB_OUI                 (0x001405)
 
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-
-#  include <valgrind/memcheck.h>
-
-#  ifndef VALGRIND_MAKE_MEM_DEFINED
-#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_DEFINED not available"
-#  endif
-
-#endif				/* HAVE_VALGRIND_MEMCHECK_H */
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#  define VALGRIND_MAKE_MEM_DEFINED(addr,len)
-#endif
+#include <valgrind/memcheck.h>
 
 typedef struct ib_user_mad_reg_req {
 	uint32_t id;
diff --git a/libibverbs/src/ibverbs.h b/libibverbs/src/ibverbs.h
index 062a490915b0..7892af4ad247 100644
--- a/libibverbs/src/ibverbs.h
+++ b/libibverbs/src/ibverbs.h
@@ -38,19 +38,7 @@
 
 #include <infiniband/driver.h>
 
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-
-#  include <valgrind/memcheck.h>
-
-#  ifndef VALGRIND_MAKE_MEM_DEFINED
-#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_DEFINED not available"
-#  endif
-
-#endif /* HAVE_VALGRIND_MEMCHECK_H */
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#  define VALGRIND_MAKE_MEM_DEFINED(addr, len) 0
-#endif
+#include <valgrind/memcheck.h>
 
 #define HIDDEN		__attribute__((visibility ("hidden")))
 
diff --git a/libmlx4/src/mlx4.h b/libmlx4/src/mlx4.h
index feea3386f9a7..4551141d2007 100644
--- a/libmlx4/src/mlx4.h
+++ b/libmlx4/src/mlx4.h
@@ -47,23 +47,7 @@
 #define uninitialized_var(x) x = x
 #endif
 
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-
-#  include <valgrind/memcheck.h>
-
-#  if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED)
-#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available"
-#  endif
-
-#endif /* HAVE_VALGRIND_MEMCHECK_H */
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#  define VALGRIND_MAKE_MEM_DEFINED(addr,len)
-#endif
-
-#ifndef VALGRIND_MAKE_MEM_UNDEFINED
-#  define VALGRIND_MAKE_MEM_UNDEFINED(addr,len)
-#endif
+#include <valgrind/memcheck.h>
 
 #ifndef rmb
 #  define rmb() mb()
diff --git a/libmlx5/src/mlx5.h b/libmlx5/src/mlx5.h
index 6c4e83002028..aa8b6feceb4e 100644
--- a/libmlx5/src/mlx5.h
+++ b/libmlx5/src/mlx5.h
@@ -52,23 +52,7 @@
 #define uninitialized_var(x) x = x
 #endif
 
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-
-#  include <valgrind/memcheck.h>
-
-#  if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED)
-#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available"
-#  endif
-
-#endif /* HAVE_VALGRIND_MEMCHECK_H */
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#  define VALGRIND_MAKE_MEM_DEFINED(addr, len)
-#endif
-
-#ifndef VALGRIND_MAKE_MEM_UNDEFINED
-#  define VALGRIND_MAKE_MEM_UNDEFINED(addr, len)
-#endif
+#include <valgrind/memcheck.h>
 
 #ifndef rmb
 #  define rmb() mb()
diff --git a/libmthca/src/mthca.h b/libmthca/src/mthca.h
index bd1e7a2b1dc0..18d52291343f 100644
--- a/libmthca/src/mthca.h
+++ b/libmthca/src/mthca.h
@@ -39,23 +39,7 @@
 #include <infiniband/driver.h>
 #include <infiniband/arch.h>
 
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-
-#  include <valgrind/memcheck.h>
-
-#  if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED)
-#    warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available"
-#  endif
-
-#endif /* HAVE_VALGRIND_MEMCHECK_H */
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#  define VALGRIND_MAKE_MEM_DEFINED(addr,len)
-#endif
-
-#ifndef VALGRIND_MAKE_MEM_UNDEFINED
-#  define VALGRIND_MAKE_MEM_UNDEFINED(addr,len)
-#endif
+#include <valgrind/memcheck.h>
 
 #ifndef rmb
 #  define rmb() mb()
diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h
index d6005538227f..16a55a67af9e 100644
--- a/librdmacm/src/cma.h
+++ b/librdmacm/src/cma.h
@@ -47,16 +47,7 @@
 
 #include <ccan/minmax.h>
 
-#ifdef INCLUDE_VALGRIND
-#   include <valgrind/memcheck.h>
-#   ifndef VALGRIND_MAKE_MEM_DEFINED
-#       warning "Valgrind requested, but VALGRIND_MAKE_MEM_DEFINED undefined"
-#   endif
-#endif
-
-#ifndef VALGRIND_MAKE_MEM_DEFINED
-#   define VALGRIND_MAKE_MEM_DEFINED(addr,len)
-#endif
+#include <valgrind/memcheck.h>
 
 #define PFX "librdmacm: "
 
diff --git a/srp_daemon/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon/srp_daemon.h
index 6d1575519bc3..d6a2d8a84728 100644
--- a/srp_daemon/srp_daemon/srp_daemon.h
+++ b/srp_daemon/srp_daemon/srp_daemon.h
@@ -408,12 +408,7 @@ typedef struct {
 	char filler[MAD_BLOCK_SIZE];
 } srp_ib_user_mad_t;
 
-#if defined(HAVE_VALGRIND_DRD_H) && defined(ENABLE_VALGRIND)
 #include <valgrind/drd.h>
-#endif
-#ifndef ANNOTATE_BENIGN_RACE_SIZED
-#define ANNOTATE_BENIGN_RACE_SIZED(a, b, c) do { } while(0)
-#endif
 
 #define pr_human(arg...)				\
 	do {						\
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 3/9] Remove HAVE_IBV_*
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Mike Marciniszyn, Dennis Dalessandro, Yishai Hadas,
	Vladimir Sokolovsky, Moni Shoua,
	open list:HF1 USERSPACE PROVIDER for hf1.ko
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

These were used to support building provider plugins against old
versions of libibverbs. Since libibverbs is now included together
with the provider that is no longer possible or supported.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/config.h.in           |  6 -----
 libhfi1verbs/src/hfiverbs.c    | 18 -------------
 libipathverbs/src/ipathverbs.c | 18 -------------
 libmlx5/src/buf.c              | 19 --------------
 libmlx5/src/mlx5.c             |  4 ---
 libmlx5/src/verbs.c            |  2 --
 libmthca/src/buf.c             | 19 --------------
 libmthca/src/mthca.c           | 58 ------------------------------------------
 librxe/src/rxe.c               | 14 ----------
 9 files changed, 158 deletions(-)

diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index a02be9cfb0f7..3b94ea3e4f51 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -1,12 +1,6 @@
 #ifndef CONFIG_H_IN
 #define CONFIG_H_IN
 
-// FIXME: Remove this, ibverbs is included so we don't need to detect
-#define HAVE_IBV_DOFORK_RANGE 1
-#define HAVE_IBV_DONTFORK_RANGE 1
-#define HAVE_IBV_REGISTER_DRIVER 1
-#define HAVE_IBV_READ_SYSFS_FILE 1
-
 #define HAVE_STATEMENT_EXPR 1
 #define HAVE_BUILTIN_TYPES_COMPATIBLE_P 1
 #define HAVE_TYPEOF 1
diff --git a/libhfi1verbs/src/hfiverbs.c b/libhfi1verbs/src/hfiverbs.c
index d2b7dd450992..e28afc7fcc89 100644
--- a/libhfi1verbs/src/hfiverbs.c
+++ b/libhfi1verbs/src/hfiverbs.c
@@ -217,25 +217,7 @@ found:
 	return &dev->ibv_dev;
 }
 
-#ifdef HAVE_IBV_REGISTER_DRIVER
 static __attribute__((constructor)) void hfi1_register_driver(void)
 {
 	ibv_register_driver("hfi1verbs", hfi1_driver_init);
 }
-#else
-/*
- * Export the old libsysfs sysfs_class_device-based driver entry point
- * if libibverbs does not export an ibv_register_driver() function.
- */
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
-{
-        int abi_ver = 0;
-        char value[8];
-
-        if (ibv_read_sysfs_file(sysdev->path, "abi_version",
-                                value, sizeof value) > 0)
-                abi_ver = strtol(value, NULL, 10);
-
-        return hfi1_driver_init(sysdev->path, abi_ver);
-}
-#endif /* HAVE_IBV_REGISTER_DRIVER */
diff --git a/libipathverbs/src/ipathverbs.c b/libipathverbs/src/ipathverbs.c
index 9a19d0ab98ae..4b945f6c58ec 100644
--- a/libipathverbs/src/ipathverbs.c
+++ b/libipathverbs/src/ipathverbs.c
@@ -216,25 +216,7 @@ found:
 	return &dev->ibv_dev;
 }
 
-#ifdef HAVE_IBV_REGISTER_DRIVER
 static __attribute__((constructor)) void ipath_register_driver(void)
 {
 	ibv_register_driver("ipathverbs", ipath_driver_init);
 }
-#else
-/*
- * Export the old libsysfs sysfs_class_device-based driver entry point
- * if libibverbs does not export an ibv_register_driver() function.
- */
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
-{
-        int abi_ver = 0;
-        char value[8];
-
-        if (ibv_read_sysfs_file(sysdev->path, "abi_version",
-                                value, sizeof value) > 0)
-                abi_ver = strtol(value, NULL, 10);
-
-        return ipath_driver_init(sysdev->path, abi_ver);
-}
-#endif /* HAVE_IBV_REGISTER_DRIVER */
diff --git a/libmlx5/src/buf.c b/libmlx5/src/buf.c
index 7e06095d0352..853450ae93b3 100644
--- a/libmlx5/src/buf.c
+++ b/libmlx5/src/buf.c
@@ -42,25 +42,6 @@
 #include "mlx5.h"
 #include "bitmap.h"
 
-#if !(defined(HAVE_IBV_DONTFORK_RANGE) && defined(HAVE_IBV_DOFORK_RANGE))
-
-/*
- * If libibverbs isn't exporting these functions, then there's no
- * point in doing it here, because the rest of libibverbs isn't going
- * to be fork-safe anyway.
- */
-static int ibv_dontfork_range(void *base, size_t size)
-{
-	return 0;
-}
-
-static int ibv_dofork_range(void *base, size_t size)
-{
-	return 0;
-}
-
-#endif /* HAVE_IBV_DONTFORK_RANGE && HAVE_IBV_DOFORK_RANGE */
-
 static int mlx5_bitmap_init(struct mlx5_bitmap *bitmap, uint32_t num,
 			    uint32_t mask)
 {
diff --git a/libmlx5/src/mlx5.c b/libmlx5/src/mlx5.c
index 121a833062f1..f24e5043dfe6 100644
--- a/libmlx5/src/mlx5.c
+++ b/libmlx5/src/mlx5.c
@@ -42,10 +42,6 @@
 #include <sched.h>
 #include <sys/param.h>
 
-#ifndef HAVE_IBV_REGISTER_DRIVER
-#include <sysfs/libsysfs.h>
-#endif
-
 #include "mlx5.h"
 #include "mlx5-abi.h"
 
diff --git a/libmlx5/src/verbs.c b/libmlx5/src/verbs.c
index 58673f4433fd..acbabc814621 100644
--- a/libmlx5/src/verbs.c
+++ b/libmlx5/src/verbs.c
@@ -993,9 +993,7 @@ static const char *qptype2key(enum ibv_qp_type type)
 	case IBV_QPT_RC: return "HUGE_RC";
 	case IBV_QPT_UC: return "HUGE_UC";
 	case IBV_QPT_UD: return "HUGE_UD";
-#ifdef _NOT_EXISTS_IN_OFED_2_0
 	case IBV_QPT_RAW_PACKET: return "HUGE_RAW_ETH";
-#endif
 	default: return "HUGE_NA";
 	}
 }
diff --git a/libmthca/src/buf.c b/libmthca/src/buf.c
index 78e7b89c4db5..c03ee1f9a3e4 100644
--- a/libmthca/src/buf.c
+++ b/libmthca/src/buf.c
@@ -38,25 +38,6 @@
 
 #include "mthca.h"
 
-#if !(defined(HAVE_IBV_DONTFORK_RANGE) && defined(HAVE_IBV_DOFORK_RANGE))
-
-/*
- * If libibverbs isn't exporting these functions, then there's no
- * point in doing it here, because the rest of libibverbs isn't going
- * to be fork-safe anyway.
- */
-static int ibv_dontfork_range(void *base, size_t size)
-{
-	return 0;
-}
-
-static int ibv_dofork_range(void *base, size_t size)
-{
-	return 0;
-}
-
-#endif /* HAVE_IBV_DONTFORK_RANGE && HAVE_IBV_DOFORK_RANGE */
-
 int mthca_alloc_buf(struct mthca_buf *buf, size_t size, int page_size)
 {
 	int ret;
diff --git a/libmthca/src/mthca.c b/libmthca/src/mthca.c
index d6bda2d29d66..d5660ceef7e0 100644
--- a/libmthca/src/mthca.c
+++ b/libmthca/src/mthca.c
@@ -41,16 +41,6 @@
 #include <pthread.h>
 #include <string.h>
 
-#ifndef HAVE_IBV_REGISTER_DRIVER
-#include <sysfs/libsysfs.h>
-#endif
-
-#ifndef HAVE_IBV_READ_SYSFS_FILE
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
 #include "mthca.h"
 #include "mthca-abi.h"
 
@@ -224,36 +214,6 @@ static struct ibv_device_ops mthca_dev_ops = {
 	.free_context  = mthca_free_context
 };
 
-/*
- * Keep a private implementation of HAVE_IBV_READ_SYSFS_FILE to handle
- * old versions of libibverbs that didn't implement it.  This can be
- * removed when libibverbs 1.0.3 or newer is available "everywhere."
- */
-#ifndef HAVE_IBV_READ_SYSFS_FILE
-static int ibv_read_sysfs_file(const char *dir, const char *file,
-			       char *buf, size_t size)
-{
-	char path[256];
-	int fd;
-	int len;
-
-	snprintf(path, sizeof path, "%s/%s", dir, file);
-
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		return -1;
-
-	len = read(fd, buf, size);
-
-	close(fd);
-
-	if (len > 0 && buf[len - 1] == '\n')
-		buf[--len] = '\0';
-
-	return len;
-}
-#endif /* HAVE_IBV_READ_SYSFS_FILE */
-
 static struct ibv_device *mthca_driver_init(const char *uverbs_sys_path,
 					    int abi_version)
 {
@@ -300,25 +260,7 @@ found:
 	return &dev->ibv_dev;
 }
 
-#ifdef HAVE_IBV_REGISTER_DRIVER
 static __attribute__((constructor)) void mthca_register_driver(void)
 {
 	ibv_register_driver("mthca", mthca_driver_init);
 }
-#else
-/*
- * Export the old libsysfs sysfs_class_device-based driver entry point
- * if libibverbs does not export an ibv_register_driver() function.
- */
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
-{
-	int abi_ver = 0;
-	char value[8];
-
-	if (ibv_read_sysfs_file(sysdev->path, "abi_version",
-				value, sizeof value) > 0)
-		abi_ver = strtol(value, NULL, 10);
-
-	return mthca_driver_init(sysdev->path, abi_ver);
-}
-#endif /* HAVE_IBV_REGISTER_DRIVER */
diff --git a/librxe/src/rxe.c b/librxe/src/rxe.c
index 6bd04d696c41..ef7434e1d506 100644
--- a/librxe/src/rxe.c
+++ b/librxe/src/rxe.c
@@ -935,22 +935,8 @@ static struct ibv_device *rxe_driver_init(const char *uverbs_sys_path,
 	return &dev->ibv_dev;
 }
 
-#ifdef HAVE_IBV_REGISTER_DRIVER
 static __attribute__ ((constructor))
 void rxe_register_driver(void)
 {
 	ibv_register_driver("rxe", rxe_driver_init);
 }
-#else
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
-{
-	int abi_ver = 0;
-	char value[8];
-
-	if (ibv_read_sysfs_file(sysdev->path, "abi_version",
-				value, sizeof value) > 0)
-		abi_ver = strtol(value, NULL, 10);
-
-	return rxe_driver_init(sysdev->path, abi_ver);
-}
-#endif /* HAVE_IBV_REGISTER_DRIVER */
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 4/9] Do not use IBV_CMD_(REG_MR|RESIZE_CQ)_HAS_RESP_PARAMS
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Mike Marciniszyn, Dennis Dalessandro, Tatyana Nikolova,
	Yishai Hadas, Vladimir Sokolovsky, Moni Shoua,
	open list:HF1 USERSPACE PROVIDER for hf1.ko
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

These were used to support building provider plugins against old
versions of libibverbs. Since libibverbs is now included together
with the provider that is no longer possible or supported.

The define is kept as it is in a public header.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libhfi1verbs/src/verbs.c    | 15 +++------------
 libi40iw/src/i40iw_uverbs.c | 26 --------------------------
 libipathverbs/src/verbs.c   | 16 +++-------------
 libmlx5/src/verbs.c         | 18 ++++--------------
 libmthca/src/verbs.c        | 26 ++++++--------------------
 libnes/src/nes_uverbs.c     | 35 -----------------------------------
 librxe/src/rxe.c            | 16 +++-------------
 7 files changed, 19 insertions(+), 133 deletions(-)

diff --git a/libhfi1verbs/src/verbs.c b/libhfi1verbs/src/verbs.c
index 20d4352094af..06ddbb712857 100644
--- a/libhfi1verbs/src/verbs.c
+++ b/libhfi1verbs/src/verbs.c
@@ -135,24 +135,15 @@ struct ibv_mr *hfi1_reg_mr(struct ibv_pd *pd, void *addr,
 {
 	struct ibv_mr *mr;
 	struct ibv_reg_mr cmd;
+	struct ibv_reg_mr_resp resp;
 	int ret;
 
 	mr = malloc(sizeof *mr);
 	if (!mr)
 		return NULL;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
-	{
-		struct ibv_reg_mr_resp resp;
-
-		ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
-				     access, mr, &cmd, sizeof cmd,
-                                     &resp, sizeof resp);
-	}
-#else
-	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr,
-			     access, mr, &cmd, sizeof cmd);
-#endif
+	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr,
+			     &cmd, sizeof cmd, &resp, sizeof resp);
 
 	if (ret) {
 		free(mr);
diff --git a/libi40iw/src/i40iw_uverbs.c b/libi40iw/src/i40iw_uverbs.c
index 3a6799a9b50f..a117b534f533 100644
--- a/libi40iw/src/i40iw_uverbs.c
+++ b/libi40iw/src/i40iw_uverbs.c
@@ -154,9 +154,7 @@ struct ibv_mr *i40iw_ureg_mr(struct ibv_pd *pd, void *addr, size_t length, int a
 {
 	struct ibv_mr *mr;
 	struct i40iw_ureg_mr cmd;
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	struct ibv_reg_mr_resp resp;
-#endif
 
 	mr = malloc(sizeof(*mr));
 	if (!mr)
@@ -164,14 +162,9 @@ struct ibv_mr *i40iw_ureg_mr(struct ibv_pd *pd, void *addr, size_t length, int a
 
 	cmd.reg_type = I40IW_UMEMREG_TYPE_MEM;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr,
 			   access, mr, &cmd.ibv_cmd, sizeof(cmd),
 			   &resp, sizeof(resp))) {
-#else
-	if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr,
-			   access, mr, &cmd.ibv_cmd, sizeof(cmd))) {
-#endif
 		fprintf(stderr, PFX "%s: Failed to register memory\n", __func__);
 		free(mr);
 		return NULL;
@@ -226,9 +219,7 @@ struct ibv_cq *i40iw_ucreate_cq(struct ibv_context *context, int cqe,
 
 	struct i40iw_ureg_mr reg_mr_cmd;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	struct ibv_reg_mr_resp reg_mr_resp;
-#endif
 
 	if (cqe > I40IW_MAX_CQ_SIZE)
 		return NULL;
@@ -268,18 +259,10 @@ struct ibv_cq *i40iw_ucreate_cq(struct ibv_context *context, int cqe,
 
 	reg_mr_cmd.cq_pages = cq_pages;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	ret = ibv_cmd_reg_mr(&iwvctx->iwupd->ibv_pd, (void *)info.cq_base, totalsize,
 			     (uintptr_t)info.cq_base, IBV_ACCESS_LOCAL_WRITE,
 			     &iwucq->mr, &reg_mr_cmd.ibv_cmd, sizeof(reg_mr_cmd), &reg_mr_resp,
 			     sizeof(reg_mr_resp));
-#else
-	ret = ibv_cmd_reg_mr(&iwvctx->iwupd->ibv_pd, (void *)info.sq, totalsize,
-			     (uintptr_t)info.cq_base, IBV_ACCESS_LOCAL_WRITE,
-			     &iwucq->mr, &reg_mr_cmd.ibv_cmd,
-			     sizeof(reg_mr_cmd));
-#endif
-
 	if (ret) {
 		fprintf(stderr, PFX "%s: failed to pin memory for CQ\n", __func__);
 		goto err;
@@ -509,10 +492,7 @@ static int i40iw_vmapped_qp(struct i40iw_uqp *iwuqp, struct ibv_pd *pd,
 	int ret;
 	struct i40iw_ureg_mr reg_mr_cmd;
 	u32 sq_pages, rq_pages;
-
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	struct ibv_reg_mr_resp reg_mr_resp;
-#endif
 
 	memset(&reg_mr_cmd, 0, sizeof(reg_mr_cmd));
 	if ((sqdepth % I40IWQP_SW_WQSIZE_1024))
@@ -540,15 +520,9 @@ static int i40iw_vmapped_qp(struct i40iw_uqp *iwuqp, struct ibv_pd *pd,
 	reg_mr_cmd.sq_pages = sq_pages;
 	reg_mr_cmd.rq_pages = rq_pages;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	ret = ibv_cmd_reg_mr(pd, (void *)info->sq, totalqpsize, (uintptr_t)info->sq,
 			     IBV_ACCESS_LOCAL_WRITE, &iwuqp->mr, &reg_mr_cmd.ibv_cmd,
 			     sizeof(reg_mr_cmd), &reg_mr_resp, sizeof(reg_mr_resp));
-#else
-	ret = ibv_cmd_reg_mr(pd, (void *)info->sq, totalqpsize, (uintptr_t)info->sq,
-			     IBV_ACCESS_LOCAL_WRITE, &iwuqp->mr, &reg_mr_cmd.ibv_cmd,
-			     sizeof(reg_mr_cmd));
-#endif
 	if (ret) {
 		fprintf(stderr, PFX "%s: failed to pin memory for SQ\n", __func__);
 		free(info->sq);
diff --git a/libipathverbs/src/verbs.c b/libipathverbs/src/verbs.c
index 12ca35f32189..35b2162a84f0 100644
--- a/libipathverbs/src/verbs.c
+++ b/libipathverbs/src/verbs.c
@@ -115,25 +115,15 @@ struct ibv_mr *ipath_reg_mr(struct ibv_pd *pd, void *addr,
 {
 	struct ibv_mr *mr;
 	struct ibv_reg_mr cmd;
+	struct ibv_reg_mr_resp resp;
 	int ret;
 
 	mr = malloc(sizeof *mr);
 	if (!mr)
 		return NULL;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
-	{
-		struct ibv_reg_mr_resp resp;
-
-		ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
-				     access, mr, &cmd, sizeof cmd,
-                                     &resp, sizeof resp);
-	}
-#else
-	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr,
-			     access, mr, &cmd, sizeof cmd);
-#endif
-
+	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr,
+			     &cmd, sizeof cmd, &resp, sizeof resp);
 	if (ret) {
 		free(mr);
 		return NULL;
diff --git a/libmlx5/src/verbs.c b/libmlx5/src/verbs.c
index acbabc814621..ef85a63637c9 100644
--- a/libmlx5/src/verbs.c
+++ b/libmlx5/src/verbs.c
@@ -171,25 +171,15 @@ struct ibv_mr *mlx5_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 	struct ibv_reg_mr cmd;
 	int ret;
 	enum ibv_access_flags access = (enum ibv_access_flags)acc;
+	struct ibv_reg_mr_resp resp;
 
 	mr = calloc(1, sizeof(*mr));
 	if (!mr)
 		return NULL;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
-	{
-		struct ibv_reg_mr_resp resp;
-
-		ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
-				     access, &(mr->ibv_mr),
-				     &cmd, sizeof(cmd),
-				     &resp, sizeof resp);
-	}
-#else
-	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, access,
-			      &(mr->ibv_mr),
-			     &cmd, sizeof cmd);
-#endif
+	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access,
+			     &(mr->ibv_mr), &cmd, sizeof(cmd), &resp,
+			     sizeof resp);
 	if (ret) {
 		mlx5_free_buf(&(mr->buf));
 		free(mr);
diff --git a/libmthca/src/verbs.c b/libmthca/src/verbs.c
index b3bce82affae..60dd44002ea3 100644
--- a/libmthca/src/verbs.c
+++ b/libmthca/src/verbs.c
@@ -120,6 +120,7 @@ static struct ibv_mr *__mthca_reg_mr(struct ibv_pd *pd, void *addr,
 {
 	struct ibv_mr *mr;
 	struct mthca_reg_mr cmd;
+	struct ibv_reg_mr_resp resp;
 	int ret;
 
 	/*
@@ -135,17 +136,8 @@ static struct ibv_mr *__mthca_reg_mr(struct ibv_pd *pd, void *addr,
 	if (!mr)
 		return NULL;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
-	{
-		struct ibv_reg_mr_resp resp;
-
-		ret = ibv_cmd_reg_mr(pd, addr, length, hca_va, access, mr,
-				     &cmd.ibv_cmd, sizeof cmd, &resp, sizeof resp);
-	}
-#else
-	ret = ibv_cmd_reg_mr(pd, addr, length, hca_va, access, mr,
-			     &cmd.ibv_cmd, sizeof cmd);
-#endif
+	ret = ibv_cmd_reg_mr(pd, addr, length, hca_va, access, mr, &cmd.ibv_cmd,
+			     sizeof cmd, &resp, sizeof resp);
 	if (ret) {
 		free(mr);
 		return NULL;
@@ -284,6 +276,7 @@ int mthca_resize_cq(struct ibv_cq *ibcq, int cqe)
 	struct mthca_resize_cq cmd;
 	struct ibv_mr *mr;
 	struct mthca_buf buf;
+	struct ibv_resize_cq_resp resp;
 	int old_cqe;
 	int ret;
 
@@ -317,15 +310,8 @@ int mthca_resize_cq(struct ibv_cq *ibcq, int cqe)
 	old_cqe = ibcq->cqe;
 
 	cmd.lkey = mr->lkey;
-#ifdef IBV_CMD_RESIZE_CQ_HAS_RESP_PARAMS
-	{
-		struct ibv_resize_cq_resp resp;
-		ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
-					&resp, sizeof resp);
-	}
-#else
-	ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd);
-#endif
+	ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd, &resp,
+				sizeof resp);
 	if (ret) {
 		mthca_dereg_mr(mr);
 		mthca_free_buf(&buf);
diff --git a/libnes/src/nes_uverbs.c b/libnes/src/nes_uverbs.c
index 7c2454e7f55a..141f769bf14b 100644
--- a/libnes/src/nes_uverbs.c
+++ b/libnes/src/nes_uverbs.c
@@ -172,23 +172,16 @@ struct ibv_mr *nes_ureg_mr(struct ibv_pd *pd, void *addr,
 {
 	struct ibv_mr *mr;
 	struct nes_ureg_mr cmd;
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	struct ibv_reg_mr_resp resp;
-#endif
 
 	mr = malloc(sizeof *mr);
 	if (!mr)
 		return NULL;
 
 	cmd.reg_type = NES_UMEMREG_TYPE_MEM;
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
 			access, mr, &cmd.ibv_cmd, sizeof cmd,
 			&resp, sizeof resp)) {
-#else
-	if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
-			access, mr, &cmd.ibv_cmd, sizeof cmd)) {
-#endif
 		free(mr);
 
 		return NULL;
@@ -225,9 +218,7 @@ int nes_ima_ureplace_cq(struct ibv_cq *cq,
 	struct nes_ucreate_cq_resp resp;
 	int comp_vector = nesucq->comp_vector;
 	struct nes_ureg_mr reg_mr_cmd;
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	struct ibv_reg_mr_resp reg_mr_resp;
-#endif
 	struct nes_uvcontext *nesvctx = to_nes_uctx(cq->context);
 
 	ret = ibv_cmd_destroy_cq(cq);
@@ -248,20 +239,12 @@ int nes_ima_ureplace_cq(struct ibv_cq *cq,
 
 	reg_mr_cmd.reg_type = NES_UMEMREG_TYPE_CQ;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes,
 			(nesucq->size*sizeof(struct nes_hw_cqe)),
 			(uintptr_t)nesucq->cqes,
 			IBV_ACCESS_LOCAL_WRITE, &nesucq->mr,
 			&reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd,
 			&reg_mr_resp, sizeof reg_mr_resp);
-#else
-	ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes,
-			(nesucq->size*sizeof(struct nes_hw_cqe)),
-			(uintptr_t)nesucq->cqes,
-			IBV_ACCESS_LOCAL_WRITE, &nesucq->mr,
-			&reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd);
-#endif
 	if (ret) {
 		free((struct nes_hw_cqe *)nesucq->cqes);
 		goto err;
@@ -305,9 +288,7 @@ struct ibv_cq *nes_ucreate_cq(struct ibv_context *context, int cqe,
 {
 	struct nes_ucq *nesucq;
 	struct nes_ureg_mr reg_mr_cmd;
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	struct ibv_reg_mr_resp reg_mr_resp;
-#endif
 	struct nes_ucreate_cq cmd;
 	struct nes_ucreate_cq_resp resp;
 	int ret;
@@ -336,18 +317,11 @@ struct ibv_cq *nes_ucreate_cq(struct ibv_context *context, int cqe,
 	/* Register the memory for the CQ */
 	reg_mr_cmd.reg_type = NES_UMEMREG_TYPE_CQ;
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 	ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes,
 			(nesucq->size*sizeof(struct nes_hw_cqe)),
 			(uintptr_t)nesucq->cqes, IBV_ACCESS_LOCAL_WRITE, &nesucq->mr,
 			&reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd,
 			&reg_mr_resp, sizeof reg_mr_resp);
-#else
-	ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes,
-			(nesucq->size*sizeof(struct nes_hw_cqe)),
-			(uintptr_t)nesucq->cqes, IBV_ACCESS_LOCAL_WRITE, &nesucq->mr,
-			&reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd);
-#endif
 	if (ret) {
 		/* fprintf(stderr, "ibv_cmd_reg_mr failed (ret = %d).\n", ret); */
 		free((struct nes_hw_cqe *)nesucq->cqes);
@@ -1039,9 +1013,7 @@ static int nes_vmapped_qp(struct nes_uqp *nesuqp, struct ibv_pd *pd, struct ibv_
 {
 	struct nes_ucreate_qp cmd;
 	struct nes_ureg_mr reg_mr_cmd;
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
         struct ibv_reg_mr_resp reg_mr_resp;
-#endif
 	int totalqpsize;
 	int ret;
 
@@ -1060,17 +1032,10 @@ static int nes_vmapped_qp(struct nes_uqp *nesuqp, struct ibv_pd *pd, struct ibv_
 	//fprintf(stderr, PFX "qp_rq_vbase = %p qp_sq_vbase=%p reg_mr = %p\n",
 	//		nesuqp->rq_vbase, nesuqp->sq_vbase, &nesuqp->mr);
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
         ret = ibv_cmd_reg_mr(pd, (void *)nesuqp->sq_vbase,totalqpsize,
 			     (uintptr_t) nesuqp->sq_vbase, IBV_ACCESS_LOCAL_WRITE,
 			     &nesuqp->mr, &reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd,
 			     &reg_mr_resp, sizeof reg_mr_resp);
-#else
-        ret = ibv_cmd_reg_mr(pd, (void *)nesuqp->sq_vbase,totalqpsize,
-			     (uintptr_t) nesuqp->sq_vbase, IBV_ACCESS_LOCAL_WRITE,
-			     &nesuqp->mr, &reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd);
-#endif
-
         if (ret) {
                 // fprintf(stderr, PFX "%s ibv_cmd_reg_mr failed (ret = %d).\n", __FUNCTION__, ret);
 		free((void *) nesuqp->sq_vbase);
diff --git a/librxe/src/rxe.c b/librxe/src/rxe.c
index ef7434e1d506..8f8cc91052e5 100644
--- a/librxe/src/rxe.c
+++ b/librxe/src/rxe.c
@@ -127,6 +127,7 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 {
 	struct ibv_mr *mr;
 	struct ibv_reg_mr cmd;
+	struct ibv_reg_mr_resp resp;
 	int ret;
 
 	mr = malloc(sizeof *mr);
@@ -134,19 +135,8 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
 		return NULL;
 	}
 
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
-	{
-		struct ibv_reg_mr_resp resp;
-
-		ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
-				     access, mr, &cmd, sizeof cmd,
-				     &resp, sizeof resp);
-	}
-#else
-	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
-			     access, mr, &cmd, sizeof cmd);
-#endif
-
+	ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr,
+			     &cmd, sizeof cmd, &resp, sizeof resp);
 	if (ret) {
 		free(mr);
 		return NULL;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 5/9] Remove HAVE_SYMVER_SUPPORT
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Doug Ledford, Yishai Hadas
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

cmake now hard requires GNU style symbol version support in the
assembler and linker.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 buildlib/config.h.in     |  3 ---
 libibverbs/src/ibverbs.h | 11 ++---------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 3b94ea3e4f51..99103b779baf 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -9,9 +9,6 @@
 // FIXME: Remove this, we provide the netlink kernel headers ibacm needs
 #define HAVE_NETLINK 1
 
-// FIXME: Remove this, The cmake version hard-requires symbol version support
-#define HAVE_SYMVER_SUPPORT 1
-
 // FIXME: Remove this, The cmake version hard-requires new style CLOEXEC support
 #define STREAM_CLOEXEC "e"
 
diff --git a/libibverbs/src/ibverbs.h b/libibverbs/src/ibverbs.h
index 7892af4ad247..a01dff2b4638 100644
--- a/libibverbs/src/ibverbs.h
+++ b/libibverbs/src/ibverbs.h
@@ -47,16 +47,9 @@
 
 #define DEFAULT_ABI	"IBVERBS_1.1"
 
-#ifdef HAVE_SYMVER_SUPPORT
-#  define symver(name, api, ver) \
-	asm(".symver " #name "," #api "@" #ver)
-#  define default_symver(name, api) \
+#define symver(name, api, ver) asm(".symver " #name "," #api "@" #ver)
+#define default_symver(name, api)                                              \
 	asm(".symver " #name "," #api "@@" DEFAULT_ABI)
-#else
-#  define symver(name, api, ver)
-#  define default_symver(name, api) \
-	extern __typeof(name) api __attribute__((alias(#name)))
-#endif /* HAVE_SYMVER_SUPPORT */
 
 #define PFX		"libibverbs: "
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 6/9] Remove old compat definitions of wmb/rmb/etc
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Yishai Hadas, Vladimir Sokolovsky
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

The canonical place for these is infiniband/arch.h, nothing else
should declare them.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libmlx4/src/mlx4.h   | 24 ------------------------
 libmlx5/src/mlx5.h   | 22 ----------------------
 libmthca/src/mthca.h |  8 --------
 3 files changed, 54 deletions(-)

diff --git a/libmlx4/src/mlx4.h b/libmlx4/src/mlx4.h
index 4551141d2007..1855cfbcbe48 100644
--- a/libmlx4/src/mlx4.h
+++ b/libmlx4/src/mlx4.h
@@ -49,30 +49,6 @@
 
 #include <valgrind/memcheck.h>
 
-#ifndef rmb
-#  define rmb() mb()
-#endif
-
-#ifndef wmb
-#  define wmb() mb()
-#endif
-
-#ifndef wc_wmb
-
-#if defined(__i386__)
-#define wc_wmb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory")
-#elif defined(__x86_64__)
-#define wc_wmb() asm volatile("sfence" ::: "memory")
-#elif defined(__ia64__)
-#define wc_wmb() asm volatile("fwb" ::: "memory")
-#elif defined(__s390x__)
-#define wc_wmb { asm volatile("" : : : "memory") }
-#else
-#define wc_wmb() wmb()
-#endif
-
-#endif
-
 #define HIDDEN		__attribute__((visibility ("hidden")))
 
 #define PFX		"mlx4: "
diff --git a/libmlx5/src/mlx5.h b/libmlx5/src/mlx5.h
index aa8b6feceb4e..c209a7964768 100644
--- a/libmlx5/src/mlx5.h
+++ b/libmlx5/src/mlx5.h
@@ -54,28 +54,6 @@
 
 #include <valgrind/memcheck.h>
 
-#ifndef rmb
-#  define rmb() mb()
-#endif
-
-#ifndef wmb
-#  define wmb() mb()
-#endif
-
-#ifndef wc_wmb
-
-#if defined(__i386__)
-#define wc_wmb() asm volatile("lock; addl $0, 0(%%esp) " ::: "memory")
-#elif defined(__x86_64__)
-#define wc_wmb() asm volatile("sfence" ::: "memory")
-#elif defined(__ia64__)
-#define wc_wmb() asm volatile("fwb" ::: "memory")
-#else
-#define wc_wmb() wmb()
-#endif
-
-#endif
-
 #define HIDDEN		__attribute__((visibility("hidden")))
 
 #ifdef HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE
diff --git a/libmthca/src/mthca.h b/libmthca/src/mthca.h
index 18d52291343f..da53010cec69 100644
--- a/libmthca/src/mthca.h
+++ b/libmthca/src/mthca.h
@@ -41,14 +41,6 @@
 
 #include <valgrind/memcheck.h>
 
-#ifndef rmb
-#  define rmb() mb()
-#endif
-
-#ifndef wmb
-#  define wmb() mb()
-#endif
-
 #define HIDDEN		__attribute__((visibility ("hidden")))
 
 #define PFX		"mthca: "
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 7/9] Remove old MADV_DONTFORK/DOFORK compat
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Doug Ledford, Yishai Hadas
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

All supported distros have this now.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibverbs/src/memory.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/libibverbs/src/memory.c b/libibverbs/src/memory.c
index 8e728c4f61fc..5c8255d47c15 100644
--- a/libibverbs/src/memory.c
+++ b/libibverbs/src/memory.c
@@ -46,17 +46,6 @@
 
 #include "ibverbs.h"
 
-/*
- * Most distro's headers don't have these yet.
- */
-#ifndef MADV_DONTFORK
-#define MADV_DONTFORK	10
-#endif
-
-#ifndef MADV_DOFORK
-#define MADV_DOFORK	11
-#endif
-
 struct ibv_mem_node {
 	enum {
 		IBV_RED,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 8/9] Remove most checks of __BYTE_ORDER
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Steve Wise, Tatyana Nikolova, Hal Rosenstock, Doug Ledford,
	Yishai Hadas, Devesh Sharma, Sean Hefty, Bart Van Assche
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

For a long time now endian.h has defined sane fixed with conversion
macros, so lets just use them instead of rolling our own.

Also, htonll is defined in this source tree under infiniband/arch.h,
so all users of that macro can just use the header.

Someday we should also get rid of all the endless wrappers..

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 ibacm/linux/osd.h                    |  8 +-------
 libcxgb3/src/cxio_wr.h               | 10 +++-------
 libcxgb4/src/t4.h                    | 11 ++++-------
 libi40iw/src/i40iw_umain.h           | 18 ++----------------
 libibumad/src/sysfs.c                |  8 +-------
 libibverbs/include/infiniband/arch.h | 15 ++++++---------
 libnes/src/nes_umain.h               | 17 ++---------------
 libocrdma/src/ocrdma_verbs.c         | 32 ++++----------------------------
 librdmacm/examples/common.h          | 11 +++--------
 librdmacm/src/cma.h                  |  9 +--------
 srp_daemon/srp_daemon/srp_daemon.h   | 17 +----------------
 11 files changed, 28 insertions(+), 128 deletions(-)

diff --git a/ibacm/linux/osd.h b/ibacm/linux/osd.h
index 2c4db81b9e8e..c1e7d996c371 100644
--- a/ibacm/linux/osd.h
+++ b/ibacm/linux/osd.h
@@ -46,6 +46,7 @@
 #include <arpa/inet.h>
 #include <sys/time.h>
 #include <netinet/in.h>
+#include <infiniband/arch.h>
 
 #include <ccan/minmax.h>
 
@@ -55,13 +56,6 @@
 #define LIB_DESTRUCTOR __attribute__((destructor))
 #define CDECL_FUNC
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x) bswap_64(x)
-#else
-#define htonll(x) (x)
-#endif
-#define ntohll(x) htonll(x)
-
 #if DEFINE_ATOMICS
 typedef struct { pthread_mutex_t mut; int val; } atomic_t;
 static inline int atomic_inc(atomic_t *atomic)
diff --git a/libcxgb3/src/cxio_wr.h b/libcxgb3/src/cxio_wr.h
index ece06bd0568c..e24c7fed7d76 100644
--- a/libcxgb3/src/cxio_wr.h
+++ b/libcxgb3/src/cxio_wr.h
@@ -50,13 +50,9 @@
 #define Q_COUNT(rptr,wptr) ((wptr)-(rptr))
 #define Q_PTR2IDX(ptr,size_log2) (ptr & ((1UL<<size_log2)-1))
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define cpu_to_pci32(val) ((val))
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#  define cpu_to_pci32(val) (__bswap_32((val)))
-#else
-#  error __BYTE_ORDER not defined
-#endif
+/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
+   probably wrong */
+#define cpu_to_pci32(val) htole32(val)
 
 #define RING_DOORBELL(doorbell, QPID) { \
 	*doorbell = cpu_to_pci32(QPID); \
diff --git a/libcxgb4/src/t4.h b/libcxgb4/src/t4.h
index e8c5cf66cb14..e519cc4087e6 100644
--- a/libcxgb4/src/t4.h
+++ b/libcxgb4/src/t4.h
@@ -62,13 +62,10 @@
 #define unlikely
 #define ROUND_UP(x, n) (((x) + (n) - 1u) & ~((n) - 1u))
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#  define cpu_to_pci32(val) ((val))
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#  define cpu_to_pci32(val) (__bswap_32((val)))
-#else
-#  error __BYTE_ORDER not defined
-#endif
+
+/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
+   probably wrong */
+#define cpu_to_pci32(val) htole32(val)
 
 #define writel(v, a) do { *((volatile u32 *)(a)) = cpu_to_pci32(v); } while (0)
 
diff --git a/libi40iw/src/i40iw_umain.h b/libi40iw/src/i40iw_umain.h
index 39b54ba29dcb..13d3da89eba9 100644
--- a/libi40iw/src/i40iw_umain.h
+++ b/libi40iw/src/i40iw_umain.h
@@ -195,28 +195,14 @@ int i40iw_uattach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t);
 int i40iw_udetach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t);
 void i40iw_async_event(struct ibv_async_event *event);
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
 static inline uint32_t cpu_to_le32(uint32_t x)
 {
-	return x;
+	return htole32(x);
 }
 
 static inline uint32_t le32_to_cpu(uint32_t x)
 {
-	return x;
+	return le32toh(x);
 }
-#else
-static inline uint32_t cpu_to_le32(uint32_t x)
-{
-	return ((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) |
-	    ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24);
-}
-
-static inline uint32_t le32_to_cpu(uint32_t x)
-{
-	return ((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) |
-	    ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24);
-}
-#endif
 
 #endif /* i40iw_umain_H */
diff --git a/libibumad/src/sysfs.c b/libibumad/src/sysfs.c
index d10f312285ea..011e411f0951 100644
--- a/libibumad/src/sysfs.c
+++ b/libibumad/src/sysfs.c
@@ -41,15 +41,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <endian.h>
 #include <byteswap.h>
 #include <netinet/in.h>
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x) bswap_64(x)
-#else
-#define htonll(x) (x)
-#endif
+#include <infiniband/arch.h>
 
 static int ret_code(void)
 {
diff --git a/libibverbs/include/infiniband/arch.h b/libibverbs/include/infiniband/arch.h
index e35ecf05bceb..bf0feec08d73 100644
--- a/libibverbs/include/infiniband/arch.h
+++ b/libibverbs/include/infiniband/arch.h
@@ -37,15 +37,12 @@
 #include <endian.h>
 #include <byteswap.h>
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline uint64_t htonll(uint64_t x) { return bswap_64(x); }
-static inline uint64_t ntohll(uint64_t x) { return bswap_64(x); }
-#elif __BYTE_ORDER == __BIG_ENDIAN
-static inline uint64_t htonll(uint64_t x) { return x; }
-static inline uint64_t ntohll(uint64_t x) { return x; }
-#else
-#error __BYTE_ORDER is neither __LITTLE_ENDIAN nor __BIG_ENDIAN
-#endif
+#undef htonll
+#undef ntohll
+static inline uint64_t htonll(uint64_t x) { return htobe64(x); }
+static inline uint64_t ntohll(uint64_t x) { return be64toh(x); }
+#define htonll htonll
+#define ntohll ntohll
 
 /*
  * Architecture-specific defines.  Currently, an architecture is
diff --git a/libnes/src/nes_umain.h b/libnes/src/nes_umain.h
index c53acd7e90fe..91299823e675 100644
--- a/libnes/src/nes_umain.h
+++ b/libnes/src/nes_umain.h
@@ -393,26 +393,13 @@ int nes_uattach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t);
 int nes_udetach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t);
 void nes_async_event(struct ibv_async_event *event);
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
 static inline uint32_t cpu_to_le32(uint32_t x)
 {
-	return x;
+	return htole32(x);
 }
 static inline uint32_t le32_to_cpu(uint32_t x)
 {
-	return x;
+	return le32toh(x);
 }
-#else
-static inline uint32_t cpu_to_le32(uint32_t x)
-{
-	return (((x&0xFF000000)>>24) | ((x&0x00FF0000)>>8) |
-			((x&0x0000FF00)<<8) | ((x&0x000000FF)<<24));
-}
-static inline uint32_t le32_to_cpu(uint32_t x)
-{
-	return (((x&0xFF000000)>>24) | ((x&0x00FF0000)>>8) |
-			((x&0x0000FF00)<<8) | ((x&0x000000FF)<<24));
-}
-#endif
 
 #endif				/* nes_umain_H */
diff --git a/libocrdma/src/ocrdma_verbs.c b/libocrdma/src/ocrdma_verbs.c
index 6d58cb219fe1..163bf23f8914 100644
--- a/libocrdma/src/ocrdma_verbs.c
+++ b/libocrdma/src/ocrdma_verbs.c
@@ -46,6 +46,7 @@
 #include <sys/mman.h>
 #include <netinet/in.h>
 #include <unistd.h>
+#include <endian.h>
 
 #include "ocrdma_main.h"
 #include "ocrdma_abi.h"
@@ -54,48 +55,23 @@
 static void ocrdma_ring_cq_db(struct ocrdma_cq *cq, uint32_t armed,
 			      int solicited, uint32_t num_cqe);
 
-static inline uint32_t ocrdma_swap_endianness(uint32_t val)
-{
-	return ((val & 0xFF000000) >> 24) | ((val & 0xFF) << 24) |
-	    ((val & 0xFF00) << 8) | ((val & 0xFF0000) >> 8);
-}
-
 static inline uint32_t ocrdma_cpu_to_le(uint32_t val)
 {
-#if __BYTE_ORDER == __BIG_ENDIAN
-	return ocrdma_swap_endianness(val);
-#else
-	return val;
-#endif
+	return htole32(val);
 }
 
 static inline uint32_t ocrdma_le_to_cpu(uint32_t val)
 {
-#if __BYTE_ORDER == __BIG_ENDIAN
-	return ocrdma_swap_endianness(val);
-#else
-	return val;
-#endif
-}
-
-static inline uint32_t ocrdma_cpu_to_be(uint32_t val)
-{
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-	return ocrdma_swap_endianness(val);
-#else
-	return val;
-#endif
+	return le32toh(val);
 }
 
 static inline void ocrdma_swap_cpu_to_le(void *dst, uint32_t len)
 {
-#if __BYTE_ORDER == __BIG_ENDIAN
 	int i = 0;
 	uint32_t *src_ptr = dst;
 	uint32_t *dst_ptr = dst;
 	for (; i < (len / 4); i++)
-		*dst_ptr++ = ocrdma_swap_endianness(*src_ptr++);
-#endif
+		*dst_ptr++ = le32toh(*src_ptr++);
 }
 
 /*
diff --git a/librdmacm/examples/common.h b/librdmacm/examples/common.h
index f7511f039697..ac2d160b0044 100644
--- a/librdmacm/examples/common.h
+++ b/librdmacm/examples/common.h
@@ -34,20 +34,15 @@
 
 #include <stdlib.h>
 #include <sys/types.h>
-#include <byteswap.h>
+#include <endian.h>
 #include <poll.h>
 
 #include <rdma/rdma_cma.h>
 #include <rdma/rsocket.h>
 #include <infiniband/ib.h>
 
-#if __BYTE_ORDER == __BIG_ENDIAN
-static inline uint64_t cpu_to_be64(uint64_t x) { return x; }
-static inline uint32_t cpu_to_be32(uint32_t x) { return x; }
-#else
-static inline uint64_t cpu_to_be64(uint64_t x) { return bswap_64(x); }
-static inline uint32_t cpu_to_be32(uint32_t x) { return bswap_32(x); }
-#endif
+static inline uint64_t cpu_to_be64(uint64_t x) { return htobe64(x); }
+static inline uint32_t cpu_to_be32(uint32_t x) { return htobe32(x); }
 
 extern int use_rs;
 
diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h
index 16a55a67af9e..c2f603d6f439 100644
--- a/librdmacm/src/cma.h
+++ b/librdmacm/src/cma.h
@@ -44,6 +44,7 @@
 
 #include <rdma/rdma_cma.h>
 #include <infiniband/ib.h>
+#include <infiniband/arch.h>
 
 #include <ccan/minmax.h>
 
@@ -51,14 +52,6 @@
 
 #define PFX "librdmacm: "
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline uint64_t htonll(uint64_t x) { return bswap_64(x); }
-static inline uint64_t ntohll(uint64_t x) { return bswap_64(x); }
-#else
-static inline uint64_t htonll(uint64_t x) { return x; }
-static inline uint64_t ntohll(uint64_t x) { return x; }
-#endif
-
 /*
  * Fast synchronization for low contention locking.
  */
diff --git a/srp_daemon/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon/srp_daemon.h
index d6a2d8a84728..5d42d51e6d1c 100644
--- a/srp_daemon/srp_daemon/srp_daemon.h
+++ b/srp_daemon/srp_daemon/srp_daemon.h
@@ -42,26 +42,11 @@
 #include <byteswap.h>
 #include <infiniband/verbs.h>
 #include <infiniband/umad.h>
+#include <infiniband/arch.h>
 
 #include "config.h"
 #include "srp_ib_types.h"
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#ifndef htonll
-#define htonll(x) bswap_64(x)
-#endif
-#ifndef ntohll
-#define ntohll(x) bswap_64(x)
-#endif
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#ifndef htonll
-#define htonll(x) (x)
-#endif
-#ifndef ntohll
-#define ntohll(x) (x)
-#endif
-#endif
-
 #ifdef __cplusplus
 template <bool b> struct vki_static_assert { int m_bitfield:(2*b-1); };
 #define STATIC_ASSERT(expr) \
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 9/9] nes: Remove code guarded by HAVE_DECL_IBV_QPT_RAW_ETH
From: Jason Gunthorpe @ 2016-09-29 20:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Tatyana Nikolova
In-Reply-To: <1475182076-5411-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

Unclear what this was ever for, but we don't support it.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libnes/src/nes_uverbs.c | 322 ------------------------------------------------
 1 file changed, 322 deletions(-)

diff --git a/libnes/src/nes_uverbs.c b/libnes/src/nes_uverbs.c
index 141f769bf14b..aa9c2b9e2b8c 100644
--- a/libnes/src/nes_uverbs.c
+++ b/libnes/src/nes_uverbs.c
@@ -206,80 +206,6 @@ int nes_udereg_mr(struct ibv_mr *mr)
 	return 0;
 }
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-static
-int nes_ima_ureplace_cq(struct ibv_cq *cq,
-			int mcrqf,
-			struct nes_uqp *nesuqp)
-{
-	struct nes_ucq *nesucq = to_nes_ucq(cq);
-	int ret;
-	struct nes_ucreate_cq cmd;
-	struct nes_ucreate_cq_resp resp;
-	int comp_vector = nesucq->comp_vector;
-	struct nes_ureg_mr reg_mr_cmd;
-	struct ibv_reg_mr_resp reg_mr_resp;
-	struct nes_uvcontext *nesvctx = to_nes_uctx(cq->context);
-
-	ret = ibv_cmd_destroy_cq(cq);
-	nes_debug(NES_DBG_UD, "%s(%d) mcrqf=%d ret=%d\n",
-			__func__,
-			__LINE__,
-			mcrqf,
-			ret);
-	if (ret)
-		return ret;
-
-	ret = ibv_cmd_dereg_mr(&nesucq->mr);
-	if (ret) {
-		fprintf(stderr, PFX "%s: Failed to deregister"
-			" CQ Memory Region.\n", __func__);
-		return ret;
-	}
-
-	reg_mr_cmd.reg_type = NES_UMEMREG_TYPE_CQ;
-
-	ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes,
-			(nesucq->size*sizeof(struct nes_hw_cqe)),
-			(uintptr_t)nesucq->cqes,
-			IBV_ACCESS_LOCAL_WRITE, &nesucq->mr,
-			&reg_mr_cmd.ibv_cmd, sizeof reg_mr_cmd,
-			&reg_mr_resp, sizeof reg_mr_resp);
-	if (ret) {
-		free((struct nes_hw_cqe *)nesucq->cqes);
-		goto err;
-	}
-
-
-	/* Create the CQ */
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.user_cq_buffer = (__u64)((uintptr_t)nesucq->cqes);
-	cmd.mcrqf = mcrqf | 0x20000000;    /* IMA specific sq number */
-
-	nes_debug(NES_DBG_UD, "%s(%d) mcrqf=%d\n",
-			__func__, __LINE__,
-			mcrqf);
-	ret = ibv_cmd_create_cq(cq->context,
-			nesucq->size-1,
-			cq->channel,
-			comp_vector,
-			&nesucq->ibv_cq, &cmd.ibv_cmd, sizeof cmd,
-			&resp.ibv_resp, sizeof resp);
-	if (ret)
-		goto err;
-
-	nesucq->cq_id = (uint16_t)resp.cq_id;
-	nesucq->udqp = nesuqp;
-	nes_debug(NES_DBG_UD, "%s(%d) cqid=%d mcrqf=%d\n",
-			__func__, __LINE__,
-			nesucq->cq_id, mcrqf);
-
-	return 0;
- err:
-	return ret;
-}
-#endif
-
 /**
  * nes_ucreate_cq
  */
@@ -1103,15 +1029,6 @@ struct ibv_qp *nes_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
 
 	/* fprintf(stderr, PFX "%s\n", __FUNCTION__); */
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-	if (attr->qp_type == IBV_QPT_RAW_ETH) {
-		attr->cap.max_send_sge = NES_UD_MAX_SG_LIST_SZ;
-		attr->cap.max_recv_sge = NES_UD_MAX_SG_LIST_SZ;
-		nes_debug(NES_DBG_UD, "%s(%d) patching max_sge for UD\n",
-				__func__, __LINE__);
-	}
-#endif
-
 	/* Sanity check QP size before proceeding */
 	sqdepth = nes_qp_get_qdepth(attr->cap.max_send_wr, attr->cap.max_send_sge);
 	if (!sqdepth) {
@@ -1168,58 +1085,6 @@ struct ibv_qp *nes_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr)
 	nesuqp->ibv_qp.qp_num = resp.qp_id;
 	nesuqp->rdma0_msg = 1;
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-	if (attr->qp_type == IBV_QPT_RAW_ETH) {
-		int i = 0;
-
-		nesuqp->nes_ud_sksq_fd = open("/dev/infiniband/nes_ud_sksq",
-						O_RDWR);
-		if (nesuqp->nes_ud_sksq_fd <= 0)
-			return 0;
-		nesuqp->sksq_shared_ctxt = mmap(NULL, 4096,
-					PROT_WRITE | PROT_READ,
-					MAP_SHARED,
-					nesuqp->nes_ud_sksq_fd, 0);
-		if (nesuqp->sksq_shared_ctxt == 0)
-			return 0;
-
-		/* no LSMM for UD */
-		nesuqp->sq_head = 0;
-		nesuqp->sq_tail = 0;
-		nes_debug(NES_DBG_UD, "%s(%d) qpid=0x%x\n",
-			__func__, __LINE__, nesuqp->qp_id);
-
-		/* reallocate CQs after QP is created */
-		if (nes_ima_ureplace_cq(attr->recv_cq,
-					resp.qp_id & 0xffff,
-					nesuqp) != 0)
-			return NULL;
-
-		if (nes_ima_ureplace_cq(attr->send_cq,
-					resp.qp_id >> 16,
-					nesuqp) != 0)
-			return NULL;
-
-		/* allocate N+1, last one would be used for NULL */
-		nesuqp->pend_rx_wr = malloc(NES_UD_RX_BATCH_SZ *
-						sizeof *nesuqp->pend_rx_wr);
-		if (!nesuqp)
-			exit(0);
-
-		for (i = 0; i < NES_UD_RX_BATCH_SZ; i++) {
-			nesuqp->pend_rx_wr[i].sg_list =
-				malloc(NES_UD_MAX_SG_LIST_SZ *
-					sizeof *nesuqp->pend_rx_wr[i].sg_list);
-			nesuqp->pend_rx_wr[i].next =
-					(i < NES_UD_RX_BATCH_SZ-1) ?
-						&nesuqp->pend_rx_wr[i+1] : 0;
-		}
-		/* prepare the wr_id tables */
-		memset(&nesuqp->send_wr_id[0], 0, sizeof(uint64_t) * 512);
-		memset(&nesuqp->recv_wr_id[0], 0, sizeof(uint64_t) * 512);
-	}
-#endif
-
 	return &nesuqp->ibv_qp;
 }
 
@@ -1311,27 +1176,6 @@ int nes_udestroy_qp(struct ibv_qp *qp)
 
 	pthread_spin_destroy(&nesuqp->lock);
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-	if (qp->qp_type == IBV_QPT_RAW_ETH) {
-		int i = 0;
-
-		if (nesuqp->pend_rx_wr) {
-			for (i = 0; i < NES_UD_RX_BATCH_SZ; i++)
-				if (nesuqp->pend_rx_wr[i].sg_list) {
-					free(nesuqp->pend_rx_wr[i].sg_list);
-					nesuqp->pend_rx_wr[i].sg_list  = 0;
-				}
-		}
-		free(nesuqp->pend_rx_wr);
-		nesuqp->pend_rx_wr = 0;
-		if (nesuqp->sksq_shared_ctxt)
-			munmap(nesuqp->sksq_shared_ctxt, 4096);
-
-		nesuqp->sksq_shared_ctxt = 0;
-		close(nesuqp->nes_ud_sksq_fd);
-	}
-#endif
-
 	/* Clean any pending completions from the cq(s) */
 	if (nesuqp->send_cq)
 		nes_clean_cq(nesuqp, nesuqp->send_cq);
@@ -1343,85 +1187,6 @@ int nes_udestroy_qp(struct ibv_qp *qp)
 	return 0;
 }
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-static inline
-int nes_ima_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr,
-		struct ibv_send_wr **bad_wr)
-{
-	struct nes_uqp *nesuqp = to_nes_uqp(ib_qp);
-	int new_req_cnt = 0;
-	uint32_t outstanding_wqes;
-	uint32_t qsize = nesuqp->sq_size;
-	int ret = 0;
-	struct ibv_send_wr *tmp_wr = ib_wr;
-	struct nes_ud_send_wr *nes_ud_wr = 0;
-	int bc = 0;
-	int sq_head;
-	int wr_id_head;
-
-	while (tmp_wr) {
-		new_req_cnt++;
-		tmp_wr = tmp_wr->next;
-	}
-	if (nesuqp->sq_head >= nesuqp->sq_tail)
-		outstanding_wqes = nesuqp->sq_head - nesuqp->sq_tail;
-	else
-		outstanding_wqes = nesuqp->sq_head + qsize - nesuqp->sq_tail;
-
-	if (unlikely(outstanding_wqes >= (qsize - new_req_cnt)))
-		return -EINVAL;
-
-	/* we know that there is sufficient space in the send queue */
-	/* so we can store wr_id in the wr_id queue */
-	sq_head = nesuqp->sq_head;
-
-	if (sq_head + new_req_cnt >= qsize)
-		nesuqp->sq_head = sq_head + new_req_cnt - qsize;
-	else
-		nesuqp->sq_head = sq_head + new_req_cnt;
-
-	nes_ud_wr = (struct nes_ud_send_wr *)nesuqp->sksq_shared_ctxt;
-	bc = 0;
-
-	/* set up the qp id in the shared page message */
-	nes_ud_wr->qpn = nesuqp->qp_id;
-
-	while (ib_wr) {
-		nes_ud_wr->sg_list[bc].addr = ib_wr->sg_list[0].addr;
-		nes_ud_wr->sg_list[bc].length = ib_wr->sg_list[0].length;
-		nes_ud_wr->sg_list[bc].lkey = ib_wr->sg_list[0].lkey;
-		nes_ud_wr->flags = ib_wr->send_flags;
-		nes_ud_wr->flags = nes_ud_wr->flags | (ib_wr->imm_data << 16);
-		/* store the wr_id in the internal queue */
-		/* the queue is in sync with the queue in kernel */
-		/* the wr_id will be read in poll_cq */
-		wr_id_head = bc + sq_head;
-		if (wr_id_head > (qsize - 1))
-			wr_id_head = wr_id_head - qsize;
-
-		nesuqp->send_wr_id[wr_id_head] = ib_wr->wr_id;
-		if (++bc >= 64) {
-			nes_ud_wr->wr_cnt = bc;
-			ret = write(nesuqp->nes_ud_sksq_fd, 0, 0);
-			if (ret != 0)
-				goto out;
-			nes_ud_wr =
-			(struct nes_ud_send_wr *)nesuqp->sksq_shared_ctxt;
-			bc = 0;
-		}
-		ib_wr = ib_wr->next;
-	}
-	if (bc > 0) {
-		nes_ud_wr->wr_cnt = bc;
-		ret = write(nesuqp->nes_ud_sksq_fd, 0, 0);
-		if (ret != 0)
-			goto out;
-	}
-out:
-	return ret;
-}
-#endif
-
 /**
  * nes_upost_send
  */
@@ -1441,11 +1206,6 @@ int nes_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr,
 	uint32_t total_payload_length = 0;
 	int sge_index;
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-	if (ib_qp->qp_type == IBV_QPT_RAW_ETH)
-		return nes_ima_upost_send(ib_qp, ib_wr, bad_wr);
-#endif
-
 	pthread_spin_lock(&nesuqp->lock);
 
 	head = nesuqp->sq_head;
@@ -1617,83 +1377,6 @@ int nes_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr,
 	return err;
 }
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-static inline
-int nes_ima_upost_recv(struct ibv_qp *ib_qp, struct ibv_recv_wr *ib_wr,
-		struct ibv_recv_wr **bad_wr)
-{
-	struct nes_uqp *nesuqp = to_nes_uqp(ib_qp);
-	int new_req_cnt = 0;
-	uint32_t outstanding_wqes;
-	uint32_t qsize = nesuqp->rq_size;
-	struct ibv_send_wr *tmp_wr = (struct ibv_send_wr *)ib_wr;
-	int ret = 0;
-	struct nes_ud_recv_wr *nes_ud_wr;
-	int rq_head;
-	int bc;
-	int wr_id_head;
-
-	nes_ud_wr = (struct nes_ud_recv_wr *)
-				(((char *)nesuqp->sksq_shared_ctxt) + 2048);
-	while (tmp_wr) {
-		new_req_cnt++;
-		tmp_wr = tmp_wr->next;
-	}
-
-	if (nesuqp->rq_head >= nesuqp->rq_tail)
-		outstanding_wqes = nesuqp->rq_head - nesuqp->rq_tail;
-	else
-		outstanding_wqes = nesuqp->rq_head + qsize - nesuqp->rq_tail;
-
-	if (unlikely(outstanding_wqes >= (qsize - new_req_cnt)))
-		return -EINVAL;
-
-	/* now we know thay the rq has sufficient
-	   place so we can start wr_id storing */
-	rq_head = nesuqp->rq_head;
-
-	if (rq_head + new_req_cnt >= qsize)
-		nesuqp->rq_head = rq_head + new_req_cnt - qsize;
-	else
-		nesuqp->rq_head = rq_head + new_req_cnt;
-
-	/* set the queue number in the shared page */
-	nes_ud_wr->qpn = nesuqp->qp_id;
-	bc = 0;
-	while (ib_wr) {
-		if (ib_wr->num_sge > NES_UD_MAX_SG_LIST_SZ)
-			return -EINVAL;
-
-		nes_ud_wr->sg_list[nesuqp->pending_rcvs].addr =
-						ib_wr->sg_list[0].addr;
-		nes_ud_wr->sg_list[nesuqp->pending_rcvs].length =
-						ib_wr->sg_list[0].length;
-		nes_ud_wr->sg_list[nesuqp->pending_rcvs].lkey =
-						ib_wr->sg_list[0].lkey;
-
-		/* store the wr_id */
-		wr_id_head = bc + rq_head;
-		if (wr_id_head > (qsize - 1))
-			wr_id_head = wr_id_head - qsize;
-
-		nesuqp->recv_wr_id[wr_id_head] = ib_wr->wr_id;
-		bc++;
-
-		++nesuqp->pending_rcvs;
-		if (nesuqp->pending_rcvs >= NES_UD_RX_BATCH_SZ) {
-			nes_ud_wr->wr_cnt = nesuqp->pending_rcvs;
-			ret = read(nesuqp->nes_ud_sksq_fd, 0, 0);
-			if (ret != 0)
-				goto out;
-			nesuqp->pending_rcvs = 0;
-		}
-		ib_wr = ib_wr->next;
-	}
-out:
-	return ret;
-}
-#endif
-
 /**
  * nes_upost_recv
  */
@@ -1713,11 +1396,6 @@ int nes_upost_recv(struct ibv_qp *ib_qp, struct ibv_recv_wr *ib_wr,
 	uint32_t total_payload_length;
 	int sge_index;
 
-#if HAVE_DECL_IBV_QPT_RAW_ETH
-	if (ib_qp->qp_type == IBV_QPT_RAW_ETH)
-		return nes_ima_upost_recv(ib_qp, ib_wr, bad_wr);
-#endif
-
 	if (unlikely(ib_wr->num_sge > 4)) {
 		*bad_wr = ib_wr;
 		return -EINVAL;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* Re: [PATCH 2/9] Remove HAVE_VALGRIND_MEMCHECK_H/INCLUDE_VALGRIND
From: Bart Van Assche @ 2016-09-29 21:01 UTC (permalink / raw)
  To: Jason Gunthorpe, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Sean Hefty, Hal Rosenstock, Doug Ledford, Yishai Hadas,
	Vladimir Sokolovsky
In-Reply-To: <1475182076-5411-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

On 09/29/2016 01:47 PM, Jason Gunthorpe wrote:
> The cmake build system guarantees that valgrind/memcheck.h is present.
> If the system does not have it, or valgrind is disabled, then it is
> replaced with a dummy header full of empty stubs.

Independent of this patch: Valgrind has a stable ABI so I propose to add 
a copy of the memcheck.h header file to the rdma-core source tree. Many 
other open source projects already do this.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* RE: [PATCH 1/9] Remove HAVE_CONFIG_H
From: Steve Wise @ 2016-09-29 21:22 UTC (permalink / raw)
  To: 'Jason Gunthorpe', linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: 'Mike Marciniszyn', 'Dennis Dalessandro',
	'Tatyana Nikolova', 'Sean Hefty',
	'Hal Rosenstock', 'Doug Ledford',
	'Yishai Hadas', 'Vladimir Sokolovsky',
	'Devesh Sharma', 'Moni Shoua',
	'open list:HF1 USERSPACE PROVIDER (for hf1.ko)'
In-Reply-To: <1475182076-5411-2-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

> Subject: [PATCH 1/9] Remove HAVE_CONFIG_H
> 
> The cmake build system guarantees this header exists, we do not need
> the define or the test.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ---

<snip>

>  libcxgb3/src/cq.c                   | 4 +---
>  libcxgb3/src/iwch.c                 | 4 +---
>  libcxgb3/src/qp.c                   | 4 +---
>  libcxgb3/src/verbs.c                | 4 +---
>  libcxgb4/src/cq.c                   | 4 +---
>  libcxgb4/src/dev.c                  | 4 +---
>  libcxgb4/src/qp.c                   | 4 +---
>  libcxgb4/src/verbs.c                | 4 +---

For the above changes:

Acked-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* RE: [PATCH 8/9] Remove most checks of __BYTE_ORDER
From: Steve Wise @ 2016-09-29 21:26 UTC (permalink / raw)
  To: 'Jason Gunthorpe', linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: 'Tatyana Nikolova', 'Hal Rosenstock',
	'Doug Ledford', 'Yishai Hadas',
	'Devesh Sharma', 'Sean Hefty',
	'Bart Van Assche'
In-Reply-To: <1475182076-5411-9-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

> For a long time now endian.h has defined sane fixed with conversion
> macros, so lets just use them instead of rolling our own.
> 
> Also, htonll is defined in this source tree under infiniband/arch.h,
> so all users of that macro can just use the header.
> 
> Someday we should also get rid of all the endless wrappers..
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ---
>  ibacm/linux/osd.h                    |  8 +-------
>  libcxgb3/src/cxio_wr.h               | 10 +++-------
>  libcxgb4/src/t4.h                    | 11 ++++-------
>  libi40iw/src/i40iw_umain.h           | 18 ++----------------
>  libibumad/src/sysfs.c                |  8 +-------
>  libibverbs/include/infiniband/arch.h | 15 ++++++---------
>  libnes/src/nes_umain.h               | 17 ++---------------
>  libocrdma/src/ocrdma_verbs.c         | 32 ++++----------------------------
>  librdmacm/examples/common.h          | 11 +++--------
>  librdmacm/src/cma.h                  |  9 +--------
>  srp_daemon/srp_daemon/srp_daemon.h   | 17 +----------------
>  11 files changed, 28 insertions(+), 128 deletions(-)
> 

<snip>

> diff --git a/libcxgb3/src/cxio_wr.h b/libcxgb3/src/cxio_wr.h
> index ece06bd0568c..e24c7fed7d76 100644
> --- a/libcxgb3/src/cxio_wr.h
> +++ b/libcxgb3/src/cxio_wr.h
> @@ -50,13 +50,9 @@
>  #define Q_COUNT(rptr,wptr) ((wptr)-(rptr))
>  #define Q_PTR2IDX(ptr,size_log2) (ptr & ((1UL<<size_log2)-1))
> 
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> -#  define cpu_to_pci32(val) ((val))
> -#elif __BYTE_ORDER == __BIG_ENDIAN
> -#  define cpu_to_pci32(val) (__bswap_32((val)))
> -#else
> -#  error __BYTE_ORDER not defined
> -#endif
> +/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
> +   probably wrong */
> +#define cpu_to_pci32(val) htole32(val)
> 

If this was wrong, then nothing would work.  So I think you should remove the
comment.

>  #define RING_DOORBELL(doorbell, QPID) { \
>  	*doorbell = cpu_to_pci32(QPID); \

See RING_DOORBELL() is used in the .c files

> diff --git a/libcxgb4/src/t4.h b/libcxgb4/src/t4.h
> index e8c5cf66cb14..e519cc4087e6 100644
> --- a/libcxgb4/src/t4.h
> +++ b/libcxgb4/src/t4.h
> @@ -62,13 +62,10 @@
>  #define unlikely
>  #define ROUND_UP(x, n) (((x) + (n) - 1u) & ~((n) - 1u))
>  #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> -#if __BYTE_ORDER == __LITTLE_ENDIAN
> -#  define cpu_to_pci32(val) ((val))
> -#elif __BYTE_ORDER == __BIG_ENDIAN
> -#  define cpu_to_pci32(val) (__bswap_32((val)))
> -#else
> -#  error __BYTE_ORDER not defined
> -#endif
> +
> +/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
> +   probably wrong */
> +#define cpu_to_pci32(val) htole32(val)
> 

Ditto.

>  #define writel(v, a) do { *((volatile u32 *)(a)) = cpu_to_pci32(v); } while
(0)
>

Ditto.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v2 4/7] blk-mq: Introduce blk_quiesce_queue() and blk_resume_queue()
From: Ming Lei @ 2016-09-29 21:51 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jens Axboe, Christoph Hellwig, James Bottomley,
	Martin K. Petersen, Mike Snitzer, Doug Ledford, Keith Busch,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <a9eb4e95-6d77-e527-c42a-fd2e6f104bed-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>

On Thu, Sep 29, 2016 at 7:59 AM, Bart Van Assche
<bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org> wrote:
> blk_quiesce_queue() prevents that new queue_rq() invocations

blk_mq_quiesce_queue()

> occur and waits until ongoing invocations have finished. This
> function does *not* wait until all outstanding requests have

I guess it still may wait finally since this way may exhaust tag space
easily, :-)

> finished (this means invocation of request.end_io()).
> blk_resume_queue() resumes normal I/O processing.
>
> Signed-off-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
> Cc: Hannes Reinecke <hare-IBi9RG/b67k@public.gmane.org>
> Cc: Johannes Thumshirn <jthumshirn-l3A5Bk7waGM@public.gmane.org>
> ---
>  block/blk-mq.c         | 137 ++++++++++++++++++++++++++++++++++++++++++++-----
>  include/linux/blk-mq.h |   2 +
>  include/linux/blkdev.h |   5 ++
>  3 files changed, 131 insertions(+), 13 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index d8c45de..f5c71ad 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -58,15 +58,23 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx,
>         sbitmap_clear_bit(&hctx->ctx_map, ctx->index_hw);
>  }
>
> -void blk_mq_freeze_queue_start(struct request_queue *q)
> +static bool __blk_mq_freeze_queue_start(struct request_queue *q,
> +                                       bool kill_percpu_ref)
>  {
>         int freeze_depth;
>
>         freeze_depth = atomic_inc_return(&q->mq_freeze_depth);
>         if (freeze_depth == 1) {
> -               percpu_ref_kill(&q->q_usage_counter);
> +               if (kill_percpu_ref)
> +                       percpu_ref_kill(&q->q_usage_counter);
>                 blk_mq_run_hw_queues(q, false);
>         }
> +       return freeze_depth == 1;
> +}
> +
> +void blk_mq_freeze_queue_start(struct request_queue *q)
> +{
> +       __blk_mq_freeze_queue_start(q, true);
>  }
>  EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start);
>
> @@ -102,19 +110,90 @@ void blk_mq_freeze_queue(struct request_queue *q)
>  }
>  EXPORT_SYMBOL_GPL(blk_mq_freeze_queue);
>
> -void blk_mq_unfreeze_queue(struct request_queue *q)
> +static bool __blk_mq_unfreeze_queue(struct request_queue *q,
> +                                   bool reinit_percpu_ref)
>  {
>         int freeze_depth;
>
>         freeze_depth = atomic_dec_return(&q->mq_freeze_depth);
>         WARN_ON_ONCE(freeze_depth < 0);
>         if (!freeze_depth) {
> -               percpu_ref_reinit(&q->q_usage_counter);
> +               if (reinit_percpu_ref)
> +                       percpu_ref_reinit(&q->q_usage_counter);
>                 wake_up_all(&q->mq_freeze_wq);
>         }
> +       return freeze_depth == 0;
> +}
> +
> +void blk_mq_unfreeze_queue(struct request_queue *q)
> +{
> +       __blk_mq_unfreeze_queue(q, true);
>  }
>  EXPORT_SYMBOL_GPL(blk_mq_unfreeze_queue);
>
> +/**
> + * blk_mq_quiesce_queue() - wait until all pending queue_rq calls have finished
> + *
> + * Prevent that new I/O requests are queued and wait until all pending
> + * queue_rq() calls have finished. Must not be called if the queue has already
> + * been frozen. Additionally, freezing the queue after having quiesced the
> + * queue and before resuming the queue is not allowed.
> + *
> + * Note: this function does not prevent that the struct request end_io()
> + * callback function is invoked.
> + */
> +void blk_mq_quiesce_queue(struct request_queue *q)
> +{
> +       struct blk_mq_hw_ctx *hctx;
> +       unsigned int i;
> +       bool res, rcu = false;
> +
> +       spin_lock_irq(q->queue_lock);
> +       WARN_ON_ONCE(blk_queue_quiescing(q));
> +       queue_flag_set(QUEUE_FLAG_QUIESCING, q);
> +       spin_unlock_irq(q->queue_lock);
> +
> +       res = __blk_mq_freeze_queue_start(q, false);

Looks the implementation is a bit tricky and complicated, if the percpu
usage counter isn't killed, it isn't necessary to touch .mq_freeze_depth
since you use QUEUE_FLAG_QUIESCING to set/get this status of
the queue.

Then using synchronize_rcu() and rcu_read_lock()/rcu_read_unlock()
with the flag of QUIESCING may be enough to wait for completing
of ongoing invocations of .queue_rq() and avoid to run new .queue_rq,
right?

> +       WARN_ON_ONCE(!res);
> +       queue_for_each_hw_ctx(q, hctx, i) {
> +               if (hctx->flags & BLK_MQ_F_BLOCKING) {
> +                       mutex_lock(&hctx->queue_rq_mutex);
> +                       mutex_unlock(&hctx->queue_rq_mutex);

Could you explain a bit why all BLOCKING is treated so special? And
that flag just means the hw queue always need to schedule asynchronously,
and of couse even though the flag isn't set, it still may be run
asynchronously too. So looks it should be enough to just use RCU.

> +               } else {
> +                       rcu = true;
> +               }
> +       }
> +       if (rcu)
> +               synchronize_rcu();
> +
> +       spin_lock_irq(q->queue_lock);
> +       WARN_ON_ONCE(!blk_queue_quiescing(q));
> +       queue_flag_clear(QUEUE_FLAG_QUIESCING, q);
> +       spin_unlock_irq(q->queue_lock);
> +}
> +EXPORT_SYMBOL_GPL(blk_mq_quiesce_queue);
> +
> +/**
> + * blk_mq_resume_queue() - resume request processing
> + *
> + * Resume blk_queue_enter() calls that have been suspended by
> + * blk_mq_quiesce_queue().
> + *
> + * The caller is responsible for serializing blk_mq_quiesce_queue() and
> + * blk_mq_resume_queue().
> + */
> +void blk_mq_resume_queue(struct request_queue *q)
> +{
> +       bool res;
> +
> +       res = __blk_mq_unfreeze_queue(q, false);
> +       WARN_ON_ONCE(!res);
> +       WARN_ON_ONCE(blk_queue_quiescing(q));
> +
> +       blk_mq_run_hw_queues(q, false);
> +}
> +EXPORT_SYMBOL_GPL(blk_mq_resume_queue);
> +
>  void blk_mq_wake_waiters(struct request_queue *q)
>  {
>         struct blk_mq_hw_ctx *hctx;
> @@ -488,6 +567,9 @@ static void blk_mq_requeue_work(struct work_struct *work)
>         struct request *rq, *next;
>         unsigned long flags;
>
> +       if (blk_queue_quiescing(q))
> +               return;
> +
>         spin_lock_irqsave(&q->requeue_lock, flags);
>         list_splice_init(&q->requeue_list, &rq_list);
>         spin_unlock_irqrestore(&q->requeue_lock, flags);
> @@ -782,7 +864,7 @@ static inline unsigned int queued_to_index(unsigned int queued)
>   * of IO. In particular, we'd like FIFO behaviour on handling existing
>   * items on the hctx->dispatch list. Ignore that for now.
>   */
> -static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
> +static void blk_mq_process_rq_list(struct blk_mq_hw_ctx *hctx)
>  {
>         struct request_queue *q = hctx->queue;
>         struct request *rq;
> @@ -791,9 +873,6 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
>         struct list_head *dptr;
>         int queued;
>
> -       if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
> -               return;
> -
>         WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) &&
>                 cpu_online(hctx->next_cpu));
>
> @@ -883,7 +962,24 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
>                  *
>                  * blk_mq_run_hw_queue() already checks the STOPPED bit
>                  **/
> -               blk_mq_run_hw_queue(hctx, true);
> +               if (!blk_queue_quiescing(q))
> +                       blk_mq_run_hw_queue(hctx, true);
> +       }
> +}
> +
> +static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
> +{
> +       if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
> +               return;
> +
> +       if (hctx->flags & BLK_MQ_F_BLOCKING) {
> +               mutex_lock(&hctx->queue_rq_mutex);
> +               blk_mq_process_rq_list(hctx);
> +               mutex_unlock(&hctx->queue_rq_mutex);
> +       } else {
> +               rcu_read_lock();
> +               blk_mq_process_rq_list(hctx);
> +               rcu_read_unlock();
>         }
>  }
>
> @@ -1341,7 +1437,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
>                 blk_mq_bio_to_request(rq, bio);
>
>                 /*
> -                * We do limited pluging. If the bio can be merged, do that.
> +                * We do limited plugging. If the bio can be merged, do that.
>                  * Otherwise the existing request in the plug list will be
>                  * issued. So the plug list will have one request at most
>                  */
> @@ -1361,9 +1457,23 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio)
>                 blk_mq_put_ctx(data.ctx);
>                 if (!old_rq)
>                         goto done;
> -               if (!blk_mq_direct_issue_request(old_rq, &cookie))
> -                       goto done;
> -               blk_mq_insert_request(old_rq, false, true, true);
> +
> +               if (data.hctx->flags & BLK_MQ_F_BLOCKING) {
> +                       mutex_lock(&data.hctx->queue_rq_mutex);
> +                       if (blk_queue_quiescing(q) ||
> +                           blk_mq_direct_issue_request(old_rq, &cookie) != 0)
> +                               blk_mq_insert_request(old_rq, false, true,
> +                                                     true);
> +                       mutex_unlock(&data.hctx->queue_rq_mutex);
> +               } else {
> +                       rcu_read_lock();
> +                       if (blk_queue_quiescing(q) ||
> +                           blk_mq_direct_issue_request(old_rq, &cookie) != 0)
> +                               blk_mq_insert_request(old_rq, false, true,
> +                                                     true);
> +                       rcu_read_unlock();
> +               }
> +
>                 goto done;
>         }
>
> @@ -1702,6 +1812,7 @@ static int blk_mq_init_hctx(struct request_queue *q,
>         INIT_DELAYED_WORK(&hctx->delay_work, blk_mq_delay_work_fn);
>         spin_lock_init(&hctx->lock);
>         INIT_LIST_HEAD(&hctx->dispatch);
> +       mutex_init(&hctx->queue_rq_mutex);
>         hctx->queue = q;
>         hctx->queue_num = hctx_idx;
>         hctx->flags = set->flags & ~BLK_MQ_F_TAG_SHARED;
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 368c460d..4b970f1 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -41,6 +41,8 @@ struct blk_mq_hw_ctx {
>
>         struct blk_mq_tags      *tags;
>
> +       struct mutex            queue_rq_mutex;
> +
>         unsigned long           queued;
>         unsigned long           run;
>  #define BLK_MQ_MAX_DISPATCH_ORDER      7
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index c47c358..d365cdf 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -505,6 +505,7 @@ struct request_queue {
>  #define QUEUE_FLAG_FUA        24       /* device supports FUA writes */
>  #define QUEUE_FLAG_FLUSH_NQ    25      /* flush not queueuable */
>  #define QUEUE_FLAG_DAX         26      /* device supports DAX */
> +#define QUEUE_FLAG_QUIESCING   27
>
>  #define QUEUE_FLAG_DEFAULT     ((1 << QUEUE_FLAG_IO_STAT) |            \
>                                  (1 << QUEUE_FLAG_STACKABLE)    |       \
> @@ -595,6 +596,8 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
>  #define blk_queue_secure_erase(q) \
>         (test_bit(QUEUE_FLAG_SECERASE, &(q)->queue_flags))
>  #define blk_queue_dax(q)       test_bit(QUEUE_FLAG_DAX, &(q)->queue_flags)
> +#define blk_queue_quiescing(q) test_bit(QUEUE_FLAG_QUIESCING,  \
> +                                        &(q)->queue_flags)
>
>  #define blk_noretry_request(rq) \
>         ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
> @@ -824,6 +827,8 @@ extern void __blk_run_queue(struct request_queue *q);
>  extern void __blk_run_queue_uncond(struct request_queue *q);
>  extern void blk_run_queue(struct request_queue *);
>  extern void blk_run_queue_async(struct request_queue *q);
> +extern void blk_mq_quiesce_queue(struct request_queue *q);
> +extern void blk_mq_resume_queue(struct request_queue *q);
>  extern int blk_rq_map_user(struct request_queue *, struct request *,
>                            struct rq_map_data *, void __user *, unsigned long,
>                            gfp_t);
> --
> 2.10.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-block" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v3 0/9] SELinux support for Infiniband RDMA
From: Paul Moore @ 2016-09-29 22:16 UTC (permalink / raw)
  To: Daniel Jurgens
  Cc: Jason Gunthorpe, Leon Romanovsky,
	chrisw-69jw2NvuJkxg9hUCZPvPmw@public.gmane.org, Stephen Smalley,
	Eric Paris, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	selinux-+05T5uksL2qpZYMLLGbcSA@public.gmane.org,
	linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Yevgeny Petrilin
In-Reply-To: <VI1PR0501MB24299E036F1FCD335A2C2049C4C80-o1MPJYiShEyB6Z+oivrBG8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>

On Fri, Sep 23, 2016 at 9:26 AM, Daniel Jurgens <danielj-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> On 9/20/2016 6:43 PM, Paul Moore wrote:
>> On Tue, Sep 6, 2016 at 4:02 PM, Jason Gunthorpe
>> <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
>>> On Thu, Sep 01, 2016 at 02:06:46PM -0400, Paul Moore wrote:
>>>
>>>> Jason and/or Daniel, I think it would be helpful if you could explain
>>>> both the InifiniBand and IP based approaches for those of us who know
>>>> SELinux, but not necessarily the RDMA and InfiniBand portions of this
>>>> discussion.  Be verbose and explain it as if we were idiots (I get
>>>> called that enough, it must be true).
>>> Well, I'm not really familiar with SELinux, I know a little bit about
>>> how labels are applied in the netstack, but not that much...
>>>
>>> The RDMA subsystem supports 4 different networking standards, and they
>>> each have their own objects..
>> All right, I'm done traveling for a bit and it seems like this
>> discussion has settled into a stalemate so let's try to pick things
>> back up and sort this out.
>>
>> Starting we a better RDMA education for me.
>>
>> So far the discussion has been around providing access controls at the
>> transport layer, are there any RDMA entities that are transport
>> agnostic that might be better suited for what we are trying to do?  Or
>> is it simply that the RDMA layer is tied so tightly to the underlying
>> transport that we can't separate the two and have to consider them as
>> one?
>
> Welcome back Paul.
>
> I don't think there is a transport agnostic way to provide the kind of control I use in this patch set, which is very Infiniband specific.  RoCE uses VLANs and they are conceptually similar to subnet partitions, but the means of using them is completely different.  To use a different VLAN the user must select a GID for that VLAN.  One could provide a means to control RoCE access to VLANs by labeling GIDs and controlling them in a similar way to how I do PKeys.  That approach doesn't help with Infiniband partitions though, because the same GID can be used on multiple partitions.  It's also not very desirable from a policy writers perspective because it makes it so a bespoke policy is required per node.
>
> Regardless of any other approaches one might like to use to provide access control for RDMA non-Infiniband transport I think controlling access to Infiniband PKeys is still a desirable feature and I don't see any other way to have that.

Let me try to summarize and work through some of this stuff, please
correct me if any of this is wrong.

The queue pair (QP) concept lives in the RDMA layer and isn't tied to
any particular transport.  They appear to be somewhat analogous to
network sockets, although I'm guessing they can't be shared/passed
between process like a network socket, yes?

The IB partition is similar to a ethernet VLAN in that it providedes
enforced separation across the network; IB uses partition keys, VLANs
use tags/IDs.  IB partition keys are a 16 bit number, GIDs appear to
be a 16 byte number created from some combination of IP address, MAC
address, and VLAN ID.

In the case of RDMA over IB, we want to control QP access to
partitions/pkeys; in the case of RDMA over ethernet we want to control
QP access to VLANs/GIDs.

Is the above correct?

-- 
paul moore
www.paul-moore.com
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 8/9] Remove most checks of __BYTE_ORDER
From: Jason Gunthorpe @ 2016-09-29 22:28 UTC (permalink / raw)
  To: Steve Wise
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Tatyana Nikolova',
	'Hal Rosenstock', 'Doug Ledford',
	'Yishai Hadas', 'Devesh Sharma',
	'Sean Hefty', 'Bart Van Assche'
In-Reply-To: <00e001d21a98$3265f6e0$9731e4a0$@opengridcomputing.com>

On Thu, Sep 29, 2016 at 04:26:52PM -0500, Steve Wise wrote:

> > +/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
> > +   probably wrong */
> > +#define cpu_to_pci32(val) htole32(val)
> 
> If this was wrong, then nothing would work.  So I think you should
> remove the comment.

I added the comment because cxgb* was the only provider that seemed to
be obviously byte swapping MMIO.

Since htole32 is a NOP on x86 and ARM64 the driver would work fine
with or without it. Do you know this driver works on big endian
powerpc? That would help answer the question for sure.

I looked at this some more, and I still don't really know what is the
right answer.

In the kernel the swapping behavior of 'writel' is architecture (and
sometimes even platform) specific. Looking at the kernel headers
suggests that BE PPC needs an explicit swap and BE ARM does not (eg
the hardware swaps). Maybe. There are a lot of layers of macros in
this area..

However, I can't find an obvious swap in mlx4, which I think is the
most widely tested provider. Does it work on BE PPC?

One of the things I'd like to see done is to consolidate the mmio
accessors.. The note was a reminder to try and figure out what is
actually right here.. Appreciate any help!

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/9] Remove HAVE_VALGRIND_MEMCHECK_H/INCLUDE_VALGRIND
From: Jason Gunthorpe @ 2016-09-29 22:34 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	Doug Ledford, Yishai Hadas, Vladimir Sokolovsky
In-Reply-To: <aef5ce41-14bf-9869-88c8-ab5796634a8c-HInyCGIudOg@public.gmane.org>

On Thu, Sep 29, 2016 at 02:01:26PM -0700, Bart Van Assche wrote:

> Independent of this patch: Valgrind has a stable ABI so I propose to add a
> copy of the memcheck.h header file to the rdma-core source tree. Many other
> open source projects already do this.

Interesting idea, what do you see as the benefit?

FWIW, I haven't had any problems getting the valgrind headers on any
supported distro.

I think I'd rather make the absence of valgrind a hard error (right
now cmake makes a warning in the summary) than worry about another
copied header...

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v3 0/9] SELinux support for Infiniband RDMA
From: Jason Gunthorpe @ 2016-09-29 22:41 UTC (permalink / raw)
  To: Paul Moore
  Cc: Daniel Jurgens, Leon Romanovsky,
	chrisw-69jw2NvuJkxg9hUCZPvPmw@public.gmane.org, Stephen Smalley,
	Eric Paris, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	selinux-+05T5uksL2qpZYMLLGbcSA@public.gmane.org,
	linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Yevgeny Petrilin
In-Reply-To: <CAHC9VhShCgxonV1rN-J7LyezamzZtKNZ1SR7ywnTB9Kgia_u1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Sep 29, 2016 at 06:16:03PM -0400, Paul Moore wrote:
> The queue pair (QP) concept lives in the RDMA layer and isn't tied to
> any particular transport.  They appear to be somewhat analogous to
> network sockets, although I'm guessing they can't be shared/passed
> between process like a network socket, yes?

Yes

> The IB partition is similar to a ethernet VLAN in that it providedes
> enforced separation across the network; IB uses partition keys, VLANs
> use tags/IDs.  IB partition keys are a 16 bit number,

> GIDs appear to be a 16 byte number created from some combination of
> IP address, MAC address, and VLAN ID.

There are several gid formats

IB/OPA: 128 bit IPv6 address
RoCEv1: Sort of a link local IPv6 (?), vlan is specified directly
        by apps
RoCEv2: Some sort of label that also implies a vlan tag

We also have iwarp vs rocee where AFAIK iwarp should get the vlan tag
from the IP socket that is allocated against the eth interface.

> In the case of RDMA over IB, we want to control QP access to
> partitions/pkeys; in the case of RDMA over ethernet we want to control
> QP access to VLANs/GIDs.

Broadly, yes, and I don't know what restriction iwarp would
need. Probably restrict access based on the eth device, but that will
probably need additional selinux checking in the rdma core.

There are also UD QPs which are like UDP sockets, so every address
handle creation will need a security check too.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH rdma-core] Improve global COPYING files
From: Jason Gunthorpe @ 2016-09-29 22:55 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Christoph Hellwig,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Leon Romanovsky
In-Reply-To: <57ED40C8.901-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Thu, Sep 29, 2016 at 12:26:48PM -0400, Doug Ledford wrote:

> I just merged a pull request of yours, and that was the last outstanding
> pull request in the github.  I still have to sort through patches on the
> list that aren't in the github interface...but at least 20 or so of your
> outstanding patches were taken in today.

Yep thanks, making progress, sent another 13 or so, I think there are
about 10 left now. Most of what remains in my preview tree needs a bit
more work I think.

The last big useful item is the directory rename/flatting patches, eg
to move libX/src/ to under providers/ and to flatten other directories.

Oh, and the packaging files..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 8/9] Remove most checks of __BYTE_ORDER
From: Steve Wise @ 2016-09-29 23:46 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Steve Wise, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Tatyana Nikolova,
	Hal Rosenstock, Doug Ledford, Yishai Hadas, Devesh Sharma,
	Sean Hefty, Bart Van Assche
In-Reply-To: <20160929222802.GC27229-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>



> On Sep 29, 2016, at 5:28 PM, Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> 
> On Thu, Sep 29, 2016 at 04:26:52PM -0500, Steve Wise wrote:
> 
>>> +/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is
>>> +   probably wrong */
>>> +#define cpu_to_pci32(val) htole32(val)
>> 
>> If this was wrong, then nothing would work.  So I think you should
>> remove the comment.
> 
> I added the comment because cxgb* was the only provider that seemed to
> be obviously byte swapping MMIO.
> 
> Since htole32 is a NOP on x86 and ARM64 the driver would work fine
> with or without it. Do you know this driver works on big endian
> powerpc? That would help answer the question for sure.
> 

Yes, PowerPC and arm. 

> I looked at this some more, and I still don't really know what is the
> right answer.
> 
> In the kernel the swapping behavior of 'writel' is architecture (and
> sometimes even platform) specific. Looking at the kernel headers
> suggests that BE PPC needs an explicit swap and BE ARM does not (eg
> the hardware swaps). Maybe. There are a lot of layers of macros in
> this area..
> 
> However, I can't find an obvious swap in mlx4, which I think is the
> most widely tested provider. Does it work on BE PPC?
> 
> One of the things I'd like to see done is to consolidate the mmio
> accessors.. The note was a reminder to try and figure out what is
> actually right here.. Appreciate any help!
> Jason
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/9] Remove HAVE_VALGRIND_MEMCHECK_H/INCLUDE_VALGRIND
From: Bart Van Assche @ 2016-09-29 23:48 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	Doug Ledford, Yishai Hadas, Vladimir Sokolovsky
In-Reply-To: <20160929223415.GD27229-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

On 09/29/2016 03:34 PM, Jason Gunthorpe wrote:
> On Thu, Sep 29, 2016 at 02:01:26PM -0700, Bart Van Assche wrote:
>> Independent of this patch: Valgrind has a stable ABI so I propose to add a
>> copy of the memcheck.h header file to the rdma-core source tree. Many other
>> open source projects already do this.
>
> Interesting idea, what do you see as the benefit?

Hello Jason,

That would allow to annotate rdma-core code correctly for Valgrind 
without introducing a dependency on the valgrind-devel package. As you 
know most Linux distro's by default do not install the valgrind-devel 
package.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 8/9] Remove most checks of __BYTE_ORDER
From: Jason Gunthorpe @ 2016-09-30  0:08 UTC (permalink / raw)
  To: Steve Wise
  Cc: Steve Wise, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Tatyana Nikolova,
	Hal Rosenstock, Doug Ledford, Yishai Hadas, Devesh Sharma,
	Sean Hefty, Bart Van Assche
In-Reply-To: <F2C34CC4-5C7D-4382-873D-9E14B81A44B3-/Yg/VP3ZvrM@public.gmane.org>

On Thu, Sep 29, 2016 at 06:46:02PM -0500, Steve Wise wrote:
> > I added the comment because cxgb* was the only provider that seemed to
> > be obviously byte swapping MMIO.
> > 
> > Since htole32 is a NOP on x86 and ARM64 the driver would work fine
> > with or without it. Do you know this driver works on big endian
> > powerpc? That would help answer the question for sure.
> 
> Yes, PowerPC and arm. 

Okay great. Maybe Yishai can explain what mlx drivers are doing..

Is this better:

/* NOTE: The endianess of PCI MMIO accesses is architecture specific,
   this is known correct for BE PPC and LE x86/ARM */

Thanks again Steve,
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 2/9] Remove HAVE_VALGRIND_MEMCHECK_H/INCLUDE_VALGRIND
From: Jason Gunthorpe @ 2016-09-30  0:15 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Sean Hefty, Hal Rosenstock,
	Doug Ledford, Yishai Hadas, Vladimir Sokolovsky
In-Reply-To: <610a3086-07bd-baa7-11e2-88642c0e2297-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>

On Thu, Sep 29, 2016 at 04:48:25PM -0700, Bart Van Assche wrote:

> That would allow to annotate rdma-core code correctly for Valgrind without
> introducing a dependency on the valgrind-devel package.

Sure, but we are recommending distros build their official packages
with valgrind, the sample packaging I built includes valgrind as a
dependency, the README.md instructs to install valgrind, and cmake
warns if valgrind is not present.

I would never encourage a distro to build official packages using a
built-in valgrind header, that is a great way to accidently break a
new or obscure architecture.

> As you know most Linux distro's by default do not install the
> valgrind-devel package.

Are you worried about users? Like I said, we could make valgrind hard
required. It is not hard to install valgrind, and everyone already
needs to install other non-default things like libnl3-devel and cmake.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] IB/core: correctly handle rdma_rw_init_mrs() failure
From: Bart Van Assche @ 2016-09-30  3:18 UTC (permalink / raw)
  To: Steve Wise, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20160929143217.F2C8DE0BD1-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>

On 09/29/16 07:32, Steve Wise wrote:
> Function ib_create_qp() was failing to return an error when
> rdma_rw_init_mrs() fails, causing a crash further down in ib_create_qp()
> when trying to dereferece the qp pointer which was actually a negative
> errno.

Reviewed-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH V2 for-next 0/8] Bug Fixes and Code Improvement in HNS driver
From: David Miller @ 2016-09-30  5:33 UTC (permalink / raw)
  To: salil.mehta
  Cc: dledford, yisen.zhuang, xavier.huwei, oulijun, mehta.salil.lnk,
	linux-rdma, netdev, linux-kernel, linuxarm
In-Reply-To: <20160929170916.631972-1-salil.mehta@huawei.com>

From: Salil Mehta <salil.mehta@huawei.com>
Date: Thu, 29 Sep 2016 18:09:08 +0100

> This patch-set introduces fix to some Bugs, potential problems
> and code improvements identified during internal review and
> testing of Hisilicon Network Subsystem driver.
> 
> Submit Change
> V1->V2: This addresses the feedbacks provided by David Miller
>         and Doug Ledford

So Doug my understanding is if this makes it through review
this is going to be merged into your tree, you prepare a
branch for me, and then I pull from that?

Thanks in advance.

^ permalink raw reply

* Re: [PATCH v1] mlx4: remove unused fields
From: David Miller @ 2016-09-30  5:57 UTC (permalink / raw)
  To: ddecotig; +Cc: yishaih, netdev, linux-rdma, linux-kernel, edumazet, decot
In-Reply-To: <1475085604-101493-1-git-send-email-ddecotig@gmail.com>

From: David Decotigny <ddecotig@gmail.com>
Date: Wed, 28 Sep 2016 11:00:04 -0700

> From: David Decotigny <decot@googlers.com>
> 
> This also can address following UBSAN warnings:
> [   36.640343] ================================================================================
> [   36.648772] UBSAN: Undefined behaviour in drivers/net/ethernet/mellanox/mlx4/fw.c:857:26
> [   36.656853] shift exponent 64 is too large for 32-bit type 'int'
> [   36.663348] ================================================================================
> [   36.671783] ================================================================================
> [   36.680213] UBSAN: Undefined behaviour in drivers/net/ethernet/mellanox/mlx4/fw.c:861:27
> [   36.688297] shift exponent 35 is too large for 32-bit type 'int'
> [   36.694702] ================================================================================
> 
> Tested:
>   reboot with UBSAN, no warning.
> 
> Signed-off-by: David Decotigny <decot@googlers.com>

Applied to net-next, thanks.

^ permalink raw reply

* [PATCH v2 0/3] IB/hfi1: Read platform configuration file from EPROM
From: Dennis Dalessandro @ 2016-09-30 11:41 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Easwar Hariharan, Dean Luick

Doug,

This series adds the capability to read configuration information used to init
the link from the EPROM.

It partially undoes some of the work that was removed when we removed the
user access. This is not done though in support of user access. This is only so
the driver can read the EPROM. All user access is still only through resource0.

Series applies on previously submitted patches and should apply cleanly to your
for-4.9 branch. Can also be seen in GitHub at:
https://github.com/ddalessa/kernel/tree/for-4.9

Changes from v1:
Squash the first two patches per Jason's request

---

Dean Luick (3):
      IB/hfi1: Restore EPROM read ability
      IB/hfi1: Add ability to read platform config from the EPROM
      IB/hfi1: Use EPROM platform configuration read


 drivers/infiniband/hw/hfi1/chip.c     |    9 +-
 drivers/infiniband/hw/hfi1/eprom.c    |  185 +++++++++++++++++++++++++++++++++
 drivers/infiniband/hw/hfi1/eprom.h    |    4 -
 drivers/infiniband/hw/hfi1/file_ops.c |    1 
 drivers/infiniband/hw/hfi1/platform.c |   32 ++++--
 5 files changed, 213 insertions(+), 18 deletions(-)

--
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox