<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=utf-8"><meta name=Generator content="Microsoft Word 12 (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;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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=blue vlink=purple><div class=WordSection1><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Yasin CANER [mailto:yasinncaner@gmail.com] <br><b>Sent:</b> Thursday, 18 May 2023 10.37<br><br></span></p><div><p class=MsoNormal>Hello, <o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I found a second free command in my code and removed it. David pointed to the right .<o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>MB: Good to hear.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p></div><div><p class=MsoNormal>On the other hand, do you think we need to avoid miscalculations? Is it better to patch it or not?<o:p></o:p></p></div><div><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>MB: There is no bug in the library, so no need to patch it. The returned value was a consequence of using the library incorrectly (freeing twice).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p></div><div><p class=MsoNormal>or it needs to be aware of the second free command. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Sharing more information about env.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal># ethtool -i mgmt<br>driver: virtio_net<br>version: 1.0.0<br>firmware-version:<br>expansion-rom-version:<br>bus-info: 0000:00:03.0<br>supports-statistics: yes<br>supports-test: no<br>supports-eeprom-access: no<br>supports-register-dump: no<br>supports-priv-flags: no<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>NAME="Ubuntu"<br>VERSION="20.04.4 LTS (Focal Fossa)"<br>ID=ubuntu<br>ID_LIKE=debian<br>PRETTY_NAME="Ubuntu 20.04.4 LTS"<br>VERSION_ID="20.04"<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Linux spgw-dpdk 5.4.0-146-generic #163-Ubuntu SMP Fri Mar 17 18:26:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>Best regards.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Morten Brørup <<a href="mailto:mb@smartsharesystems.com" target="_blank">mb@smartsharesystems.com</a>>, 17 May 2023 Çar, 15:23 tarihinde şunu yazdı:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><p class=MsoNormal style='margin-bottom:12.0pt'>> From: David Marchand [mailto:<a href="mailto:david.marchand@redhat.com" target="_blank">david.marchand@redhat.com</a>]<br>> Sent: Wednesday, 17 May 2023 13.53<br>> <br>> On Wed, May 17, 2023 at 11:05 AM Morten Brørup <<a href="mailto:mb@smartsharesystems.com" target="_blank">mb@smartsharesystems.com</a>><br>> wrote:<br>> > > On Tue, 16 May 2023 13:41:46 +0000<br>> > > Yasin CANER <<a href="mailto:yasinncaner@gmail.com" target="_blank">yasinncaner@gmail.com</a>> wrote:<br>> > ><br>> > > > From: Yasin CANER <<a href="mailto:yasin.caner@ulakhaberlesme.com.tr" target="_blank">yasin.caner@ulakhaberlesme.com.tr</a>><br>> > > ><br>> > > > after a while working rte_mempool_avail_count function returns bigger<br>> > > > than mempool size that cause miscalculation rte_mempool_in_use_count.<br>> > > ><br>> > > > it helps to avoid miscalculation rte_mempool_in_use_count.<br>> <br>> Is this issue reproduced with an application of the reporter, or a<br>> DPDK in-tree application?<br>> <br>> <br>> > > ><br>> > > > Bugzilla ID: 1229<br>> > > ><br>> > > > Signed-off-by: Yasin CANER <<a href="mailto:yasin.caner@ulakhaberlesme.com.tr" target="_blank">yasin.caner@ulakhaberlesme.com.tr</a>><br>> > ><br>> > > An alternative that avoids some code duplication.<br>> > ><br>> > > diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c<br>> > > index cf5dea2304a7..2406b112e7b0 100644<br>> > > --- a/lib/mempool/rte_mempool.c<br>> > > +++ b/lib/mempool/rte_mempool.c<br>> > > @@ -1010,7 +1010,7 @@ rte_mempool_avail_count(const struct rte_mempool<br>> > > *mp)<br>> > > count = rte_mempool_ops_get_count(mp);<br>> > ><br>> > > if (mp->cache_size == 0)<br>> > > - return count;<br>> > > + goto exit;<br>> ><br>> > This bug can only occur here (i.e. with cache_size==0) if<br>> rte_mempool_ops_get_count() returns an incorrect value. The bug should be<br>> fixed there instead.<br>> ><br>> ><br>> ><br>> > MB (continued): The bug must be in the underlying mempool driver. I took a<br>> look at the ring and stack drivers, and they seem fine.<br>> <br>> Or it could indicate a double free (or equivalent) issue from the<br>> application (either through direct call to mempool API, or indirectly<br>> like sending/freeing an already sent/freed packet for example).<br><br>Good point, David.<br><br>@Yasin, if you build DPDK and your application with RTE_LIBRTE_MEMPOOL_DEBUG set in config/rte_config.h, the mempool cookies should catch any double frees.<o:p></o:p></p></blockquote></div></div></div></div></div></body></html>