Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7cb1daa
Be consistent about defining NDEBUG
jgunthorpe Aug 30, 2016
35c52fe
Switch valgrind memcheck.h to on by default
jgunthorpe Aug 27, 2016
b2d1bd6
Do not produce libtool .la files
jgunthorpe Aug 27, 2016
87d0804
Do not produce static libraries by default
jgunthorpe Aug 28, 2016
cbae695
Have cmake run man pages through text substitution
jgunthorpe Sep 23, 2016
5eebdb9
Consolidate definitions for paths into config.h
jgunthorpe Sep 23, 2016
550d160
Pass ancillary files that use paths through cmake substitution
jgunthorpe Sep 23, 2016
8bef837
srp_daemon: Move lock file into /var/run/
jgunthorpe Sep 23, 2016
6966d5d
verbs: Move the providers into /usr/lib.../libibverbs by default
jgunthorpe Sep 12, 2016
10d6b39
ipathverbs: Move truescale-serdes.cmds to /usr/libexec/
jgunthorpe Sep 12, 2016
d99f115
Document a versioning strategy and use it
jgunthorpe Sep 23, 2016
060b4c8
Remove ibsupport@intel.com from MAINTAINERS
jgunthorpe Sep 26, 2016
6f2c2b0
Add a .travis.yml file
jgunthorpe Sep 28, 2016
ced0f45
Avoid gcc warning -Wpointer-to-int-cast
jgunthorpe Sep 5, 2016
ae66cd1
Avoid gcc warning -Wint-to-pointer-cast
jgunthorpe Sep 5, 2016
c961404
ibacm: Fix incomplete struct initialization
jgunthorpe Sep 19, 2016
4e05870
ibacm: Avoid warning on use of uninitialized ret
jgunthorpe Sep 19, 2016
d38b556
ibacm: Avoid gcc warning -Wunused-result
jgunthorpe Sep 29, 2016
842d223
ibacm: Use inttypes.h format string macros
jgunthorpe Sep 24, 2016
3adc810
verbs: Fix clang 3.6 warning -Wtautological-compare
jgunthorpe Sep 2, 2016
f3007e3
verbs: Avoid gcc 6.1 warning -Wunused-variable
jgunthorpe Sep 2, 2016
560a912
nes: Avoid gcc 6.1 warning -Wmisleading-indentation
jgunthorpe Sep 2, 2016
985f040
rxe: Avoid gcc 5.4 warning -Wswitch
jgunthorpe Sep 2, 2016
e99e7bb
Fix gcc 5.4, clang 3.6 warnings about unused objects
jgunthorpe Sep 2, 2016
dbc9457
Avoid gcc 5.4 warning -Wtype-limits
jgunthorpe Sep 2, 2016
f3912df
Avoid gcc 5.4 warning -Wunused-result
jgunthorpe Sep 2, 2016
0db49b8
Avoid clang 3.6 warning -Wmissing-field-initializers
jgunthorpe Sep 2, 2016
ad48f38
Add -Werror and 32 bit to TravisCI
jgunthorpe Sep 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
language: c
# We need at least cmake 2.12, this means we need to use trusty.
# Precise's glibc, etc predates what we are willing to support.
# No reason for sudo.
sudo: required
dist: trusty
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- build-essential
- cmake
- debhelper
- gcc
- gcc-6
- libnl-3-dev
- libnl-route-3-dev
- make
- ninja-build
- pkg-config
- python
- valgrind

# 32 bit support packages
- gcc-multilib
- lib32gcc-6-dev
script:
- mkdir build build32
- cd build
# The goal is warning free compile on latest gcc.
- CC=gcc-6 CFLAGS=-Werror cmake -GNinja ..
- ninja

# 32 bit build
- cd ../build32
# travis's trusty is not configured in a way that enables all32 bit
# packages. We could fix this with some sudo stuff.. For now turn off libnl
- CC=gcc-6 CFLAGS="-Werror -m32" cmake -GNinja .. -DENABLE_RESOLVE_NEIGH=0
- ninja
44 changes: 37 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
# Common options passed to cmake are:
# -DCMAKE_EXPORT_COMPILE_COMMANDS=1
# Write a compile_commands.json file for clang tooling
# -DENABLE_VALGRIND=1 (default disabled)
# Embed valgrind notations, this has a tiny negative performance impact
# -DCMAKE_BUILD_TYPE=RelWithDebInfo
# Change the optimization level, Debug disables optimization,
# Release is for packagers
# -DENABLE_VALGRIND=0 (default enabled)
# Disable valgrind notations, this has a tiny positive performance impact
# -DENABLE_RESOLVE_NEIGH=0 (default enabled)
# Do not link to libnl and do not resolve neighbours internally for Ethernet,
# and do not build iwpmd.
# -DENABLE_STATIC=1 (default disabled)
# Produce static libraries along with the usual shared libraries.
# -DVERBS_PROVIDER_DIR='' (default /usr/lib.../libibverbs)
# Use the historical search path for providers, in the standard system library.

cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
project(RDMA C)
Expand All @@ -25,8 +32,9 @@ else()
endif()

set(PACKAGE_NAME "RDMA")
# FIXME versioning strategy?
set(PACKAGE_VERSION "1")

# See Documentation/versioning.md
set(PACKAGE_VERSION "11")

#-------------------------
# Basic standard paths
Expand All @@ -48,6 +56,20 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd"
set(ACM_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/ibacm"
CACHE PATH "Location for ibacm provider plugin shared library files.")

# Location to find the provider plugin shared library files
set(VERBS_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/libibverbs"
CACHE PATH "Location for provider plugin shared library files. If set to empty the system search path is used.")

# Allow the 'run' dir to be configurable, this historically has been /var/run, but
# some systems now use /run/
set(CMAKE_INSTALL_RUNDIR "var/run"
CACHE PATH "Location for runtime information, typically /var/run, or /run")
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_RUNDIR})
set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_RUNDIR}")
else()
set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_RUNDIR}")
endif()

#-------------------------
# Load CMake components
set(BUILDLIB "${CMAKE_SOURCE_DIR}/buildlib")
Expand All @@ -58,12 +80,18 @@ include(CheckCCompilerFlag)
include(CheckIncludeFile)
include(CheckTypeSize)
include(RDMA_EnableCStd)
include(RDMA_BuildType)
include(RDMA_DoFixup)
include(publish_headers)
include(rdma_functions)

if (NOT DEFINED ENABLE_STATIC)
set(ENABLE_STATIC "OFF" CACHE BOOL "Produce static linking libraries as well as shared libraries.")
endif()

#-------------------------
# Setup the basic C compiler
RDMA_BuildType()
include_directories(${BUILD_INCLUDE})
# FIXME: Eliminate HAVE_CONFIG_H, we always have it.
add_definitions(-DHAVE_CONFIG_H)
Expand Down Expand Up @@ -184,9 +212,11 @@ RDMA_DoFixup("${HAVE_RDMA_USER_RXE}" "rdma/rdma_user_rxe.h")
#-------------------------
# Apply fixups

# FIXME: We should probably always enable memcheck.h, and only selectively
# turn it off in the real high performance paths. There is no reason umad
# should ever have memcheck disabled for instance.
# We prefer to build with valgrind memcheck.h present, but if not, or the user
# requested valgrind disabled, then replace it with our dummy stub.
if (NOT DEFINED ENABLE_VALGRIND)
set(ENABLE_VALGRIND "ON" CACHE BOOL "Enable use of valgrind annotations")
endif()
if (ENABLE_VALGRIND)
CHECK_INCLUDE_FILE("valgrind/memcheck.h" HAVE_VALGRIND_MEMCHECK)
CHECK_INCLUDE_FILE("valgrind/drd.h" HAVE_VALGRIND_DRD)
Expand Down
108 changes: 108 additions & 0 deletions Documentation/versioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Overall Package Version

This version number is set in the top level CMakeLists.txt:

```sh
set(PACKAGE_VERSION "11")
````

For upstream releases this is a single integer showing the release
ordering. We do not attempt to encode any 'ABI' information in this version.

Branched stabled releases can append an additional counter eg `11.2`.

Unofficial releases should include a distributor tag, eg '11.vendor2'.

When the PACKAGE_VERSION is changed, the packaging files should be updated:

```diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 389feee1e0f9..63854fe8f07f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ project(RDMA C)
set(PACKAGE_NAME "RDMA")

# See Documentation/versioning.md
-set(PACKAGE_VERSION "11")
+set(PACKAGE_VERSION "12")

#-------------------------
# Basic standard paths
```

# Shared Library Versions

The shared libraries use the typical semantic versioning scheme, eg
*libibumad* has a version like `3.1.11`.

The version number is broken up into three fields:
- '3' is called the SONAME and is embedded into the ELF:
```sh
$ readelf -ds build/lib/libibumad.so.3.1.11
0x000000000000000e (SONAME) Library soname: [libibumad.so.3]
```

We do not expect this value to ever change for our libraries. It indicates
the overall ABI, changing it means the library will not dynamically to old
programs link anymore.

- '1' is called the ABI level and is used within the ELF as the last component
symbol version tag. This version must be changed every time a new symbol
is introduced. It allows the user to see what version of the ABI the
library provides.

- '11' is the overall release number and is copied from `PACKAGE_VERSION` This
version increases with every package release, even if the library code did
not change. It allows the user to see what upstream source was used to build
the library.

This version is encoded into the filename `build/lib/libibumad.so.3.1.11` and
a symlink from `libibumad.so.3` to `build/lib/libibumad.so.3.1.11` is created.

## Shared Library Symbol Versions

Symbol versions are a linker technique that lets the library author provide
two symbols with different ABIs that have the same API name. The linker
differentiates the two cases internally. This allows the library author to
change the ABI that the API uses. This project typically does not make use of
this feature.

As a secondary feature, the symbol version is also used by package managers
like RPM to manage the ABI level. To make this work properly the ABI level
must be correctly encoded into the symbol version.

## Adding a new symbol

First, increase the ABI level of the library. It is safe to re-use the ABI
level for multiple new functions within a single release, but once a release
is tagged the ABI level becomes *immutable*. The maintainer can provide
guidence on what ABI level to use for each series.

```diff
rdma_library(ibumad libibumad.map
# See Documentation/versioning.md
- 3 3.1.${PACKAGE_VERSION}
+ 3 3.2.${PACKAGE_VERSION}
```

Next, add your new symbol to the symbol version file:

```diff
+ IBUMAD_3.2 {
+ global:
+ umad_new_symbol;
+ } IBUMAD_1.0;
```

NOTE: Once a release is made the stanzas in the map file are *immutable* and
cannot be changed. Do not add your new symbol to old stanzas.

The new symbol should appear in the ELF:

```sh
$ readelf -s build/lib/libibumad.so.3.1.11
35: 00000000000031e0 450 FUNC GLOBAL DEFAULT 12 umad_new_symbol@@IBUMAD_3.2
```

Finally update the `debian/libibumad3.symbols` file.
4 changes: 3 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ F: libcxgb4/

HF1 USERSPACE PROVIDER (for hf1.ko)
M: Mike Marciniszyn <mike.marciniszyn@intel.com>
M: Dennis Dalessandro <dennis.dalessandro@intel.com>
S: Supported
L: intel-opa@lists.01.org
F: libhfi1verbs/
Expand All @@ -68,8 +69,9 @@ F: ibacm/*

IPATH/QIB USERSPACE PROVIDER (for ib_qib.ko)
M: Mike Marciniszyn <mike.marciniszyn@intel.com>
M: Dennis Dalessandro <dennis.dalessandro@intel.com>
L: infinipath <infinipath@intel.com>
S: Supported
L: ibsupport@intel.com
F: libipathverbs/

IWARP PORT MAPPER DAEMON (for iwarp kernel providers)
Expand Down
41 changes: 41 additions & 0 deletions buildlib/RDMA_BuildType.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# COPYRIGHT (c) 2015 Obsidian Research Corporation. See COPYING file

function(RDMA_BuildType)
set(build_types Debug Release RelWithDebInfo MinSizeRel)

# Set the default build type to RelWithDebInfo. Since RDMA is typically used
# in performance contexts it doesn't make much sense to have the default build
# turn off the optimizer.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE String
"Options are ${build_types}"
FORCE
)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${build_types})
endif()

# Release should be used by packagers, it is the same as the default RelWithDebInfo,
# this means it uses -O2 and -DNDEBUG (not -O3)
foreach (language CXX C)
set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELEASE")
if ("${${VAR_TO_MODIFY}}" STREQUAL "${${VAR_TO_MODIFY}_INIT}")
set(${VAR_TO_MODIFY} "${CMAKE_${language}_FLAGS_RELWITHDEBINFO_INIT}"
CACHE STRING "Default flags for Release configuration" FORCE)
endif()
endforeach()

# RelWithDebInfo should be used by developers, it is the same as Release but
# with the -DNDEBUG removed
foreach (language CXX C)
set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELWITHDEBINFO")
if (${${VAR_TO_MODIFY}} STREQUAL ${${VAR_TO_MODIFY}_INIT})
string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )"
" "
replacement
"${${VAR_TO_MODIFY}}"
)
set(${VAR_TO_MODIFY} "${replacement}"
CACHE STRING "Default flags for RelWithDebInfo configuration" FORCE)
endif()
endforeach()
endfunction()
16 changes: 14 additions & 2 deletions buildlib/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,21 @@
#define HAVE_VALGRIND_MEMCHECK_H 1
#define INCLUDE_VALGRIND 1

#define SYSCONFDIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@"

#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"

#define SRP_DEAMON_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf"
#define SRP_DEAMON_LOCK_PREFIX "@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon"

#define ACM_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma"
#define IBACM_LIB_PATH "@ACM_PROVIDER_DIR@"
#define IBACM_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@"
#define IBACM_PID_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.pid"
#define IBACM_PORT_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.port"
#define IBACM_LOG_FILE "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log"

#define VERBS_PROVIDER_DIR "@VERBS_PROVIDER_DIR@"

// FIXME This has been supported in compilers forever, we should just fail to build on such old systems.
#cmakedefine HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE 1
Expand Down
Loading