>Synopsis: kernel panic: cpu0: _dmamap_sync: ran off map!
>Category: kernel riscv64
>Environment:
System : OpenBSD 7.6
Details : OpenBSD 7.6-current (GENERIC) #140: Fri Jan 31 06:08:51
MST 2025
[email protected]:/usr/src/sys/arch/riscv64/compile/GENERIC
Architecture: OpenBSD.riscv64
Machine : riscv64
>Description:
I run into a kernel panic when booting my board with an usb wifi
dongle attached.
ddb> show panic
*cpu0: _dmamap_sync: ran off map!
ddb> bt
panic() at panic+0xfe
_dmamem_alloc() at _dmamem_alloc
ehci_idone() at ehci_idone+0x17e
ehci_softintr() at ehci_softintr+0xfe
softintr_dispatch() at softintr_dispatch+0x76
riscv_do_pending_intr() at riscv_do_pending_intr+0x94
plic_irq_dispatch() at plic_irq_dispatch+0xde
plic_irq_handler() at plic_irq_handler+0x3e
riscv_cpu_intr() at riscv_cpu_intr+0x20
cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x7a
uvn_io() at uvn_io+0xec
uvm_fault_lower_io() at uvm_fault_lower_io+0x178
uvm_fault_lower() at uvm_fault_lower+0xbe
uvm_fault() at uvm_fault+0xfc
do_trap_user() at do_trap_user+0x112
cpu_exception_handler_user() at cpu_exception_handler_user+0x7c
end of kernel
end trace frame: 0x4b8828e0, count: -16
ddb> show reg
ra 0xffffffc00037e558 panic+0xfe
sp 0xffffffc040a30650
gp 0
tp 0
t0 0x8000000000000009
t1 0xffffffc00065c6e4 db_end_line+0x32
t2 0x40188c44
s0 0xffffffc040a30660
s1 0x1
a0 0x1
a1 0x2e850adcdb23d0aa
a2 0x2e850adcdb23d0aa
a3 0
a4 0xffffffffffffffff
a5 0xffffffc0005013b8 generic_space_write_4
a6 0x1
a7 0
s2 0xffffffc00087916b substchar+0x22c5e
s3 0
s4 0xffffc0cc
s5 0
s6 0x28
s7 0xffffffc000a33b50 cpu_dcache_wbinv_range
s8 0
s9 0xb
s10 0x1
s11 0xffffffc0008cf728 utwitch_ca+0x28
t3 0x401144e0
t4 0x22
t5 0x47c31800
t6 0x40188c45
panic+0xfe: addi a0,zero,256
ddb> show uvm
Current UVM status:
pagesize=4096 (0x1000), pagemask=0xfff, pageshift=12
246280 VM pages: 6237 active, 528 inactive, 1 wired, 230399 free (28903 zero)
freemin=8209, free-target=10945, inactive-target=0, wired-max=82093
faults=59807, traps=0, intrs=0, ctxswitch=67065 fpuswitch=0
softint=27527, syscalls=40029, kmapent=14
fault counts:
noram=0, noanon=0, noamap=0, pgwait=0, pgrele=0
ok relocks(total)=4781(4782), anget(retries)=36536(0), amapcopy=6551
neighbor anon/obj pg=11885/13401, gets(lock/unlock)=10455/4783
cases: anon=31987, anoncow=4549, obj=8794, prcopy=1659, przero=12817
daemon and swap counts:
woke=0, revs=0, scans=0, obscans=0, anscans=0
busy=0, freed=0, reactivate=0, deactivate=0
pageouts=0, pending=0, nswget=0
nswapdev=1
swpages=327679, swpginuse=0, swpgonly=0 paging=0
kernel pointers:
objs(kern)=0xffffffc000aad398
>How-To-Repeat:
Triggers on boot, during "starting network", if I boot the board
with the usb wifi dongle attached. Doesn't trigger if I attach
it later and run netstart on it.
>Fix:
Unknown. Given it's super easy to reproduce, I can very easily
test patches.
dmesg:
OpenBSD 7.6-current (GENERIC) #140: Fri Jan 31 06:08:51 MST 2025
[email protected]:/usr/src/sys/arch/riscv64/compile/GENERIC
real mem = 1073741824 (1024MB)
avail mem = 1008480256 (961MB)
SBI: OpenSBI v1.2, SBI Specification Version 1.0
random: boothowto does not indicate good seed
mainbus0 at root: MangoPi MQ Pro
cpu0 at mainbus0: T-Head arch 0 imp 0 rv64imafdc
intc0 at cpu0
cpu0: 32KB 64b/line 128-way L1 I-cache, 32KB 64b/line 256-way L1 D-cache
"fit-images" at mainbus0 not configured
"dcxo-clk" at mainbus0 not configured
simplebus0 at mainbus0: "soc"
sxipio0 at simplebus0: 88 pins
sxiccmu0 at simplebus0
plic0 at simplebus0
sxitimer0 at simplebus0: 24000 kHz
sxidog0 at simplebus0
com0 at simplebus0: dw16550
com0: console
com1 at simplebus0: dw16550
"syscon" at simplebus0 not configured
"dma-controller" at simplebus0 not configured
"efuse" at simplebus0 not configured
"crypto" at simplebus0 not configured
"dram-controller" at simplebus0 not configured
sximmc0 at simplebus0
sdmmc0 at sximmc0: 4-bit, sd high-speed, mmc high-speed, dma
sximmc1 at simplebus0
sdmmc1 at sximmc1: 4-bit, sd high-speed, mmc high-speed, dma
"usb" at simplebus0 not configured
"phy" at simplebus0 not configured
ehci0 at simplebus0
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 configuration 1 interface 0 "Generic EHCI root hub" rev 2.00/1.00
addr 1
ohci0 at simplebus0: version 1.0
"clock-controller" at simplebus0 not configured
"mixer" at simplebus0 not configured
"mixer" at simplebus0 not configured
"phy" at simplebus0 not configured
"tcon-top" at simplebus0 not configured
"lcd-controller" at simplebus0 not configured
"lcd-controller" at simplebus0 not configured
"power-controller" at simplebus0 not configured
"clock-controller" at simplebus0 not configured
sxirtc0 at simplebus0
sxidog1 at simplebus0
sxidog2 at simplebus0
gpio0 at sxipio0: 32 pins
gpio1 at sxipio0: 32 pins
gpio2 at sxipio0: 32 pins
gpio3 at sxipio0: 32 pins
gpio4 at sxipio0: 32 pins
gpio5 at sxipio0: 32 pins
gpio6 at sxipio0: 32 pins
usb1 at ohci0: USB revision 1.0
uhub1 at usb1 configuration 1 interface 0 "Generic OHCI root hub" rev 1.00/1.00
addr 1
"opp-table-cpu" at mainbus0 not configured
"pmu" at mainbus0 not configured
"vcc" at mainbus0 not configured
"vcc-3v3" at mainbus0 not configured
"leds" at mainbus0 not configured
"avdd2v8" at mainbus0 not configured
"dvdd" at mainbus0 not configured
"vdd-cpu" at mainbus0 not configured
"wifi-pwrseq" at mainbus0 not configured
"binman" at mainbus0 not configured
scsibus0 at sdmmc0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SD/MMC, EE4S5, 0030> removable
sd0: 244480MB, 512 bytes/sector, 500695040 sectors
manufacturer 0x024c, product 0xd723 at sdmmc1 function 1 not configured
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on sd0a (36c7d40e8b3a968a.a) swap on sd0b dump on sd0b
WARNING: / was not properly unmounted
WARNING: bad clock chip time
WARNING: CHECK AND RESET THE DATE!
sxiccmu_d1_set_frequency: 0x00000084
cpu0: clock not implemented
usbdevs:
Controller /dev/usb0:
addr 01: 0000:0000 Generic, EHCI root hub
high speed, self powered, config 1, rev 1.00
driver: uhub0
addr 02: 0bda:8179 Realtek, 802.11n NIC
high speed, power 500 mA, config 1, rev 0.00, iSerial 00E04C0001
driver: urtwn0
Controller /dev/usb1:
addr 01: 0000:0000 Generic, OHCI root hub
full speed, self powered, config 1, rev 1.00
driver: uhub1