summaryrefslogtreecommitdiffstats
path: root/build/external/patches/ipsec-mb_1.3/0001-Fix-for-perf-scaling-on-release-1.3.patch
blob: 6566c36407fd3dc4890dde71df8f8550d5f64226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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