[dpdk-dev] DPDK (and rte_*alloc family) friendly Valgrind

Luca Boccassi lboccass at Brocade.com
Sat Feb 13 13:30:19 CET 2016


On Thu, 2016-02-11 at 08:34 +0100, Thomas Monjalon wrote:
> 2016-02-10 22:54, Luca Boccassi:
>  I created a set of patches for Valgrind that add support for the
> > rte_*alloc family of functions. We use it for memcheck (I added support
> > for other all the other Valgrind tools like cachegrind as well, but it's
> > less tested), and find it extremely useful, since the vanilla version
> > cannot intercept and report leaks cause by rte_*alloc functions from
> > librte_malloc.
> 
> Thank you Luca.
> I think it deserves to be visible in the DPDK doc.
> What about adding some explanations in
> https://urldefense.proofpoint.com/v2/url?u=http-3A__dpdk.org_doc_guides_prog-5Fguide_profile-5Fapp.html&d=CwICAg&c=IL_XqQWOjubgfqINi2jTzg&r=QTEM8ICX7t_SLgWP3qPWtKiwKMps487LPWQx-B9AqIc&m=QXy2HY_6FCRpB2dqb0AfDLoTIJ2MpHaKS_Bd5WKYgMQ&s=d4OWq_1QIlrYTxkCHIsQqn7p0887PWo4RaYa7PZeeII&e= 
> or
> https://urldefense.proofpoint.com/v2/url?u=http-3A__dpdk.org_doc_guides_prog-5Fguide_env-5Fabstraction-5Flayer.html-23malloc&d=CwICAg&c=IL_XqQWOjubgfqINi2jTzg&r=QTEM8ICX7t_SLgWP3qPWtKiwKMps487LPWQx-B9AqIc&m=QXy2HY_6FCRpB2dqb0AfDLoTIJ2MpHaKS_Bd5WKYgMQ&s=J36uf3GxS8AuoM2eQje4VTbXuF4WLmxGKIXM3RslaOA&e= 
> ?

Hi Thomas,

Thanks, anything I could help with for that to happen?

Also, a few words about the actual implementation.

Valgrind re-implements the whole *alloc and friends internally. There is
a common framework shared between the various tools, and each builds on
top of it.

What I've done is to map the various rte_*alloc/free functions on top of
Valgrind's implementation of posix_memalign/free. This was done in order
to respect the cache alignment parameter of rte_malloc and friends. I've
tested to make sure that this works correctly, as we rely heavily upon
it.

I have not, however, implemented support for NUMA sockets. There is no
such concept inside Valgrind's framework at the moment, so it would be a
monumental task. The NUMA socket parameter will simply be ignored. I do
not believe it would be very useful to implement support for it, as it
doesn't add much. For the purpose of memory leaks detection, I don't
think it matters much on which socket a memory block is allocated.

This might have an effect on cachegrind though, so it's worth noting and
bearing it in mind when using cachegrind rather than memcheck.

I've added a note on Github.

-- 
Kind regards,
Luca Boccassi


More information about the dev mailing list