Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two dpdk assert happened in dpdk library. #18409

Merged
merged 1 commit into from Oct 24, 2017

Conversation

liu-chunmei
Copy link
Contributor

fix two assert happened in dpdk library.
1.RTE_ASSERT(mp->elt_size >= sizeof(struct rte_mbuf) +
user_mbp_priv->mbuf_data_room_size +
user_mbp_priv->mbuf_priv_size); in rte_pktmbuf_pool_init
2.RTE_ASSERT(rte_mbuf_refcnt_read(m) == 0) in rte_mbuf_raw_alloc
in DPDKQueuePair::init_rx_mbuf_pool,
_pktmbuf_pool_rx = rte_mempool_create(
name.c_str(),
mbufs_per_queue_rx, mbuf_overhead,
mbuf_cache_size,
sizeof(struct rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init, as_cookie(roomsz),
rte_pktmbuf_init, nullptr,
rte_socket_id(), 0);
the mbuf_overhead(elt_size) is smaller than roomsz, so cause the first assert in dpdk library.

in DPDKQueuePair::init_rx_mbuf_pool when put _rx_free_bufs back to mempool, not clear refcnt, so when next allocate_rx_queue_mbufs cause rte_mbuf_raw_alloc assert happen.

Signed-off-by: chunmei chunmei.liu@intel.com

1.RTE_ASSERT(mp->elt_size >= sizeof(struct rte_mbuf) +
		user_mbp_priv->mbuf_data_room_size +
		user_mbp_priv->mbuf_priv_size); in rte_pktmbuf_pool_init
2.RTE_ASSERT(rte_mbuf_refcnt_read(m) == 0) in rte_mbuf_raw_alloc

Signed-off-by: chunmei <chunmei.liu@intel.com>
static constexpr uint16_t mbuf_overhead =
sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM;
sizeof(struct rte_mbuf) + mbuf_data_size + RTE_PKTMBUF_HEADROOM;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need to increase mbuf_data_size to overhead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not, will cause assert 1, see assert 1 it will check the size.

@@ -531,6 +532,7 @@ bool DPDKQueuePair::init_rx_mbuf_pool()
for (int i = 0; i < mbufs_per_queue_rx; i++) {
rte_mbuf* m = rte_pktmbuf_alloc(_pktmbuf_pool_rx);
assert(m);
rte_mbuf_refcnt_update(m, -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not clear refcnt here, will cause assert 2

@yuyuyu101 yuyuyu101 merged commit 9f5b368 into ceph:master Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants