rpms/libmlx4/devel libmlx4-0001-Remove-empty-stubs-for-detach-attach_mcast.patch, NONE, 1.1 libmlx4-0002-Use-mmap-MAP_ANONYMOUS-to-allocate-queue-buffers.patch, NONE, 1.1 libmlx4-0003-mmap-needs-some-includes.patch, NONE, 1.1 libmlx4-0004-Fix-version-in-taball-filename-in-RPM-spec-file.patch, NONE, 1.1 libmlx4-0005-Update-function-prototypes-to-match-libibverbs-enum-.patch, NONE, 1.1 .cvsignore, 1.2, 1.3 libmlx4.spec, 1.3, 1.4 sources, 1.2, 1.3

Doug Ledford dledford at fedoraproject.org
Wed Dec 2 00:55:07 UTC 2009


Author: dledford

Update of /cvs/extras/rpms/libmlx4/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv493

Modified Files:
	.cvsignore libmlx4.spec sources 
Added Files:
	libmlx4-0001-Remove-empty-stubs-for-detach-attach_mcast.patch 
	libmlx4-0002-Use-mmap-MAP_ANONYMOUS-to-allocate-queue-buffers.patch 
	libmlx4-0003-mmap-needs-some-includes.patch 
	libmlx4-0004-Fix-version-in-taball-filename-in-RPM-spec-file.patch 
	libmlx4-0005-Update-function-prototypes-to-match-libibverbs-enum-.patch 
Log Message:
* Tue Dec 01 2009 Doug Ledford <dledford at redhat.com> - 1.0.1-1
- Update to latest upstream release
- Add pseudo provides of libibverbs-driver
- Update buildrequires for libibverbs API change


libmlx4-0001-Remove-empty-stubs-for-detach-attach_mcast.patch:
 mlx4.c  |    4 ++--
 mlx4.h  |    2 --
 verbs.c |   11 -----------
 3 files changed, 2 insertions(+), 15 deletions(-)

--- NEW FILE libmlx4-0001-Remove-empty-stubs-for-detach-attach_mcast.patch ---
>From 09f8dcd3769a52eebceeae15e2c5a844e6ee4586 Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
Date: Mon, 20 Jul 2009 16:37:24 -0600
Subject: [PATCH 1/5] Remove empty stubs for detach/attach_mcast

Just use ibv_cmd_* directly.  Simplifies the code and fixes const
correctness warnings due to changes in libibverbs.

Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
 src/mlx4.c  |    4 ++--
 src/mlx4.h  |    2 --
 src/verbs.c |   10 ----------
 3 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/mlx4.c b/src/mlx4.c
index 34ece39..1295c53 100644
--- a/src/mlx4.c
+++ b/src/mlx4.c
@@ -94,8 +94,8 @@ static struct ibv_context_ops mlx4_ctx_ops = {
 	.post_recv     = mlx4_post_recv,
 	.create_ah     = mlx4_create_ah,
 	.destroy_ah    = mlx4_destroy_ah,
-	.attach_mcast  = mlx4_attach_mcast,
-	.detach_mcast  = mlx4_detach_mcast
+	.attach_mcast  = ibv_cmd_attach_mcast,
+	.detach_mcast  = ibv_cmd_detach_mcast
 };
 
 static struct ibv_context *mlx4_alloc_context(struct ibv_device *ibdev, int cmd_fd)
diff --git a/src/mlx4.h b/src/mlx4.h
index 827a201..0c658cf 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -361,7 +361,5 @@ int mlx4_destroy_ah(struct ibv_ah *ah);
 int mlx4_alloc_av(struct mlx4_pd *pd, struct ibv_ah_attr *attr,
 		   struct mlx4_ah *ah);
 void mlx4_free_av(struct mlx4_ah *ah);
-int mlx4_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
-int mlx4_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid);
 
 #endif /* MLX4_H */
diff --git a/src/verbs.c b/src/verbs.c
index cc179a0..2c19d93 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -651,13 +651,3 @@ int mlx4_destroy_ah(struct ibv_ah *ah)
 
 	return 0;
 }
-
-int mlx4_attach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid)
-{
-	return ibv_cmd_attach_mcast(qp, gid, lid);
-}
-
-int mlx4_detach_mcast(struct ibv_qp *qp, union ibv_gid *gid, uint16_t lid)
-{
-	return ibv_cmd_detach_mcast(qp, gid, lid);
-}
-- 
1.6.5.2


libmlx4-0002-Use-mmap-MAP_ANONYMOUS-to-allocate-queue-buffers.patch:
 buf.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

--- NEW FILE libmlx4-0002-Use-mmap-MAP_ANONYMOUS-to-allocate-queue-buffers.patch ---
>From 87750d1db4bc73933e92d862ff73d10d06ff4f5d Mon Sep 17 00:00:00 2001
From: Sebastien Dugue <sebastien.dugue at bull.net>
Date: Wed, 29 Jul 2009 11:45:55 -0700
Subject: [PATCH 2/5] Use mmap(MAP_ANONYMOUS) to allocate queue buffers

Internal buffers for QPs, CQs, SRQs etc. are allocated with
mlx4_alloc_buf(), which rounds the buffer's size to the page size and
then allocates page aligned memory using posix_memalign().

However, this allocation is quite wasteful on architectures using 64K
pages (ia64 for example) because we then hit glibc's MMAP_THRESHOLD
malloc parameter and chunks are allocated using mmap.  Thus we end up
allocating:

  (requested size rounded to the page size) + (page size) + (malloc overhead)

rounded internally to the page size.

So for example, if we request a buffer of page_size bytes, we end up
consuming 3 pages.  In short, for each buffer we allocate, there is an
overhead of 2 pages.  This is quite visible on large clusters where
the number of QPs can reach several thousands.

This patch replaces the call to posix_memalign() in mlx4_alloc_buf()
with a direct call to mmap().

Signed-off-by: Sebastien Dugue <sebastien.dugue at bull.net>
Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
 src/buf.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/buf.c b/src/buf.c
index 0e5f9b6..bbaff12 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -61,16 +61,15 @@ int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size)
 {
 	int ret;
 
-	ret = posix_memalign(&buf->buf, page_size, align(size, page_size));
-	if (ret)
-		return ret;
+	buf->length = align(size, page_size);
+	buf->buf = mmap(NULL, buf->length, PROT_READ | PROT_WRITE,
+			MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+	if (buf->buf == MAP_FAILED)
+		return errno;
 
 	ret = ibv_dontfork_range(buf->buf, size);
 	if (ret)
-		free(buf->buf);
-
-	if (!ret)
-		buf->length = size;
+		munmap(buf->buf, buf->length);
 
 	return ret;
 }
@@ -78,5 +77,5 @@ int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size)
 void mlx4_free_buf(struct mlx4_buf *buf)
 {
 	ibv_dofork_range(buf->buf, buf->length);
-	free(buf->buf);
+	munmap(buf->buf, buf->length);
 }
-- 
1.6.5.2


libmlx4-0003-mmap-needs-some-includes.patch:
 buf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- NEW FILE libmlx4-0003-mmap-needs-some-includes.patch ---
>From cf744a2ef8343e5f74f9c59de3990e3e46ec301c Mon Sep 17 00:00:00 2001
From: Sebastien Dugue <sebastien.dugue at bull.net>
Date: Mon, 3 Aug 2009 15:40:01 +0200
Subject: [PATCH 3/5] mmap() needs some includes

Add errno.h and sys/mman.h includes in buf.c for mmap().  The includes
were left out of 87750d1d ("Use mmap(MAP_ANONYMOUS) to allocate queue
buffers") by mistake.

Signed-off-by: Sebastien Dugue <sebastien.dugue at bull.net>
Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
 src/buf.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/buf.c b/src/buf.c
index bbaff12..a80bcb1 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -35,6 +35,8 @@
 #endif /* HAVE_CONFIG_H */
 
 #include <stdlib.h>
+#include <errno.h>
+#include <sys/mman.h>
 
 #include "mlx4.h"
 
-- 
1.6.5.2


libmlx4-0004-Fix-version-in-taball-filename-in-RPM-spec-file.patch:
 libmlx4.spec.in |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- NEW FILE libmlx4-0004-Fix-version-in-taball-filename-in-RPM-spec-file.patch ---
>From ec9d1ca2fa87984d0656e811b03fa60d44459930 Mon Sep 17 00:00:00 2001
From: Sebastien Dugue <sebastien.dugue at bull.net>
Date: Mon, 3 Aug 2009 13:47:43 -0700
Subject: [PATCH 4/5] Fix version in taball filename in RPM spec file

Forgot to bump the tarball filename when releasing libmlx4-1.0.1.

Signed-off-by: Sebastien Dugue <sebastien.dugue at bull.net>
Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
 libmlx4.spec.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libmlx4.spec.in b/libmlx4.spec.in
index 869032f..a98ca68 100644
--- a/libmlx4.spec.in
+++ b/libmlx4.spec.in
@@ -6,7 +6,7 @@ Summary: Mellanox ConnectX InfiniBand HCA Userspace Driver
 Group: System Environment/Libraries
 License: GPLv2 or BSD
 Url: http://openfabrics.org/
-Source: http://openfabrics.org/downloads/mlx4/libmlx4-1.0.tar.gz
+Source: http://openfabrics.org/downloads/mlx4/libmlx4-1.0.1.tar.gz
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 BuildRequires: libibverbs-devel >= 1.1-0.1.rc2
-- 
1.6.5.2


libmlx4-0005-Update-function-prototypes-to-match-libibverbs-enum-.patch:
 mlx4.h  |    8 ++++----
 verbs.c |    9 ++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

--- NEW FILE libmlx4-0005-Update-function-prototypes-to-match-libibverbs-enum-.patch ---
>From 444f634f38155fa84224eaa260753811455fee71 Mon Sep 17 00:00:00 2001
From: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
Date: Thu, 23 Jul 2009 10:03:12 -0600
Subject: [PATCH 5/5] Update function prototypes to match libibverbs enum type change

Change enum bit flags to int to match libibverbs prototype changes.

Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
 src/mlx4.h  |    8 ++++----
 src/verbs.c |    8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mlx4.h b/src/mlx4.h
index 0c658cf..4445998 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -302,7 +302,7 @@ struct ibv_pd *mlx4_alloc_pd(struct ibv_context *context);
 int mlx4_free_pd(struct ibv_pd *pd);
 
 struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr,
-			    size_t length, enum ibv_access_flags access);
+			    size_t length, int access);
 int mlx4_dereg_mr(struct ibv_mr *mr);
 
 struct ibv_cq *mlx4_create_cq(struct ibv_context *context, int cqe,
@@ -323,7 +323,7 @@ struct ibv_srq *mlx4_create_srq(struct ibv_pd *pd,
 				 struct ibv_srq_init_attr *attr);
 int mlx4_modify_srq(struct ibv_srq *srq,
 		     struct ibv_srq_attr *attr,
-		     enum ibv_srq_attr_mask mask);
+		     int mask);
 int mlx4_query_srq(struct ibv_srq *srq,
 			   struct ibv_srq_attr *attr);
 int mlx4_destroy_srq(struct ibv_srq *srq);
@@ -336,10 +336,10 @@ int mlx4_post_srq_recv(struct ibv_srq *ibsrq,
 
 struct ibv_qp *mlx4_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
 int mlx4_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-		   enum ibv_qp_attr_mask attr_mask,
+		   int attr_mask,
 		   struct ibv_qp_init_attr *init_attr);
 int mlx4_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-		    enum ibv_qp_attr_mask attr_mask);
+		    int attr_mask);
 int mlx4_destroy_qp(struct ibv_qp *qp);
 void mlx4_init_qp_indices(struct mlx4_qp *qp);
 void mlx4_qp_init_sq_ownership(struct mlx4_qp *qp);
diff --git a/src/verbs.c b/src/verbs.c
index 2c19d93..1ac1362 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -108,7 +108,7 @@ int mlx4_free_pd(struct ibv_pd *pd)
 }
 
 struct ibv_mr *mlx4_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
-			   enum ibv_access_flags access)
+			   int access)
 {
 	struct ibv_mr *mr;
 	struct ibv_reg_mr cmd;
@@ -353,7 +353,7 @@ err:
 
 int mlx4_modify_srq(struct ibv_srq *srq,
 		     struct ibv_srq_attr *attr,
-		     enum ibv_srq_attr_mask attr_mask)
+		     int attr_mask)
 {
 	struct ibv_modify_srq cmd;
 
@@ -497,7 +497,7 @@ err:
 }
 
 int mlx4_query_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
-		   enum ibv_qp_attr_mask attr_mask,
+		   int attr_mask,
 		   struct ibv_qp_init_attr *init_attr)
 {
 	struct ibv_query_qp cmd;
@@ -518,7 +518,7 @@ int mlx4_query_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
 }
 
 int mlx4_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
-		    enum ibv_qp_attr_mask attr_mask)
+		    int attr_mask)
 {
 	struct ibv_modify_qp cmd;
 	int ret;
-- 
1.6.5.2



Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/libmlx4/devel/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- .cvsignore	31 Jan 2008 18:10:12 -0000	1.2
+++ .cvsignore	2 Dec 2009 00:55:07 -0000	1.3
@@ -1 +1,2 @@
 libmlx4-1.0.tar.gz
+libmlx4-1.0.1.tar.gz


Index: libmlx4.spec
===================================================================
RCS file: /cvs/extras/rpms/libmlx4/devel/libmlx4.spec,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- libmlx4.spec	25 Jul 2009 06:06:26 -0000	1.3
+++ libmlx4.spec	2 Dec 2009 00:55:07 -0000	1.4
@@ -1,15 +1,19 @@
 Name: libmlx4
-Version: 1.0
-Release: 4%{?dist}
+Version: 1.0.1
+Release: 1%{?dist}
 Summary: Mellanox ConnectX InfiniBand HCA Userspace Driver
-
+Provides: libibverbs-driver
 Group: System Environment/Libraries
 License: GPLv2 or BSD
 Url: http://openib.org/
-Source: http://openib.org/downloads/mlx4/libmlx4-1.0.tar.gz
+Source: http://openib.org/downloads/mlx4/%{name}-%{version}.tar.gz
+Patch0: libmlx4-0001-Remove-empty-stubs-for-detach-attach_mcast.patch
+Patch1: libmlx4-0002-Use-mmap-MAP_ANONYMOUS-to-allocate-queue-buffers.patch
+Patch2: libmlx4-0003-mmap-needs-some-includes.patch
+Patch3: libmlx4-0004-Fix-version-in-taball-filename-in-RPM-spec-file.patch
+Patch4: libmlx4-0005-Update-function-prototypes-to-match-libibverbs-enum-.patch
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-
-BuildRequires: libibverbs-devel >= 1.1-0.1.rc2
+BuildRequires: libibverbs-devel >= 1.1.3
 
 %description
 libmlx4 provides a device-specific userspace driver for Mellanox
@@ -26,11 +30,16 @@ Static version of libmlx4 that may be li
 application, which may be useful for debugging.
 
 %prep
-%setup -q -n %{name}-1.0
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 %configure
-make %{?_smp_mflags}
+make CFLAGS="$CFLAGS -fno-strict-aliasing" %{?_smp_mflags}
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -52,6 +61,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libmlx4.a
 
 %changelog
+* Tue Dec 01 2009 Doug Ledford <dledford at redhat.com> - 1.0.1-1
+- Update to latest upstream release
+- Add pseudo provides of libibverbs-driver
+- Update buildrequires for libibverbs API change
+
 * Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
 


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/libmlx4/devel/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- sources	31 Jan 2008 18:10:12 -0000	1.2
+++ sources	2 Dec 2009 00:55:07 -0000	1.3
@@ -1 +1 @@
-35c4c262ec45c818ffafb5f77d68a6ed  libmlx4-1.0.tar.gz
+044d9b1ff3b92f0331a3ee48779423ef  libmlx4-1.0.1.tar.gz




More information about the scm-commits mailing list