Page MenuHomeFreeBSD

LinuxKPI: PCI: add counter for linux_dma_map_phys_common() errors
ClosedPublic

Authored by bz on Mar 30 2022, 5:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 20, 12:28 AM
Unknown Object (File)
Mon, Nov 18, 6:40 PM
Unknown Object (File)
Wed, Nov 13, 7:03 PM
Unknown Object (File)
Wed, Nov 6, 3:25 PM
Unknown Object (File)
Tue, Nov 5, 10:04 AM
Unknown Object (File)
Mon, Nov 4, 10:17 PM
Unknown Object (File)
Mon, Nov 4, 6:19 PM
Unknown Object (File)
Oct 22 2024, 5:51 AM

Details

Summary

LinuxKPI is asking for single-segment mappings. Some (wireless) drivers
are using this to map multi-pages though and our busdma framework is not
very friendly to that as single-segments [D31823]. Add a counter
so we can track when this actually happens so gather more information.

Sponsored by: The FreeBSD Foundation

Test Plan

Please note that I carelessly extracted and adjusted it from
a different branch and have not tested it stand-alone yet.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Mar 30 2022, 5:46 PM

Why not print the stack backtrace when debug.linuxkpi.debug is set?

Why not print the stack backtrace when debug.linuxkpi.debug is set?

I am currently not much concerned from where these come as the problem is not in the originating drivers; well it is but point being is we do not want to re-write them.

So the current hypothesis is that the problem is in busdma. In order to be able to come back after 24 hours and see how often this happened, or "my driver failed to load--did this happen?" a non-intrusive counter seems best; and it is something I can always ask a user to easily tell me. And it is something I can leave in there long-term.

We can do the dump_stack() in addition if you feel it would be helpful but then the question is, do I want the debug/dump_stack in all the error cases in this function as that answers a different question..

Add the ability under compat.linuxkpi.debug to also dump the stack in case
of a single-segment mapping error to see the originating driver part
as suggested by @hselasky.

Okay, tested on my arm64 with 64G of main memory loading if_rtw88:
compat.linuxkpi.lkpi_pci_nseg1_fail: 2

That is indeed the failure to load (firmware) / attach. And yes, I do have two rtw88 cards in that machine currently.

hselasky added inline comments.
sys/compat/linuxkpi/common/src/linux_pci.c
808

You can't pass M_ZERO here?

This revision is now accepted and ready to land.Apr 1 2022, 8:20 AM
bz marked an inline comment as done.Apr 1 2022, 11:05 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_pci.c
808

That is implied. I probably don't have to counter_u64_zero() below though. I'll remove that before committing.

This revision was automatically updated to reflect the committed changes.
bz marked an inline comment as done.