aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorMarcel Cornu <marcel.d.cornu@intel.com>2023-01-09 23:15:11 +0000
committerFan Zhang <fanzhang.oss@gmail.com>2023-01-10 16:55:26 +0000
commita9e266ea4a8d87eb9383a7fe936426380db9623b (patch)
tree271197d989d7c765e06012bb400abe5135796e0c /build
parent2b1b1154c41679d43bf9abbaf8787a284b05786b (diff)
crypto-ipsecmb: fix perf scaling in ipsecmb v1.3
Type: fix This patch adds a fix for an issue in the ipsecmb library resulting in lower than expected performance in multi-threaded scenarios. This is due to multiple threads writing the same global variable simultaneously. Signed-off-by: marcel.d.cornu@intel.com Change-Id: Ibcac321aa40da4b1709198dec3e18226e3891138
Diffstat (limited to 'build')
-rw-r--r--build/external/patches/ipsec-mb_1.3/0001-Fix-for-perf-scaling-on-release-1.3.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/build/external/patches/ipsec-mb_1.3/0001-Fix-for-perf-scaling-on-release-1.3.patch b/build/external/patches/ipsec-mb_1.3/0001-Fix-for-perf-scaling-on-release-1.3.patch
new file mode 100644
index 00000000000..6566c36407f
--- /dev/null
+++ b/build/external/patches/ipsec-mb_1.3/0001-Fix-for-perf-scaling-on-release-1.3.patch
@@ -0,0 +1,70 @@
+From 6b941770f0114d42e87875562d5174bc70c5ac65 Mon Sep 17 00:00:00 2001
+From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
+Date: Tue, 6 Dec 2022 10:59:35 +0000
+Subject: [PATCH] Fix for perf scaling on release 1.3
+
+---
+ lib/include/error.h | 10 +++++++---
+ lib/include/error.inc | 3 +++
+ lib/x86_64/error.c | 2 +-
+ 3 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/lib/include/error.h b/lib/include/error.h
+index 73d44f51..778df4b1 100644
+--- a/lib/include/error.h
++++ b/lib/include/error.h
+@@ -32,7 +32,7 @@
+ * declare global variable to store
+ * process wide error status
+ */
+-extern int imb_errno;
++extern volatile int imb_errno;
+
+ /**
+ * @brief API to set error status
+@@ -47,8 +47,12 @@ void imb_set_errno(IMB_MGR *mb_mgr, const int errnum)
+ if (mb_mgr != NULL)
+ mb_mgr->imb_errno = errnum;
+
+- /* set global error status */
+- imb_errno = errnum;
++ /*
++ * set global error status
++ * (only if different, to limit unneeded stores)
++ */
++ if (imb_errno != errnum)
++ imb_errno = errnum;
+ }
+
+ #endif /* ERROR_H */
+diff --git a/lib/include/error.inc b/lib/include/error.inc
+index 54df265f..5ea53a59 100644
+--- a/lib/include/error.inc
++++ b/lib/include/error.inc
+@@ -103,7 +103,10 @@ SET_ERRNO_TYPES \
+ ;; Reset global imb_errno to 0
+ %macro IMB_ERR_CHECK_RESET 0
+
++ cmp dword [rel imb_errno], 0
++ jz %%do_not_reset
+ mov dword [rel imb_errno], 0
++%%do_not_reset:
+ %endmacro
+
+ ;; Set GP reg and global imb_errno to 0
+diff --git a/lib/x86_64/error.c b/lib/x86_64/error.c
+index 19189093..24dcded3 100644
+--- a/lib/x86_64/error.c
++++ b/lib/x86_64/error.c
+@@ -39,7 +39,7 @@
+ #pragma warning(disable : 4996)
+ #endif
+
+-IMB_DLL_LOCAL int imb_errno;
++IMB_DLL_LOCAL volatile int imb_errno;
+ IMB_DLL_LOCAL const int imb_errno_types[] = {
+ IMB_ERR_NULL_MBMGR,
+ IMB_ERR_JOB_NULL_SRC,
+--
+2.34.1
+