We are successfully using nvidia_peer_memory version 1.0 on a system running Scientific Linux 6.8 with the patch pasted below. The build problems you experienced originate from the fact that the compilation takes the printk header from the Mellanox OFED compat layer without having the compat/config.h macros defined.
Best regards,
Dorian
From f653387ae914271e9fd639a00af1c02daf8560e3 Mon Sep 17 00:00:00 2001
From: []
Date: Tue, 23 Aug 2016 13:58:56 +0200
Subject: [PATCH 1/2] Update Makefile
Take the defines from compat/config.h and define them on the
command line. This fixes a build problem with the latest RHEL6
kernels.
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index c2d6a29..929a296 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,9 @@
obj-m += nv_peer_mem.o
-OFA_KERNEL=$(shell (test -d /usr/src/ofa_kernel/default && echo /usr/src/ofa_kernel/default) || (test -d /var/lib/dkms/mlnx-ofed-kernel/ && ls -d /var/lib/dkms/mlnx-ofed-kernel/*/build))
+OFA_KERNEL = /usr/src/ofa_kernel/default
+DEFINES = $(shell /bin/cat $(OFA_KERNEL)/compat/config.h | grep '\#define' | sed 's/\#define /-D/g' | sed 's/ /=/g' | tr '\n' ' ')
-EXTRA_CFLAGS +=-I$(OFA_KERNEL)/include/ -I$(OFA_KERNEL)/include/rdma
+EXTRA_CFLAGS +=-I$(OFA_KERNEL)/include/ -I$(OFA_KERNEL)/include/rdma $(DEFINES)
PWD := $(shell pwd)
KVER := $(shell uname -r)
MODULES_DIR := /lib/modules/$(KVER)
--
2.7.4