| 1 |
From 6b941770f0114d42e87875562d5174bc70c5ac65 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Pablo de Lara <[email protected]> |
| 3 |
Date: Tue, 6 Dec 2022 10:59:35 +0000 |
| 4 |
Subject: [PATCH] Fix for perf scaling on release 1.3 |
| 5 |
|
| 6 |
--- |
| 7 |
lib/include/error.h | 10 +++++++--- |
| 8 |
lib/include/error.inc | 3 +++ |
| 9 |
lib/x86_64/error.c | 2 +- |
| 10 |
3 files changed, 11 insertions(+), 4 deletions(-) |
| 11 |
|
| 12 |
diff --git a/lib/include/error.h b/lib/include/error.h |
| 13 |
index 73d44f51..778df4b1 100644 |
| 14 |
--- a/lib/include/error.h |
| 15 |
+++ b/lib/include/error.h |
| 16 |
@@ -32,7 +32,7 @@ |
| 17 |
* declare global variable to store |
| 18 |
* process wide error status |
| 19 |
*/ |
| 20 |
-extern int imb_errno; |
| 21 |
+extern volatile int imb_errno; |
| 22 |
|
| 23 |
/** |
| 24 |
* @brief API to set error status |
| 25 |
@@ -47,8 +47,12 @@ void imb_set_errno(IMB_MGR *mb_mgr, const int errnum) |
| 26 |
if (mb_mgr != NULL) |
| 27 |
mb_mgr->imb_errno = errnum; |
| 28 |
|
| 29 |
- /* set global error status */ |
| 30 |
- imb_errno = errnum; |
| 31 |
+ /* |
| 32 |
+ * set global error status |
| 33 |
+ * (only if different, to limit unneeded stores) |
| 34 |
+ */ |
| 35 |
+ if (imb_errno != errnum) |
| 36 |
+ imb_errno = errnum; |
| 37 |
} |
| 38 |
|
| 39 |
#endif /* ERROR_H */ |
| 40 |
diff --git a/lib/include/error.inc b/lib/include/error.inc |
| 41 |
index 54df265f..5ea53a59 100644 |
| 42 |
--- a/lib/include/error.inc |
| 43 |
+++ b/lib/include/error.inc |
| 44 |
@@ -103,7 +103,10 @@ SET_ERRNO_TYPES \ |
| 45 |
;; Reset global imb_errno to 0 |
| 46 |
%macro IMB_ERR_CHECK_RESET 0 |
| 47 |
|
| 48 |
+ cmp dword [rel imb_errno], 0 |
| 49 |
+ jz %%do_not_reset |
| 50 |
mov dword [rel imb_errno], 0 |
| 51 |
+%%do_not_reset: |
| 52 |
%endmacro |
| 53 |
|
| 54 |
;; Set GP reg and global imb_errno to 0 |
| 55 |
diff --git a/lib/x86_64/error.c b/lib/x86_64/error.c |
| 56 |
index 19189093..24dcded3 100644 |
| 57 |
--- a/lib/x86_64/error.c |
| 58 |
+++ b/lib/x86_64/error.c |
| 59 |
@@ -39,7 +39,7 @@ |
| 60 |
#pragma warning(disable : 4996) |
| 61 |
#endif |
| 62 |
|
| 63 |
-IMB_DLL_LOCAL int imb_errno; |
| 64 |
+IMB_DLL_LOCAL volatile int imb_errno; |
| 65 |
IMB_DLL_LOCAL const int imb_errno_types[] = { |
| 66 |
IMB_ERR_NULL_MBMGR, |
| 67 |
IMB_ERR_JOB_NULL_SRC, |
| 68 |
-- |
| 69 |
2.34.1 |
| 70 |
|