Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Oct 2013 16:39:46 -0400
From:      Patrick Kelsey <kelsey@ieee.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: why does /dev/md call cpu_dcache_flush()?
Message-ID:  <CAD44qMXG_jvAJy4R67gtG-7H=mxvKvdNYcR4gUTatn8FYg0img@mail.gmail.com>
In-Reply-To: <1381953459.1168.48.camel@revolution.hippie.lan>
References:  <1381953459.1168.48.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMXG_jvAJy4R67gtG-7H=mxvKvdNYcR4gUTatn8FYg0img>