Re: [dpdk-dev] [PATCH] mem: fix deadlock on secondary allocation
From: Thomas Monjalon <hidden>
Date: 2021-01-29 23:38:00
29/01/2021 17:07, Burakov, Anatoly:
On 29-Jan-21 3:40 PM, Thomas Monjalon wrote:quoted
29/01/2021 16:29, Anatoly Burakov:quoted
Previous fix used `rte_malloc_heap_socket_is_external()` to check if the heap was an external heap. However, that API is thread-safe, and when we're inside the allocation process, we're already write-locked, so calling `rte_malloc_heap_socket_is_external()` will result in a deadlock followed by a timeout. Fix it by replacing the API call with a check against maximum number of NUMA nodes, because external heaps always have higher socket ID's.Is there some unit tests for such thing?I couldn't reproduce this using autotests, but Jim has SPDK tests which triggered this error. Since this is dependent upon secondary process, any test would necessarily have to be manual here, i think.quoted
quoted
Fixes: 7ac31e82bc8f ("mem: improve parameter checking on memory hotplug") Reported-by: Jim Harris <redacted>No need of blank line here.Need to update my scripts :Pquoted
quoted
Signed-off-by: Anatoly Burakov <redacted> ---
[...]
quoted
quoted
+ /* + * for allocations, we must only use internal heaps, but since the + * rte_malloc_heap_socket_is_external() is thread-safe and we're already + * read-locked, we'll have to take advantage of the fac that internalfac -> fact?Yes.quoted
quoted
+ * socket ID's are always lower than RTE_MAX_NUMA_NODES. + */
Applied with minor changes, thanks.