<div dir="ltr">Hello, <div><br></div><div>I found a second free command in my code and removed it. David pointed to the right .</div><div><br></div><div>On the other hand, do you think we need to avoid miscalculations? Is it better to patch it or not?<br></div><div><br></div><div>or it needs to be aware of the second free command. </div><div><br></div><div>Sharing more information about env.</div><div><br></div><div># 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<br></div><div><br></div><div>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"<br></div><div><br></div><div>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<br></div><div><br></div><div><br></div><div><br></div>Best regards.<div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Morten Brørup <<a href="mailto:mb@smartsharesystems.com" target="_blank">mb@smartsharesystems.com</a>>, 17 May 2023 Çar, 15:23 tarihinde şunu yazdı:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> 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.<br>
<br>
</blockquote></div></div></div>