<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hello,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">We have run into a timing issue between threads when using the memif interface type and need some guidance.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Our application has a DPDK based process operating (among other things) a memif server interface. The problem is exposed when this memif interface receives a memif.disconnect message from the remote client,
while in the middle of an rte_eth_rx_burst() on this same memif interface. As the IRQ message handling is on its own thread as compared to the DPDK worker thread doing the rx_burst, this resulted in a crash. The backtraces for which have been shared below.
How does one ensure there are guard rails in place to gracefully exit the rx-burst when a disconnect occurs? Or, how do we properly modify the code such that we defer responding to the disconnect CB after the rx-burst operation has completed?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">We are utilizing DPDK 21.11.2. I have diff’d dpdks-stable:22.11.3 in ./drivers/net/memif, but I do not see anything obvious that would address this. I did a similar diff for dpdk:23.07, but do not see anything
obvious there either.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">-Mike</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">(gdb) thread 1</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">[Switching to thread 1 (Thread 0x7f17e2813600 (LWP 470))]</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#0 0x00007f17e374d225 in eth_memif_rx (queue=0x1189023b00, bufs=0x7f17e28100e8, nb_pkts=32) at ../git/drivers/net/memif/rte_eth_memif.c:338</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">338 last_slot = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">(gdb) bt</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#0 0x00007f17e374d225 in eth_memif_rx (queue=0x1189023b00, bufs=0x7f17e28100e8, nb_pkts=32) at ../git/drivers/net/memif/rte_eth_memif.c:338</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#1 0x000000000047e6fb in rte_eth_rx_burst (nb_pkts=32, rx_pkts=0x7f17e28100e8, queue_id=0, port_id=<optimized out>) at /usr/include/rte_ethdev.h:5368</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#2 pmd_main_loop () at ../git/swfw/api/src/swfwPmd.c:1086</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#3 0x000000000047f309 in pmd_launch_one_lcore (dummy=<optimized out>) at ../git/my_process.c:1157</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#4 0x00007f17f7070e7c in eal_thread_loop (arg=<optimized out>) at ../git/lib/eal/linux/eal_thread.c:146</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#5 0x00007f17f4c3da72 in start_thread (arg=<optimized out>) at pthread_create.c:442</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#6 0x00007f17f4cbf930 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">(gdb) l</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">333 ring_size = 1 << mq->log2_ring_size;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">334 mask = ring_size - 1;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">335</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">336 if (type == MEMIF_RING_C2S) {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">337 cur_slot = mq->last_head;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">338 last_slot = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">339 } else {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">340 cur_slot = mq->last_tail;</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">341 last_slot = __atomic_load_n(&ring->tail, __ATOMIC_ACQUIRE);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">342 }</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">(gdb) p ring->head</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">Cannot access memory at address 0x7f17d8e58006</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">(gdb) thread 19</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">[Switching to thread 19 (Thread 0x7f17f0804600 (LWP 468))]</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#0 0x00007f17f4caf97b in __GI___close (fd=494) at ../sysdeps/unix/sysv/linux/close.c:27</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">27 return SYSCALL_CANCEL (close, fd);</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">(gdb) bt</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#0 0x00007f17f4caf97b in __GI___close (fd=494) at ../sysdeps/unix/sysv/linux/close.c:27</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#1 0x00007f17e374f01f in memif_free_regions (dev=dev@entry=0x7f17f727f000 <rte_eth_devices+99072>) at ../git/drivers/net/memif/rte_eth_memif.c:882</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#2 0x00007f17e37475d0 in memif_disconnect (dev=0x7f17f727f000 <rte_eth_devices+99072>) at ../git/drivers/net/memif/memif_socket.c:623</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#3 0x00007f17f7091bd2 in eal_intr_process_interrupts (nfds=<optimized out>, events=<optimized out>) at ../git/lib/eal/linux/eal_interrupts.c:1026</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#4 eal_intr_handle_interrupts (totalfds=<optimized out>, pfd=20) at ../git/lib/eal/linux/eal_interrupts.c:1100</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#5 eal_intr_thread_main (arg=<optimized out>) at ../git/lib/eal/linux/eal_interrupts.c:1172</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#6 0x00007f17f4c3da72 in start_thread (arg=<optimized out>) at pthread_create.c:442</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Courier New"">#7 0x00007f17f4cbf930 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>