DPDK usage discussions
 help / color / mirror / Atom feed
* DPDK 22.11 - How to fix memory leak for KNI - How to debug
@ 2023-05-04  7:32 Yasin CANER
  2023-05-04 13:00 ` Yasin CANER
  0 siblings, 1 reply; 13+ messages in thread
From: Yasin CANER @ 2023-05-04  7:32 UTC (permalink / raw)
  To: users

[-- Attachment #1: Type: text/plain, Size: 4167 bytes --]

Hello all,

I think there is a memory leak for KNI.

Firstly, try to active trace modüle to follow memory management but could not. İt doesn't create file and dont have any clue.

Run Command : -c dpdk_core_mask -d librte_net_virtio.so -d librte_mbuf.so -d librte_mempool.so -d librte_mempool_ring.so -d librte_mempool_stack.so -d librte_mempool_bucket.so -d librte_kni.so --log-level lib.kni:debug --log-level lib.eal:debug --log-level lib.ethdev:debug --trace=kni --trace-dir=/tmp/


Secondly, I used followed functions.

``code
  used_mpool  = rte_mempool_in_use_count(rdpdk_cfg->mbuf_pool);
  count_mpool = rte_mempool_avail_count(rdpdk_cfg->mbuf_pool);
``

After calling function rte_kni_rx_burst, 32 unit is allocated. Then i force to free message_buf (mbuf). It frees 1 unit. 31 units left in memory!


How to fix or understand this issue.
Follow logs,




  1.  (59383)  6:55:10    lrtc():3212> [KNI]Picked up 1 packets from port 0 [KNI:F000]   --> 1 packet is received from Kernel that is allocate 32 unit
  2.  (59383)  6:55:10   print_mempool_tx():2511> [UseCount_mpool:468][avail_mpool:9931]
  3.  (59383)  6:55:10    pkni():2536> [KNI] i:0/1
  4.  (59383)  6:55:10    pkni():2616> [KNI][EGR]  P:[IPv6]  P:[0] [fe80::f816:3eff:fe93:f5fd]->[ff02::2] --> Packet is a broadcast packet IPv6
  5.  (59383)  6:55:10    pkni():2620> [KNI][EGR][pkt-len:70]
  6.  (59383)  6:55:10   print_mempool_tx():2511> [UseCount_mpool:467][avail_mpool:9932] --> mbuf is freed to understand mem-leak. İt is same happens after calling rte_eth_tx_burst
  7.  (59383)  6:55:10    lrtc():3212> [KNI]Picked up 1 packets from port 1 [KNI:F000] --> 1 packet is received from Kernel that is allocate 32 unit 9932 to 9900 then same process happens and 31 units is not freed.
  8.  (59383)  6:55:10   print_mempool_tx():2511> [UseCount_mpool:499][avail_mpool:9900]
  9.  (59383)  6:55:10    pkni():2536> [KNI] i:0/1
  10. (59383)  6:55:10    pkni():2616> [KNI][EGR]  P:[IPv6]    P:[1] [fe80::f816:3eff:fed2:9101]->[ff02::2]
  11. (59383)  6:55:10    pkni():2620> [KNI][EGR][pkt-len:70]
  12. (59383)  6:55:10   print_mempool_tx():2511> [UseCount_mpool:498][avail_mpool:9901]


Kernel : 5.4.0-146-generic #163-Ubuntu SMP Fri Mar 17 18:26:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 20.04
DPDK dpdk-stable-22.11.1
İgb_uio is used.

Best regards.
___
Yasin CANER
Lider Mühendis
Ulak Haberleşme A.Ş. Ankara


Bu elektronik posta ve onunla iletilen bütün dosyalar sadece göndericisi tarafından alması amaçlanan yetkili, gerçek ya da tüzel kişinin kullanımı içindir. Eğer söz konusu yetkili alıcı değilseniz, bu elektronik postanın içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve kullanmanız kesinlikle yasaktır ve bu elektronik postayı derhal silmeniz gerekmektedir. Şirketimiz bu mesajın içerdiği bilgilerin doğruluğu veya eksiksiz olduğu konusunda herhangi bir garanti vermemektedir. Bu nedenle, bu bilgilerin ne şekilde olursa olsun içeriğinden, iletilmesinden, alınmasından ve saklanmasından sorumlu değildir. Bu mesajdaki görüşler yalnızca gönderen kişiye aittir ve Şirketimizin görüşlerini yansıtmayabilir. Tarafınız ile paylaşılan kişisel verilerin, 6698 sayılı Kişisel Verilerin Korunması Kanununa uygun olarak işlenmesi gereğini bilginize sunarız.

________________________________

This e-mail and all files sent with it are intended for authorized natural or legal persons, who should be the only persons to open and read them. If you are not an authorized recipient, you are strictly prohibited from disclosing, copying, forwarding, and using the contents of this e-mail, and you must immediately delete it. Our company does not guarantee the accuracy or thoroughness of the information contained in this message. It is therefore in no way responsible for the content, sending, retrieval and storage of this information. The opinions contained in this message are the views of the sender only and do not necessarily reflect the views of the company. We would like to inform you that any personal data shared with you should be processed in accordance with the Law on Protection of Personal Data numbered 6698.

[-- Attachment #2: Type: text/html, Size: 13339 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread
* DPDK 22.11 - How to fix memory leak for KNI - How to debug
@ 2023-05-08  6:01 Yasin CANER
  2023-05-08 16:18 ` Stephen Hemminger
  0 siblings, 1 reply; 13+ messages in thread
From: Yasin CANER @ 2023-05-08  6:01 UTC (permalink / raw)
  To: users, stephen

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

Hello Stephen,

Thank you for response, it helps me a lot. I understand problem better.

After reading mbuf library (
https://doc.dpdk.org/guides/prog_guide/mempool_lib.html)  i realized that
31 units allocation memory slot doesn't return to pool!

1 unit mbuf can be freed via rte_pktmbuf_free so it can back to pool.

Main problem is that allocation doesn't return to original pool, act as
used. So, after following rte_pktmbuf_free
<http://doc.dpdk.org/api/rte__mbuf_8h.html#a1215458932900b7cd5192326fa4a6902>
function,
i realized that there is 2 function to helps to mbufs back to pool.

These are rte_mbuf_raw_free
<http://doc.dpdk.org/api/rte__mbuf_8h.html#a9f188d53834978aca01ea101576d7432>
 and rte_pktmbuf_free_seg
<http://doc.dpdk.org/api/rte__mbuf_8h.html#a006ee80357a78fbb9ada2b0432f82f37>.
I will focus on them.

If there is another suggestion, I will be very pleased.

Best regards.

Yasin CANER
Ulak

[-- Attachment #2: Type: text/html, Size: 1569 bytes --]

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

end of thread, other threads:[~2023-05-29  6:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04  7:32 DPDK 22.11 - How to fix memory leak for KNI - How to debug Yasin CANER
2023-05-04 13:00 ` Yasin CANER
2023-05-04 16:14   ` Stephen Hemminger
2023-05-08  6:01 Yasin CANER
2023-05-08 16:18 ` Stephen Hemminger
2023-05-09 11:13   ` Yasin CANER
2023-05-11 14:14     ` Yasin CANER
2023-05-17 17:53     ` Ferruh Yigit
2023-05-18  8:14       ` Yasin CANER
2023-05-18 14:56         ` Ferruh Yigit
2023-05-19 17:47           ` Yasin CANER
2023-05-19 18:43             ` Ferruh Yigit
2023-05-29  6:33               ` Yasin CANER

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).