The _kernel_lock() code looks very suspicious.spinouts on kernel_lock only happen while the root is not mounted (start_init_exec == 0, see init_main.c):
215 spins = 0;
216 do {
217 splx(s);
218 while (__SIMPLELOCK_LOCKED_P(kernel_lock)) {
219 if (SPINLOCK_SPINOUT(spins)) {
220 extern int start_init_exec;
221 if
(!start_init_exec) <===+ looks fishy to me
222 _KERNEL_LOCK_ABORT("spinout"); <===+
223 }
224 SPINLOCK_BACKOFF_HOOK;
225 SPINLOCK_SPIN_HOOK;
226 }
227 s = splvm();
228 } while (!__cpu_simple_lock_try(kernel_lock));
229
230 ci->ci_biglock_count = nlocks;
I have seen spinout on my machine when booting via EFI and kernel
messages slowly crawling up the screen
causing kernel lock contention while initializing the system. After the flag is set, the spinout logic is ineffective.
I am missing to see the reasoning here to panic at all during startup and disable the panic after initialization.
IMHO the panic should be removed as it can be randomly triggered and prohibit boot. And the code serves no purpose
after mounting the root-fs. Frank On 12/20/19 18:05, Patrick Welche wrote:
The following reply was made to PR kern/52126; it has been noted by GNATS. From: Patrick Welche <prlw1%cam.ac.uk@localhost> To: gnats-bugs%netbsd.org@localhost Cc: Subject: Re: kern/52126 (mvsata Marvell 88SX6081 panics on boot) Date: Fri, 20 Dec 2019 17:01:50 +0000 Just for the record, the run up to the spinout is:ata_exec_xfer 0xfffff2bbff940038 channel 1 drive 0atastart from ata_exec_xfer, flags 0x800 ata_queue_alloc_slot: channel 1 qavail 0xffffffff qact 0atastart(chp=0xffffb0001edffa20): xfer 0xfffff2bbff940038 channel 1 drive 0 atastart(chp=0xffffb0001edffa20): channel 1 queue_xfer is empty atastart(chp=0xffffb0001edffa20): channel 1 queue_xfer is empty mvsata1:4: mvsata_bio: drive=0, blkno=0, bcount=512 ata_exec_xfer 0xfffff2bbff940038 channel 4 drive 0 atastart from ata_exec_xfer, flags 0x0 ata_queue_alloc_slot: channel 4 qavail 0xffffffff qact 0atastart(chp=0xfffff2bbff46e010): xfer 0xfffff2bbff940038 channel 4 drive 0 mvsata1:4: mvsata_bio_start: drive=0 ata_channel_freeze_locked(chp=0xfffff2bbff46e010) -> 1 ata_channel_thaw_locked(chp=0xfffff2bbff46e010) -> 0 mvsata1:4: mvsata_bio_start: drive=0 Kernel lock error: _kernel_lock,222: spinout