why does /dev/md call cpu_dcache_flush()?

Patrick Kelsey kelsey at ieee.org
Wed Oct 16 20:39:48 UTC 2013


Perhaps it is along the lines of what the comment on most of the
implementations suggests:

/*
 * Flush the D-cache for non-DMA I/O so that the I-cache can
 * be made coherent later.
 */
void
cpu_flush_dcache(void *ptr, size_t len)


On a malloc-backed md, servicing a read may result in a D-cache to
D-cache transfer if the source and destination buffers are already at
least partially in the D-cache.  If the originator of the read plans
on executing the read data, the I-cache won't find what was just read
if part of the read was handled by an intra-D-cache transfer, unless
the buffer the data was read into is flushed out to memory first (or I
suppose, technically, unless your hardware I-cache happens to check
the D-cache also, or they are unified).


-Patrick

On Wed, Oct 16, 2013 at 3:57 PM, Ian Lepore <ian at freebsd.org> wrote:
> The only caller of cpu_dcache_flush() in the entire system appears to be
> the md device.  Does anybody know why it makes the call?
>
> -- Ian
>
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"


More information about the freebsd-hackers mailing list