217
We remove persistent memory mapping identification from pmemcheck using the
VALGRIND_PMC_REMOVE_PMEM_MAPPING macro. As mentioned earlier, this is useful when
you want to exclude parts of persistent memory from the analysis. Listing 12-10 shows
executing pmemcheck with the modified code in Listing 12-9, which now reports a
problem.
Listing 12-10. Running pmemcheck with code Listing 12-9
$ valgrind --tool=pmemcheck ./listing_12-9
==8904== pmemcheck-1.0, a simple persistent store checker
...
==8904== Number of stores not made persistent: 1
==8904== Stores not made persistent properly:
==8904== [0]
at 0x4008B4: main (listing_12-9.c:56)
==8904==
Address: 0x4027000
size: 4 state: DIRTY
==8904== Total memory not made persistent: 4
==8904== ERROR SUMMARY: 1 errors
See that pmemcheck detected that data is not being flushed after a write in
listing_12-9.c, line 56. To fix this, we create a new flush() function, accepting an
address and size, to flush all the CPU cache lines storing any part of the data using the
CLFLUSH machine instruction (__mm_clflush()). Listing 12-11 shows the modified
code.
Listing 12-11. Example of writing to persistent memory using Valgrind with
flushing
33 #include
34 #include
35 #include
36 #include
37 #include
38 #include
39
Chapter 12 Debugging persistent MeMory appliCations
Précédent

- 241/457

Suivant