|
| 1 | +Description: Revert innodb and xtradb PowerPC synchronization from 10.0.26 |
| 2 | + On PowerPC 64 Little Endian we have synchronization problems that causes |
| 3 | + warnings in test cases. The patch reverts these changes from 10.0.26 that |
| 4 | + caused this regression. |
| 5 | + |
| 6 | + The patch was initially proposed by Sergey Vojtovich, altered slightly to |
| 7 | + have it compile. |
| 8 | + . |
| 9 | + This patch should be removed when upstream provides an adequate fix. |
| 10 | +Author: Vicențiu Ciorbaru < [email protected]> |
| 11 | +diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h |
| 12 | +index 1cf4e9c..1abb774 100644 |
| 13 | +--- a/storage/innobase/include/os0sync.h |
| 14 | ++++ b/storage/innobase/include/os0sync.h |
| 15 | +@@ -492,7 +492,8 @@ inline |
| 16 | + lock_word_t |
| 17 | + os_atomic_clear(volatile lock_word_t* ptr) |
| 18 | + { |
| 19 | +- return(__sync_lock_test_and_set(ptr, 0)); |
| 20 | ++ __sync_lock_release(ptr); |
| 21 | ++ return *ptr; |
| 22 | + } |
| 23 | + |
| 24 | + # elif defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET) |
| 25 | +@@ -861,6 +862,7 @@ for synchronization */ |
| 26 | + architecture. Disable memory barrier for Intel architecture for now. */ |
| 27 | + # define os_rmb do { } while(0) |
| 28 | + # define os_wmb do { } while(0) |
| 29 | ++# define os_mb do { } while(0) |
| 30 | + # define os_isync do { } while(0) |
| 31 | + # define IB_MEMORY_BARRIER_STARTUP_MSG \ |
| 32 | + "Memory barrier is not used" |
| 33 | +diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic |
| 34 | +index 55f728f..0b6858a 100644 |
| 35 | +--- a/storage/innobase/include/sync0sync.ic |
| 36 | ++++ b/storage/innobase/include/sync0sync.ic |
| 37 | +@@ -178,6 +178,8 @@ mutex_exit_func( |
| 38 | + to wake up possible hanging threads if |
| 39 | + they are missed in mutex_signal_object. */ |
| 40 | + |
| 41 | ++ os_mb; |
| 42 | ++ |
| 43 | + if (mutex_get_waiters(mutex) != 0) { |
| 44 | + |
| 45 | + mutex_signal_object(mutex); |
| 46 | +diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h |
| 47 | +index 0f93f3f..2aa9478 100644 |
| 48 | +--- a/storage/xtradb/include/os0sync.h |
| 49 | ++++ b/storage/xtradb/include/os0sync.h |
| 50 | +@@ -543,7 +543,8 @@ inline |
| 51 | + lock_word_t |
| 52 | + os_atomic_clear(volatile lock_word_t* ptr) |
| 53 | + { |
| 54 | +- return(__sync_lock_test_and_set(ptr, 0)); |
| 55 | ++ __sync_lock_release(ptr); |
| 56 | ++ return *ptr; |
| 57 | + } |
| 58 | + |
| 59 | + # elif defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET) |
| 60 | +@@ -912,6 +913,7 @@ for synchronization */ |
| 61 | + architecture. Disable memory barrier for Intel architecture for now. */ |
| 62 | + # define os_rmb do { } while(0) |
| 63 | + # define os_wmb do { } while(0) |
| 64 | ++# define os_mb do { } while(0) |
| 65 | + # define os_isync do { } while(0) |
| 66 | + # define IB_MEMORY_BARRIER_STARTUP_MSG \ |
| 67 | + "Memory barrier is not used" |
| 68 | +diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic |
| 69 | +index 00db854..fac83a4 100644 |
| 70 | +--- a/storage/xtradb/include/sync0sync.ic |
| 71 | ++++ b/storage/xtradb/include/sync0sync.ic |
| 72 | +@@ -181,6 +181,8 @@ mutex_exit_func( |
| 73 | + to wake up possible hanging threads if |
| 74 | + they are missed in mutex_signal_object. */ |
| 75 | + |
| 76 | ++ os_mb; |
| 77 | ++ |
| 78 | + if (mutex_get_waiters(mutex) != 0) { |
| 79 | + |
| 80 | + mutex_signal_object(mutex); |
0 commit comments