Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bus_dma issue with wm(4) on arm




> On Jul 21, 2019, at 12:15 PM, Tobias Nygren <tnn%NetBSD.org@localhost> wrote:
> 
> Hi!
> 
> Due to rx performance issues with onboard awge(4) I tried to plug a PCI
> express wm(4) card into an aarch64 host.
> 
> It hits a KASSERT in bus_dmamap_sync:
> 
> panic: kernel diagnostic assertion
> "(va & PAGE_MASK) == (pa & PAGE_MASK)" failed:
> file "/work/src/sys/arch/arm/arm32/bus_dma.c", line 811
> va 0xffff0000ee2d2802 pa 0xee2d2800
> _bus_dmamap_sync_segment.isra.3()
> _bus_dmamap_sync_segment.isra.3+0x194
> _bus_dmamap_sync()
> wm_rxeof()
> 
> the 2 in the lower bits of the va comes from wm's sc_align_tweak:
> 
> wm_init_rxdesc() {
> ...
> 	m->m_data = m->m_ext.ext_buf + sc->sc_align_tweak;
> ...
> }
> 
> Setting sc_align_tweak to 0 does seem to make the problem go away.
> 
> Now the question is if this is a bug in wm(4) or in the MD bus_dma
> implementation? I guess what happens is:
> 
> 1) bus_dmamap_load_mbuf() sets up DMA segment
> 2) wm adjusts m_data
> 3) wm calls bus_dmamap_sync() but mbuf previously loaded and DMA
>   segment now point to slightly different locations

Yah, I would call this a bug in the wm driver.  Probably the easiest fix for the Rx buffer case would be to use bus_dmamap_load() with m->m_ext.ext_data rather than bus_dmamap_load_mbuf().  (This will be fine since the Rx buffers are always single DMA segment when sc_align_tweak != 0). 

> 
> Kind regards,
> -Tobias

-- thorpej



Home | Main Index | Thread Index | Old Index