Page MenuHomeFreeBSD

xen/blkfront: WRITE_BARRIER and FLUSH_DISKCACHE require barrier
Needs ReviewPublic

Authored by on Tue, Apr 6, 1:04 AM.



For WRITE_BARRIER and FLUSH_DISKCACHE operation, we don't request any cache
operation. This will result to a panic in _bus_dmamap_sync on ARM because the
operation (op = 0) is not supported.

x86 platform doesn't seem to care about this and Xen is always requiring
memory shared with the backend to be cacheable. I'm wondering if we could drop
the call to bus_dmasync_map because the cache maintainance slows down the
process for no appareant reason?

For now, WRITE_BARRIER and FLUSH_DISKCACHE are an extension of the WRITE
command so require BUS_DMASYNC_PREWRITE for the cache maintenance operation.

Submitted by: Elliott Mitchell <>
Original implementation: Julien Grall <>, 2015-10-05 10:35:43

Diff Detail

rS FreeBSD src repository - subversion
Lint OK
No Unit Test Coverage
Build Status
Buildable 38347
Build 35236: arc lint + arc unit

Event Timeline

The commit message needs to be adjusted, as it contains a question. All memory shared with Xen is of type WB (the default attribute), but I'm not sure I see the point of the question, the bus_dmamap_sync checks that the submitted segments match the requirement of the underlying device in terms of aligments, sizes and boundaries, or else bounces it to some temporary memory. This cannot be avoided AFAICT. A very good test for the dmamap stuff is newfs, which tends to do weird block writes that trigger the dmamap bouncing for blkfront IIRC.


Aren't you missing the POST sides of those? I think a similar adjustment should be done in xbd_int for the POSTREAD/POSTWRITE variants?


If Arm bus_dmamap_sync panics when op == 0, we likely want to do:

if (op != 0)
    bus_dmamap_sync(sc->xbd_io_dmat, cm->cm_map, op);