From e7c554906c775bd0636e41b4aa2edf48eb192503f3f5cebe4522e676a9ceff46 Mon Sep 17 00:00:00 2001 From: Nicolas Morey Date: Fri, 10 Nov 2023 10:35:55 +0000 Subject: [PATCH] Accepting request 1124846 from home:NMorey:branches:science:HPC - Add mvapich2-openpa-add-memory-barriers.patch to fix testsuite issue on pcc64 (bsc#1216610, bsc#1216612) OBS-URL: https://build.opensuse.org/request/show/1124846 OBS-URL: https://build.opensuse.org/package/show/science:HPC/mvapich2?expand=0&rev=97 --- mvapich2-openpa-add-memory-barriers.patch | 94 +++++++++++++++++++++++ mvapich2.changes | 6 ++ mvapich2.spec | 2 + 3 files changed, 102 insertions(+) create mode 100644 mvapich2-openpa-add-memory-barriers.patch diff --git a/mvapich2-openpa-add-memory-barriers.patch b/mvapich2-openpa-add-memory-barriers.patch new file mode 100644 index 0000000..8a09c28 --- /dev/null +++ b/mvapich2-openpa-add-memory-barriers.patch @@ -0,0 +1,94 @@ +commit 68c4106b2a8d8fdb9ba4e2bab90e90e3392b6bbd +Author: Nicolas Morey +Date: Thu Oct 26 12:39:20 2023 +0200 + + mvapich2: openpa: add memory barriers + + Backport from openPA: + commit 28d602b620b5d7ec8ca1a7f3ad8ab27d439b1751 + Author: Neil Fortner + Date: Wed Dec 19 13:14:57 2012 -0600 + + Add more memory barriers to LL/SC ABA tests. This should fix the recent errors + on POWER7. + + Reviewed by goodell. + + Signed-off-by: Nicolas Morey + +diff --git src/openpa/test/test_primitives.c src/openpa/test/test_primitives.c +index a83b95e00578..4533c643d581 100644 +--- src/openpa/test/test_primitives.c ++++ src/openpa/test/test_primitives.c +@@ -3783,12 +3783,18 @@ static int threaded_llsc_int_aba_helper_0(llsc_int_aba_t *udata) + nerrors++; + } /* end if */ + ++ /* Make sure shared_val is initialized before passing point 0 */ ++ OPA_write_barrier(); ++ + /* Point 0 */ + OPA_store_int(&udata->pass_point_0, 1); + + /* Wait until thread 1 passes point 1 */ + while(!OPA_load_int(&udata->pass_point_1)); + ++ /* Make sure that change_val is loaded after passing point 1 */ ++ OPA_read_barrier(); ++ + /* Store conditional 1 to the shared value */ + if(OPA_SC_int(&udata->shared_val, 1)) { + /* SC succeeded, make sure that the shared value was not changed by +@@ -3870,12 +3876,12 @@ static void *threaded_llsc_int_aba_helper_1(void *_udata) + * of this test */ + OPA_store_int(&udata->shared_val, 1); + OPA_store_int(&udata->shared_val, 0); +- +- /* Write barrier to make sure the shared value was actually updated +- * before we mark point 1 as passed */ +- OPA_write_barrier(); + } /* end if */ + ++ /* Write barrier to make sure the shared_val (if appropriate) and ++ * change_val are actually updated before we mark point 1 as passed */ ++ OPA_write_barrier(); ++ + /* Point 1 */ + OPA_store_int(&udata->pass_point_1, 1); + +@@ -4012,12 +4018,18 @@ static int threaded_llsc_ptr_aba_helper_0(llsc_ptr_aba_t *udata) + nerrors++; + } /* end if */ + ++ /* Make sure shared_val is initialized before passing point 0 */ ++ OPA_write_barrier(); ++ + /* Point 0 */ + OPA_store_int(&udata->pass_point_0, 1); + + /* Wait until thread 1 passes point 1 */ + while(!OPA_load_int(&udata->pass_point_1)); + ++ /* Make sure that change_val is loaded after passing point 1 */ ++ OPA_read_barrier(); ++ + /* Store conditional 1 to the shared value */ + if(OPA_SC_ptr(&udata->shared_val, (void *) ((int *) 0 + 1))) { + /* SC succeeded, make sure that the shared value was not changed by +@@ -4099,12 +4111,12 @@ static void *threaded_llsc_ptr_aba_helper_1(void *_udata) + * of this test */ + OPA_store_ptr(&udata->shared_val, (void *) ((int *) 0 + 1)); + OPA_store_ptr(&udata->shared_val, (void *) 0); +- +- /* Write barrier to make sure the shared value was actually updated +- * before we mark point 1 as passed */ +- OPA_write_barrier(); + } /* end if */ + ++ /* Write barrier to make sure the shared_val (if appropriate) and ++ * change_val are actually updated before we mark point 1 as passed */ ++ OPA_write_barrier(); ++ + /* Point 1 */ + OPA_store_int(&udata->pass_point_1, 1); + diff --git a/mvapich2.changes b/mvapich2.changes index 8e5df9a..c52c9ba 100644 --- a/mvapich2.changes +++ b/mvapich2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Oct 26 10:42:07 UTC 2023 - Nicolas Morey + +- Add mvapich2-openpa-add-memory-barriers.patch to fix testsuite issue + on pcc64 (bsc#1216610, bsc#1216612) + ------------------------------------------------------------------- Mon Aug 7 16:57:40 UTC 2023 - Nicolas Morey diff --git a/mvapich2.spec b/mvapich2.spec index c8cfcba..e09d9c3 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -214,6 +214,7 @@ Patch3: 0001-Drop-GCC-check.patch Patch4: reproducible.patch Patch5: pass-correct-size-to-snprintf.patch Patch6: mvapich2-allow-building-with-external-hwloc.patch +Patch7: mvapich2-openpa-add-memory-barriers.patch ## Armv7 specific patches # PATCH-FIX-UPSTREAM 0001-Drop-real128.patch (https://github.com/pmodels/mpich/issues/4005) Patch50: 0001-Drop-real128.patch @@ -352,6 +353,7 @@ is based on MPICH2 and MVICH. This package contains the static libraries %patch4 %patch5 -p1 %patch6 +%patch7 # Only apply these patches on Armv7 %ifarch armv7hl