DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] How to free a rte_mempool buffer
@ 2019-03-21  8:48 宋捷
  2019-03-21 10:51 ` Van Haaren, Harry
  0 siblings, 1 reply; 2+ messages in thread
From: 宋捷 @ 2019-03-21  8:48 UTC (permalink / raw)
  To: users, 'Van Haaren, Harry'

Hi All,

 

I test my DPDK program in VM Ubuntu (in VMware) with the two virtual
NICs(VMXNET3 and e1000).

 

I create a rte_mempool buffer by rte_pktmbuf_pool_create, and load some
packets from a pcap file into this buffer. I can sending these packets by
rte_eth_tx_burst successfully.

 

Now I want to load another pcap file, then I free the previous rte_mempool
buffer by rte_mempool_free, and create a new rte_mempool buffer,

But a crash will be occurred at rte_eth_tx_burst Both in VMXNET3 and e1000.

 

I traced the code and found the crash point as below: 

The VMXNET3 driver: crash at:

vmxnet3_xmit_pkts->vmxnet3_tq_tx_complete->vmxnet3_unmap_pkt->rte_pktmbuf_fr
ee(mbuf);  (mbuf = txq->cmd_ring.buf_info[eop_idx].m;)

 

The e1000 driver: crash at:

eth_em_xmit_pkts->rte_pktmbuf_free_seg(txe->mbuf); 

 

 

I think rte_mempool_free side effects the driver’s TX ring, but don’t know
how to fix this issue?

 

How can we free a rte_mempool buffer safely?

 

 

Thanks

 

Jie

 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] How to free a rte_mempool buffer
  2019-03-21  8:48 [dpdk-users] How to free a rte_mempool buffer 宋捷
@ 2019-03-21 10:51 ` Van Haaren, Harry
  0 siblings, 0 replies; 2+ messages in thread
From: Van Haaren, Harry @ 2019-03-21 10:51 UTC (permalink / raw)
  To: songj, users

Hi Jie,

Answers inline

> From: 宋捷 [mailto:songj@zctt.com] 
> Sent: Thursday, March 21, 2019 8:48 AM
> To: users@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>
> Subject: How to free a rte_mempool buffer
>
> Hi All,
>
> I test my DPDK program in VM Ubuntu (in VMware) with the two virtual NICs(VMXNET3 and e1000).
>
> I create a rte_mempool buffer by rte_pktmbuf_pool_create, and load some packets from a pcap file into this buffer. I can sending these packets > by rte_eth_tx_burst successfully.
>
> Now I want to load another pcap file, then I free the previous rte_mempool buffer by rte_mempool_free, and create a new rte_mempool buffer,
> But a crash will be occurred at rte_eth_tx_burst Both in VMXNET3 and e1000.
>
> I traced the code and found the crash point as below: 
> The VMXNET3 driver: crash at:
> vmxnet3_xmit_pkts->vmxnet3_tq_tx_complete->vmxnet3_unmap_pkt->rte_pktmbuf_free(mbuf);  (mbuf = txq->cmd_ring.buf_info[eop_idx].m;)
>
> The e1000 driver: crash at:
> eth_em_xmit_pkts->rte_pktmbuf_free_seg(txe->mbuf); 

Correct - when you free the mempool any mbufs that are currently in use are indirectly invalidated.
The reason for this is that each mbuf has a mempool pointer, and when an mbuf is freed, it uses the
pool pointer to return it to the correct mempool.

Given that the mempool has been freed, this is now Undefined Behaviour.


> I think rte_mempool_free side effects the driver’s TX ring, but don’t know how to fix this issue?
> How can we free a rte_mempool buffer safely?

It is not possible to free a mempool while a NIC is still using it.

I suggest to two different mempools: one for the NIC queues, and the other for loading pcap files.
Then you can leave the NIC mempool intact, and free/re-allocate the pcap mempool as required.


> Thanks
> Jie

Regards, -Harry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-21 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21  8:48 [dpdk-users] How to free a rte_mempool buffer 宋捷
2019-03-21 10:51 ` Van Haaren, Harry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).