On Tue, 12 Aug 2025 23:43:58 -0700 Dimon Zhao <dimon.z...@nebula-matrix.com> wrote:
> +/** > + * @brief: used to alloc continuous dma memory region for cmd buffer > + * @mem: output, the memory object containing va, pa and size of memory > + * @size: input, memory size in bytes > + * @return: memory virtual address for cpu usage > + */ > +void *nbl_alloc_dma_mem(struct nbl_dma_mem *mem, uint32_t size) > +{ > + const struct rte_memzone *mz = NULL; > + char z_name[RTE_MEMZONE_NAMESIZE]; > + > + if (!mem) > + return NULL; > + > + snprintf(z_name, sizeof(z_name), "nbl_dma_%u", > + rte_atomic_fetch_add_explicit(&nbl_dma_memzone_id, 1, > rte_memory_order_relaxed)); > + mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY, 0, > + 0, RTE_PGSIZE_2M); Since this is setup during probe, and probe process is single threaded. Using atomic here is overkill.