Using the Valgrind Framework to Build a Persistent Memory Error Detector


Persistent Memory was a hot topic at LinuxCon Europe with at least three talks from the team involved in developing the Non-Volatile Memory Library (NVML), including an overview of persistent memory in Linux and extending libstdc++ and libc++ for easier persistent memory programming. In the last talk on this topic from LinuxCon Europe, Krzysztof Czurylo, Software Architect at Intel, goes into detail about using the Valgrind framework to build a persistent memory error detector.

Czurylo started with an overview of persistent memory and the SNIA NVM Programming Model, which was covered in more detail in the blog posts for the other two talks in this series. He quickly moved on to talk about some of the issues and the tools they needed to build to solve them. Specifically, they needed a persistent memory error detection tool that could:

  • Differentiate between volatile and persistent memory regions.
  • Detect stores that were not flushed to persistence.
  • Detect stores that were overwritten before being made persistent.
  • Detect superfluous flushes.
  • Support persistent memory transactions.
  • Simulate failure / flush reordering.

They were thinking about writing some tools from scratch, but Czurylo said that eventually they decided to use Valgrind, which is a popular tool that supports multiple platforms and is already widely used by the community. Valgrind is also feature-rich with low-level instrumentation and good multi-threading support. More specifically, Valgrind already performs a lot of what they needed in a persistent memory error detection tool, since it already tracks changes to memory, so they only needed to write tools that allowed Valgrind to detect whether the order of operations is correct. One nice feature of Valgrind is that it already has a client request mechanism, which allows them to inject specific persistent memory requests or queries into the code. However, there are a couple of downsides. The API isn’t well documented and can be difficult to use, and there are also performance issues where the execution is a couple of times slower when you run your program using this tool. 

The Valgrind pmemcheck tool is still evolving with several new features and other improvements being planned. Future work includes store reordering, ADR support / detection, performance tuning, upstreaming to the Valgrind repositories, and more.

Watch the video of Czurylo’s talk to get all of the details about using the Valgrind pmemcheck tools.

Interested in speaking at Open Source Summit North America on September 11-13? Submit your proposal by May 6, 2017. Submit now>>

Not interested in speaking but want to attend? readers can register now with the discount code, LINUXRD5, for 5% off the all-access attendee registration price. Register now to save over $300!