summaryrefslogtreecommitdiff
path: root/quantum/split_common
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-04-19 12:56:16 +0200
committerGitHub <noreply@github.com>2022-04-19 20:56:16 +1000
commit7712a286dccea029785976311433cf8673594f6f (patch)
tree775ae193b6fab345cce5e9046a3ff4116e83bc36 /quantum/split_common
parent176ab1464964863637cc5d6a944dbdbe3f567aec (diff)
[Core] Use a mutex guard for split shared memory (#16647)
Diffstat (limited to 'quantum/split_common')
-rw-r--r--quantum/split_common/transactions.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c
index 105bf918cb..9e3df534e3 100644
--- a/quantum/split_common/transactions.c
+++ b/quantum/split_common/transactions.c
@@ -23,8 +23,9 @@
23#include "quantum.h" 23#include "quantum.h"
24#include "transactions.h" 24#include "transactions.h"
25#include "transport.h" 25#include "transport.h"
26#include "split_util.h"
27#include "transaction_id_define.h" 26#include "transaction_id_define.h"
27#include "split_util.h"
28#include "synchronization_util.h"
28 29
29#define SYNC_TIMER_OFFSET 2 30#define SYNC_TIMER_OFFSET 2
30 31
@@ -63,9 +64,7 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_
63 } 64 }
64 } 65 }
65 bool this_okay = true; 66 bool this_okay = true;
66 ATOMIC_BLOCK_FORCEON { 67 this_okay = handler(master_matrix, slave_matrix);
67 this_okay = handler(master_matrix, slave_matrix);
68 };
69 if (this_okay) return true; 68 if (this_okay) return true;
70 } 69 }
71 dprintf("Failed to execute %s\n", prefix); 70 dprintf("Failed to execute %s\n", prefix);
@@ -77,11 +76,11 @@ static bool transaction_handler_master(matrix_row_t master_matrix[], matrix_row_
77 if (!transaction_handler_master(master_matrix, slave_matrix, #prefix, &prefix##_handlers_master)) return false; \ 76 if (!transaction_handler_master(master_matrix, slave_matrix, #prefix, &prefix##_handlers_master)) return false; \
78 } while (0) 77 } while (0)
79 78
80#define TRANSACTION_HANDLER_SLAVE(prefix) \ 79#define TRANSACTION_HANDLER_SLAVE(prefix) \
81 do { \ 80 do { \
82 ATOMIC_BLOCK_FORCEON { \ 81 split_shared_memory_lock(); \
83 prefix##_handlers_slave(master_matrix, slave_matrix); \ 82 prefix##_handlers_slave(master_matrix, slave_matrix); \
84 }; \ 83 split_shared_memory_unlock(); \
85 } while (0) 84 } while (0)
86 85
87inline static bool read_if_checksum_mismatch(int8_t trans_id_checksum, int8_t trans_id_retrieve, uint32_t *last_update, void *destination, const void *equiv_shmem, size_t length) { 86inline static bool read_if_checksum_mismatch(int8_t trans_id_checksum, int8_t trans_id_retrieve, uint32_t *last_update, void *destination, const void *equiv_shmem, size_t length) {