CVS commit: src/sys/kern

"YAMAMOTO Takashi" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	yamt
Date:		Mon Mar 16 14:56:27 UTC 2026

Modified Files:
	src/sys/kern: kern_lock.c

Log Message:
kernel_lock_spinout: fix an assertion failure

it's possible for the calling lwp to be preempted in the middle
of this function and migrated to the "holder" cpu.

this commit would fix the following crash seen on my qemu/nvmm VM
on a busy host:
```
[ 36199.6483272] cpu0[1851 nbxz]: kernel lock spinout
[ 36199.6483272] panic: kernel diagnostic assertion "curcpu() != ci" failed: file "/root/git/netbsd-src/sys/kern/subr_ipi.c", line 358
[ 36199.6483272] cpu0: Begin traceback...
[ 36199.6483272] vpanic() at netbsd:vpanic+0x189
[ 36199.6634956] kern_assert() at netbsd:kern_assert+0x4b
[ 36199.6634956] ipi_unicast() at netbsd:ipi_unicast+0x1a2
[ 36199.6634956] _kernel_lock() at netbsd:_kernel_lock+0x254
[ 36199.6634956] bdev_strategy() at netbsd:bdev_strategy+0xab
[ 36199.6634956] spec_strategy() at netbsd:spec_strategy+0x77
[ 36199.6634956] VOP_STRATEGY() at netbsd:VOP_STRATEGY+0x3c
[ 36199.6755210] uvm_swap_io() at netbsd:uvm_swap_io+0x2c1
[ 36199.6755210] uvm_swap_get() at netbsd:uvm_swap_get+0x40
[ 36199.6755210] uvmfault_anonget() at netbsd:uvmfault_anonget+0x1fa
[ 36199.6755210] uvm_fault_internal() at netbsd:uvm_fault_internal+0xdb8
[ 36199.6755210] trap() at netbsd:trap+0x46b
[ 36199.6755210] --- trap (number 6) ---
[ 36199.6755210] 41b908:
[ 36199.6755210] cpu0: End traceback...
```


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/kern/kern_lock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.