title: How would one prevent MMAP from caching values?
body: <p>I've written a linux driver that ioremaps exports PCI BAR0 for a particular device to a sysfs binary attribute allowing userspace to directly control it.</p>
  
  <p>The problem rears when I attempt to MMAP on top of the attribute to directly access that bit of memory (from a userland program).  Reads succeed just fine and return expected values, though when I write to that memory it appears to be cached somewhere between the kernel and memory and not delivered to the GMCH root complex (and therefore the device).  What I'd like to do is have an implicit write memory barrier after each access.</p>
  
  <ul>
  <li>Is there any way to prevent the kernel from caching writes to a mmap-ed bit of memory?</li>
  </ul>
  
  <p>Follow ups:</p>
  
  <ul>
  <li>Is calling <a href="http://linux.die.net/man/2/msync">msync()</a> after every access the "accepted" way to do this?</li>
  </ul>