lib/mempool: mempool walk not synchronized with mempool free

Sanford, Robert rsanford at akamai.com
Fri Jun 24 13:19:47 CEST 2022


Hello guys,

I was surprised to discover that rte_mempool_walk()
occasionally passes a NULL rte_mempool pointer to the callback.
Concurrently in other threads of our app, we may invoke
rte_mempool_create() or rte_mempool_free().

Upon further inspection, we see:
1. rte_mempool_create_empty holds both the mcfg_mempool and
   mcfg_tailq locks (write mode).
2. rte_mempool_free holds only the mcfg_tailq lock (write mode).
3. rte_mempool_list_dump, rte_mempool_lookup, and
   rte_mempool_walk hold only the mcfg_mempool lock (read mode).

I believe all functions in #3 might need to hold both the
mcfg_mempool and mcfg_tailq locks (read mode).

I haven't studied the code enough to say whether
rte_mempool_free requires any changes.

What do you guys think?

--
Thanks for your time,
Robert



More information about the users mailing list