bus_dmamap_load_mbuf_sg failures

Thomas Skibo thomas-bsd at skibo.net
Sun May 24 21:41:40 UTC 2020


Hello.

I just tracked down a bug in a network driver on an arm64 system I am
tinkering with.  It seems when bus_dmamap_load_mbuf_sg() fails with EFBIG
due to too many segments, things are not cleaned up and it causes the 
subsequent attempt at bus_dmamap_load_mbuf_sg() with the defragged mbuf to
fail too (EFBIG again).

I noticed that in the arm version of busdma_machdep.c, when 
_bus_dmamap_load_buffer() fails with EFBIG, it calls bus_dmamap_unload() on
exit which cleans up the dma map.  In the arm64 version of busdma_bounce.c,
when bounce_bus_dmamap_load_buffer() fails, it does not.  Is this a bug or
are we expected to call bus_dmamap_unload() on a failed bus_dmamap_load* call?

I looked around at other architectures and it is inconsistent: arm and mips
do the unload but x86, arm64, and riscv do not.

--Thomas

=====
Thomas Skibo
thomas-bsd at skibo.net



More information about the freebsd-arm mailing list