# mp3 player and kernel panic (spin lock held too long)



## any_name_you_wish (Feb 1, 2022)

Hello,

I have some problems with my mp3-player. It's a cheap device and looks like this:






						MP3 Player, LCD Mini MP3 8G Sport Music Player WMA Player FM Radio USB Flash Drive,Red : Electronics
					

Buy MP3 Player, LCD Mini MP3 8G Sport Music Player WMA Player FM Radio USB Flash Drive,Red: MP3 & MP4 Players - Amazon.com ✓ FREE DELIVERY possible on eligible purchases



					www.amazon.com
				




The flash memory is formatted as FAT32. I can write to FAT32 devices (for example to my sd cards). But everything stops to work when this mp3-player enters the game. Writing to this device leads to kernel panic. 

/var/crash/core.txt.3


```
bsd.pc dumped core - see /var/crash/vmcore.3

Tue Feb  1 13:55:05 CET 2022

FreeBSD bsd.pc 13.0-RELEASE-p6 FreeBSD 13.0-RELEASE-p6 #0: Mon Jan 10 06:28:50 UTC 2022     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

panic: spin lock held too long

GNU gdb (GDB) 11.1 [GDB v11.1 for FreeBSD]
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd13.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /boot/kernel/kernel...
Reading symbols from /usr/lib/debug//boot/kernel/kernel.debug...

Unread portion of the kernel message buffer:
spin lock 0xfffffe0009283cb0 (øß    ) held by 0xfffffe0009282120 (tid 8) too long
panic: spin lock held too long
cpuid = 3
time = 1643720031
KDB: stack backtrace:
#0 0xffffffff80c57525 at kdb_backtrace+0x65
#1 0xffffffff80c09f01 at vpanic+0x181
#2 0xffffffff80c09d73 at panic+0x43
#3 0xffffffff80be86a4 at _mtx_lock_indefinite_check+0x64
#4 0xffffffff80be87eb at thread_lock_flags_+0xdb
#5 0xffffffff80c6e708 at propagate_priority+0x58
#6 0xffffffff80c6f4e3 at turnstile_wait+0x313
#7 0xffffffff80c0503e at __rw_wlock_hard+0x3ee
#8 0xffffffff80ce3e51 at brelvp+0x1c1
#9 0xffffffff80cc0af3 at brelse+0x453
#10 0xffffffff80cc47b8 at buf_recycle+0x288
#11 0xffffffff80cc4c71 at bufspace_daemon+0xf1
#12 0xffffffff80bc7e3e at fork_exit+0x7e
#13 0xffffffff81062b9e at fork_trampoline+0xe
Uptime: 16m55s
Dumping 543 out of 8141 MB: (CTRL-C to abort)  (CTRL-C to abort)  (CTRL-C to abort) ..3%..12%..21%..33%..42%..51%..62%..71%..83%..92%
.
.
.
```



It seems that this player has some kind of operation system on it. Maybe that is the problem? 

PS: It works on my linux system. So device is working. And it was formatted as fat32-device on my FreeBSD-system.


----------



## covacat (Feb 1, 2022)

backup the data on it
newfs it as ufs
try to write various files to it
if it still panics it's probably in cam/usb code
if it does not its in msdosfs code
also test with -stable if you can


----------



## _martin (Feb 1, 2022)

As kernel message says - spin lock was held too long. It's interesting that the lock name is butchered, possibly overflown by something else.
No external device should crash kernel however cheap and crappy it is. If it does it's a problem of a kernel not a device.

You have a GENERIC kernel with crash dump available. This is the best situation to open a PR. Note crash dump may contain private data.


----------

