qcacmn: Add memory barrier to avoid inconsistent reg write

The delayed register write enqueue fills a queue element
with the required data which can be dequeued in a workqueue
running on a different CPU. Since these operations are not
lock protected, there can be stale value access when memory
write has not been flushed to the actual address.

Using write memory barrier before setting the valid flag for
a queue element will make sure that the dequeuing worker
thread will always see the updated values if the element valid
flag is set and thereby avoid any race condition.

Change-Id: I81b0735f0fb39599095ad309157020c691e25a0b
CRs-Fixed: 2665576
This commit is contained in:
Rakesh Pillai
2020-04-16 20:52:02 +05:30
committed by nshrivas
parent 529b8588c4
commit 94ff74fcf9
2 changed files with 29 additions and 11 deletions

View File

@@ -46,6 +46,11 @@ typedef __qdf_wait_queue_head_t qdf_wait_queue_head_t;
*/
#define qdf_likely(_expr) __qdf_likely(_expr)
/**
* qdf_wmb - write memory barrier.
*/
#define qdf_wmb() __qdf_wmb()
/**
* qdf_mb - read + write memory barrier.
*/