|
|
e1b437 |
From 0eeba58a2a5273b5f9dd95d3e219a2d4ad003244 Mon Sep 17 00:00:00 2001
|
|
|
e1b437 |
From: Honggang Li <honli@redhat.com>
|
|
|
e1b437 |
Date: Mon, 11 Jan 2021 16:59:08 +0800
|
|
|
e1b437 |
Subject: [PATCH] Check PCIe relaxed ordering compliant
|
|
|
e1b437 |
|
|
|
e1b437 |
Significantly performance degradation may be observed when PICe
|
|
|
e1b437 |
relaxed ordering enabled over CPU which is not PCIe RO compliant.
|
|
|
e1b437 |
Emit a warning message for such scenario.
|
|
|
e1b437 |
|
|
|
e1b437 |
https://github.com/linux-rdma/perftest/issues/116
|
|
|
e1b437 |
|
|
|
e1b437 |
Signed-off-by: Honggang Li <honli@redhat.com>
|
|
|
e1b437 |
---
|
|
|
e1b437 |
README | 3 ++-
|
|
|
e1b437 |
configure.ac | 3 +++
|
|
|
e1b437 |
perftest.spec | 1 +
|
|
|
e1b437 |
src/perftest_parameters.c | 37 +++++++++++++++++++++++++++++++++++++
|
|
|
e1b437 |
4 files changed, 43 insertions(+), 1 deletion(-)
|
|
|
e1b437 |
|
|
|
e1b437 |
diff --git a/README b/README
|
|
|
e1b437 |
index 23f81cb..707d9df 100644
|
|
|
e1b437 |
--- a/README
|
|
|
e1b437 |
+++ b/README
|
|
|
e1b437 |
@@ -108,7 +108,8 @@ Prerequisites:
|
|
|
e1b437 |
(kernel module) matches libibverbs
|
|
|
e1b437 |
(kernel module) matches librdmacm
|
|
|
e1b437 |
(kernel module) matches libibumad
|
|
|
e1b437 |
- (kernel module) matches libmath (lm).
|
|
|
e1b437 |
+ (kernel module) matches libmath (lm)
|
|
|
e1b437 |
+ (linux kernel module) matches pciutils (lpci).
|
|
|
e1b437 |
|
|
|
e1b437 |
|
|
|
e1b437 |
Server: ./<test name> <options>
|
|
|
e1b437 |
diff --git a/configure.ac b/configure.ac
|
|
|
e1b437 |
index 0a1cc41..66ec909 100755
|
|
|
e1b437 |
--- a/configure.ac
|
|
|
e1b437 |
+++ b/configure.ac
|
|
|
e1b437 |
@@ -174,6 +174,8 @@ if [test $HAVE_SNIFFER = yes]; then
|
|
|
e1b437 |
fi
|
|
|
e1b437 |
|
|
|
e1b437 |
if [test $IS_FREEBSD = no]; then
|
|
|
e1b437 |
+ AC_CHECK_HEADERS([pci/pci.h],,[AC_MSG_ERROR([pciutils header files not found])])
|
|
|
e1b437 |
+ AC_CHECK_LIB([pci], [pci_init], [LIBPCI=-lpci], AC_MSG_ERROR([libpci not found]))
|
|
|
e1b437 |
CPU_IS_RO_COMPLIANT=yes
|
|
|
e1b437 |
# Actually this is check for being affected by a known issue
|
|
|
e1b437 |
# with Intel CPUs:
|
|
|
e1b437 |
@@ -193,6 +195,7 @@ AC_TRY_LINK([
|
|
|
e1b437 |
AM_CONDITIONAL([HAVE_RO],[test "x$HAVE_RO" = "xyes"])
|
|
|
e1b437 |
if [test $HAVE_RO = yes] && [test "x$CPU_IS_RO_COMPLIANT" = "xyes"]; then
|
|
|
e1b437 |
AC_DEFINE([HAVE_RO], [1], [Enable Relaxed Ordering])
|
|
|
e1b437 |
+ LIBS=$LIBS" -lpci"
|
|
|
e1b437 |
fi
|
|
|
e1b437 |
|
|
|
e1b437 |
AC_TRY_LINK([#include <infiniband/verbs.h>],
|
|
|
e1b437 |
diff --git a/perftest.spec b/perftest.spec
|
|
|
e1b437 |
index 630b00b..b0b50da 100644
|
|
|
e1b437 |
--- a/perftest.spec
|
|
|
e1b437 |
+++ b/perftest.spec
|
|
|
e1b437 |
@@ -8,6 +8,7 @@ Source: http://www.openfabrics.org/downloads/%{name}-%{version}.tar.gz
|
|
|
e1b437 |
Url: http://www.openfabrics.org
|
|
|
e1b437 |
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
e1b437 |
BuildRequires: libibverbs-devel librdmacm-devel libibumad-devel
|
|
|
e1b437 |
+BuildRequires: pciutils-devel
|
|
|
e1b437 |
|
|
|
e1b437 |
%description
|
|
|
e1b437 |
gen3 uverbs microbenchmarks
|
|
|
e1b437 |
diff --git a/src/perftest_parameters.c b/src/perftest_parameters.c
|
|
|
e1b437 |
index 185d7e3..77fe835 100755
|
|
|
e1b437 |
--- a/src/perftest_parameters.c
|
|
|
e1b437 |
+++ b/src/perftest_parameters.c
|
|
|
e1b437 |
@@ -11,6 +11,10 @@
|
|
|
e1b437 |
#include "perftest_parameters.h"
|
|
|
e1b437 |
#include "raw_ethernet_resources.h"
|
|
|
e1b437 |
#include<math.h>
|
|
|
e1b437 |
+#ifdef HAVE_RO
|
|
|
e1b437 |
+#include <stdbool.h>
|
|
|
e1b437 |
+#include <pci/pci.h>
|
|
|
e1b437 |
+#endif
|
|
|
e1b437 |
#define MAC_LEN (17)
|
|
|
e1b437 |
#define ETHERTYPE_LEN (6)
|
|
|
e1b437 |
#define MAC_ARR_LEN (6)
|
|
|
e1b437 |
@@ -163,6 +167,34 @@ static int get_cache_line_size()
|
|
|
e1b437 |
|
|
|
e1b437 |
return size;
|
|
|
e1b437 |
}
|
|
|
e1b437 |
+#ifdef HAVE_RO
|
|
|
e1b437 |
+/******************************************************************************
|
|
|
e1b437 |
+ Check PCIe Relaxed Ordering
|
|
|
e1b437 |
+
|
|
|
e1b437 |
+ Stolen from https://github.com/pciutils/pciutils/blob/master/example.c
|
|
|
e1b437 |
+ ******************************************************************************/
|
|
|
e1b437 |
+static bool check_pcie_relaxed_ordering_compliant(void) {
|
|
|
e1b437 |
+ struct pci_access *pacc;
|
|
|
e1b437 |
+ struct pci_dev *dev;
|
|
|
e1b437 |
+ bool cpu_is_RO_compliant = true;
|
|
|
e1b437 |
+
|
|
|
e1b437 |
+ pacc = pci_alloc();
|
|
|
e1b437 |
+ pci_init(pacc);
|
|
|
e1b437 |
+ pci_scan_bus(pacc);
|
|
|
e1b437 |
+ for (dev = pacc->devices; dev && cpu_is_RO_compliant;
|
|
|
e1b437 |
+ dev = dev->next) {
|
|
|
e1b437 |
+ pci_fill_info(dev,
|
|
|
e1b437 |
+ PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS);
|
|
|
e1b437 |
+ /* https://lore.kernel.org/patchwork/patch/820922/ */
|
|
|
e1b437 |
+ if ((dev->vendor_id == 0x8086) &&
|
|
|
e1b437 |
+ (((dev->device_id >= 0x6f01 && dev->device_id <= 0x6f0e) ||
|
|
|
e1b437 |
+ (dev->device_id >= 0x2f01 && dev->device_id <= 0x2f01))))
|
|
|
e1b437 |
+ cpu_is_RO_compliant = false;
|
|
|
e1b437 |
+ }
|
|
|
e1b437 |
+ pci_cleanup(pacc);
|
|
|
e1b437 |
+ return cpu_is_RO_compliant;
|
|
|
e1b437 |
+}
|
|
|
e1b437 |
+#endif
|
|
|
e1b437 |
/******************************************************************************
|
|
|
e1b437 |
*
|
|
|
e1b437 |
******************************************************************************/
|
|
|
e1b437 |
@@ -2873,6 +2905,11 @@ void ctx_print_test_info(struct perftest_parameters *user_param)
|
|
|
e1b437 |
printf(" Connection type : %s\t\tUsing SRQ : %s\n", connStr[user_param->connection_type], user_param->use_srq ? "ON" : "OFF");
|
|
|
e1b437 |
#ifdef HAVE_RO
|
|
|
e1b437 |
printf(" PCIe relax order: %s\n", user_param->disable_pcir ? "OFF" : "ON");
|
|
|
e1b437 |
+ if ((check_pcie_relaxed_ordering_compliant() == false) &&
|
|
|
e1b437 |
+ (user_param->disable_pcir == 0)) {
|
|
|
e1b437 |
+ printf(" WARNING: CPU is not PCIe relaxed ordering compliant.\n");
|
|
|
e1b437 |
+ printf(" WARNING: You should disable PCIe RO with `--disable_pcie_relaxed` for both server and clinet.\n");
|
|
|
e1b437 |
+ }
|
|
|
e1b437 |
#else
|
|
|
e1b437 |
printf(" PCIe relax order: %s\n", "Unsupported");
|
|
|
e1b437 |
#endif
|
|
|
e1b437 |
--
|
|
|
e1b437 |
2.29.2
|
|
|
e1b437 |
|