Commit b3fd79ab authored by Vinayak Kariappa Chettimada's avatar Vinayak Kariappa Chettimada Committed by Josh Lilly
Browse files

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: default avatarVinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit f2069530)
parent 45ca2886
Loading
Loading
Loading
Loading
+2 −0
Changes for subsys/bluetooth/controller/ticker/ticker.c: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <zephyr/types.h>
#include <soc.h>

#include "hal/cpu.h"
#include "hal/cntr.h"
#include "hal/ticker.h"

@@ -3137,6 +3138,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);
+7 −0
Changes for subsys/bluetooth/controller/util/mayfly.c: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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__);