Bluetooth: Controller: Fix some compiler instruction re-ordering

Fix some compiler instruction re-ordering. Mayfly code with
cpu_dmb() help avoid stalled memq_ull_rx processing when
rx_demux is to be executed using mayfly.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2023-09-13 12:37:29 +05:30 committed by Carles Cufí
commit f2069530ee
2 changed files with 8 additions and 0 deletions

View file

@ -3149,6 +3149,7 @@ void ticker_job(void *param)
instance->job_guard = 0U;
/* trigger worker if deferred */
cpu_dmb();
if (instance->worker_trigger || compare_trigger) {
instance->sched_cb(TICKER_CALL_ID_JOB, TICKER_CALL_ID_WORKER, 1,
instance);

View file

@ -6,8 +6,13 @@
*/
#include <stddef.h>
#include <soc.h>
#include <zephyr/types.h>
#include <zephyr/sys/printk.h>
#include "hal/cpu.h"
#include "memq.h"
#include "mayfly.h"
@ -154,10 +159,12 @@ static void dequeue(uint8_t callee_id, uint8_t caller_id, memq_link_t *link,
m->_link = link;
/* reset mayfly state to idle */
cpu_dmb();
ack = m->_ack;
m->_ack = req;
/* re-insert, if re-pended by interrupt */
cpu_dmb();
if (((m->_req - ack) & 0x03) == 1U) {
#if defined(MAYFLY_UT)
printk("%s: RACE\n", __func__);