Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 May 2020 14:41:28 -0700
From:      Thomas Skibo <thomas-bsd@skibo.net>
To:        freebsd-arm@freebsd.org
Subject:   bus_dmamap_load_mbuf_sg failures
Message-ID:  <20200524214128.GA3881@piedmont>

next in thread | raw e-mail | index | archive | help

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@skibo.net




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200524214128.GA3881>