git: 4fc30b0186b6 - stable/14 - LinuxKPI: be more verbose on _bus_dmamap_load_phys failures if debug is on
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Apr 2025 14:36:52 UTC
The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4fc30b0186b628013ef566d376526e427644cf94 commit 4fc30b0186b628013ef566d376526e427644cf94 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2025-03-29 14:31:18 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2025-04-18 14:35:57 +0000 LinuxKPI: be more verbose on _bus_dmamap_load_phys failures if debug is on With the [k]malloc adjustments in switching skbuff from using a tunable and conditional contigmalloc with boundries to using __kmalloc as allocator should just work. The allocations are now physically contiguous and nseg=1 should be fine even if we have to bounce. The problem now coming back is that busdma bounce code cannot deal with larger contiguous nseg=1 allocations. I originally found that on arm64 more than two years ago but I am also seeing it for amd64 now. Improve the debugging beyond the dump_stack() call and print the busdma error (so we know if it is EFBIG or else), print the physical address so we can see better if we should bounce and print the length so we have an idea on what lengths we are failing. D45813 has some observations and rtw88 seems to be a good driver to test with. Sponsored by: The FreeBSD Foundation Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D49569 (cherry picked from commit a12a9c6c59764b876f06355f9f857e0018188d91) --- sys/compat/linuxkpi/common/src/linux_pci.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index ce7f91cd15ac..36dbac24496b 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -1452,14 +1452,19 @@ linux_dma_map_phys_common(struct device *dev, vm_paddr_t phys, size_t len, } nseg = -1; - if (_bus_dmamap_load_phys(obj->dmat, obj->dmamap, phys, len, - BUS_DMA_NOWAIT, &seg, &nseg) != 0) { + error = _bus_dmamap_load_phys(obj->dmat, obj->dmamap, phys, len, + BUS_DMA_NOWAIT, &seg, &nseg); + if (error != 0) { bus_dmamap_destroy(obj->dmat, obj->dmamap); DMA_PRIV_UNLOCK(priv); uma_zfree(linux_dma_obj_zone, obj); counter_u64_add(lkpi_pci_nseg1_fail, 1); - if (linuxkpi_debug) + if (linuxkpi_debug) { + device_printf(dev->bsddev, "%s: _bus_dmamap_load_phys " + "error %d, phys %#018jx len %zu\n", __func__, + error, (uintmax_t)phys, len); dump_stack(); + } return (0); }