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)
Tue, Oct 22, 5:51 AM
Unknown Object (File)
Wed, Oct 16, 2:56 PM
Unknown Object (File)
Wed, Oct 16, 6:56 AM
Unknown Object (File)
Mon, Oct 14, 9:03 PM
Unknown Object (File)
Mon, Oct 14, 1:57 PM
Unknown Object (File)
Mon, Oct 14, 12:44 PM
Unknown Object (File)
Sun, Oct 13, 5:49 AM
Unknown Object (File)
Sun, Oct 13, 1:42 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 44928
Build 41816: arc lint + arc unit

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
805–806

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
805–806

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.