Skip to content

Make DPDK tailqs fully local

Anatoly Burakov dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7rte_tailq: change rte_dummy to rte_tailq_entry, add data pointerapp/test/test_tailq.c lib/librte_eal/common/eal_common_tailqs.c lib/librte_eal/common/include/rte_tailq.h+23 -210 replies
2/7rte_ring: make ring tailq completely locallib/librte_eal/linuxapp/eal/eal_ivshmem.c lib/librte_ring/Makefile lib/librte_ring/rte_ring.c +1 more+39 -140 replies
3/7rte_hash: make rte_hash tailq fully locallib/librte_hash/rte_hash.c lib/librte_hash/rte_hash.h+45 -110 replies
4/7rte_fbk_hash: make rte_fbk_hash tailq fully locallib/librte_hash/rte_fbk_hash.c lib/librte_hash/rte_fbk_hash.h+52 -170 replies
5/7rte_mempool: make mempool tailq fully locallib/librte_mempool/Makefile lib/librte_mempool/rte_mempool.c lib/librte_mempool/rte_mempool.h+30 -120 replies
6/7rte_lpm: make lpm tailq fully locallib/librte_lpm/rte_lpm.c lib/librte_lpm/rte_lpm.h+45 -110 replies
7/7rte_lpm6: make lpm6 tailq fully locallib/librte_lpm/rte_lpm6.c+44 -110 replies

Reviews trailers per patch

None of the 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKonstantin Ananyev
SeriesA-b
1/7
2/7
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/7] Make DPDK tailqs fully local

This issue was reported by OVS-DPDK project, and the fix should go to upstream DPDK. This is not memnic-related - this is to do with DPDK's rte_ivshmem library.

Every DPDK data structure has a corresponding TAILQ reserved for it in the runtime config file. Those TAILQs are fully local to the process, however most data structures contain pointers to next entry in the TAILQ.

Since the data structures such as rings are shared in their entirety, those TAILQ pointers are shared as well. Meaning that, after a successful rte_ring creation, the tailq_next pointer of the last ring in the TAILQ will be updated with a pointer to a ring which may not be present in the address space of another process (i.e. a ring that may be host-local or guest-local, and not shared over IVSHMEM). Any successive ring create/lookup on the other side of IVSHMEM will result in trying to dereference an invalid pointer.

This patchset fixes this problem by creating a default tailq entry that may be used by any data structure that chooses to use TAILQs. This default TAILQ entry will consist of a tailq_next/tailq_prev pointers, and an opaque pointer to arbitrary data. All TAILQ pointers from data structures themselves will be removed and replaced by those generic TAILQ entries, thus fixing the problem of potentially exposing local address space to shared structures.

Technically, only rte_ring structure require modification, because IVSHMEM is only using memzones (which aren't in TAILQs) and rings, but for consistency's sake other TAILQ-based data structures were adapted as well.

Anatoly Burakov (7):
rte_tailq: change rte_dummy to rte_tailq_entry, add data pointer
rte_ring: make ring tailq completely local
rte_hash: make rte_hash tailq fully local
rte_fbk_hash: make rte_fbk_hash tailq fully local
rte_mempool: make mempool tailq fully local
rte_lpm: make lpm tailq fully local
rte_lpm6: make lpm6 tailq fully local

 app/test/test_tailq.c                     | 33 ++++++++--------
 lib/librte_eal/common/eal_common_tailqs.c |  2 +-
 lib/librte_eal/common/include/rte_tailq.h |  9 +++--
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 14 ++++++-
 lib/librte_hash/rte_fbk_hash.c            | 66 ++++++++++++++++++++++++-------
 lib/librte_hash/rte_fbk_hash.h            |  3 --
 lib/librte_hash/rte_hash.c                | 54 ++++++++++++++++++++-----
 lib/librte_hash/rte_hash.h                |  2 -
 lib/librte_lpm/rte_lpm.c                  | 54 ++++++++++++++++++++-----
 lib/librte_lpm/rte_lpm.h                  |  2 -
 lib/librte_lpm/rte_lpm6.c                 | 55 ++++++++++++++++++++------
 lib/librte_mempool/Makefile               |  3 +-
 lib/librte_mempool/rte_mempool.c          | 37 ++++++++++++-----
 lib/librte_mempool/rte_mempool.h          |  2 -
 lib/librte_ring/Makefile                  |  4 +-
 lib/librte_ring/rte_ring.c                | 33 ++++++++++++----
 lib/librte_ring/rte_ring.h                |  2 -
 17 files changed, 278 insertions(+), 97 deletions(-)
Signature · 1 line
1.8.1.4