tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

assertion "spc->spc_migrating == NULL" failed

working with a source code based on the matt-nb5-mips64 branch,
I can reproduce this panic:
panic: kernel diagnostic assertion "spc->spc_migrating == NULL" failed: file 
"/dsk/l1/misc/bouyer/tmp/src/sys/kern/kern_synch.c", line 656
mttycn_pollc 1 ipl 0x6
Stopped in pid 0.4 (system) at  netbsd:cpu_Debugger+0x4:        jr      ra
                bdslot: nop
db{0}> tr
cpu_Debugger+4 (c04bd000,b300,10,c0407c00) ra c02192ac sz 0
panic+1d4 (c04bd000,c02de430,c02f1450,c02f1360) ra c02cac78 sz 48
__kernassert+48 (c04bd000,c02de430,c02f1450,c02f1360) ra c01f74a4 sz 32
mi_switch+640 (c04bd000,c02de430,c02f1450,c02f1360) ra c01f3130 sz 64
sleepq_block+f0 (c04bd000,c02de430,c02f1450,c02f1360) ra c0202f54 sz 48
turnstile_block+2d0 (c04bd000,c02de430,c02f1450,c02f1360) ra c01e254c sz 56
mutex_vector_enter+268 (c04bd000,c02de430,c02f1450,c02f1360) ra c026e2cc sz 64
wapbl_biodone+48 (c04bd000,c02de430,c02f1450,c02f1360) ra c0255638 sz 48
biodone2+a4 (c04bd000,c02de430,c02f1450,c02f1360) ra c02557c8 sz 32
biointr+ac (c04bd000,c02de430,c02f1450,c02f1360) ra c01f3acc sz 32
softint_dispatch+c4 (c04bd000,c02de430,c02f1450,c02f1360) ra c0295fe4 sz 72
softint_fast_dispatch+80 (0,c02de430,c02f1450,c02f1360) ra 0 sz 24
User-level: pid 0.4

(The soft int may vary). Looking at the sources, I see that
sched_nextlwp() is carefull to not propose a new lwp if a migration is in
progress. But when this KASSERT fires we're not necesserely about to
switch to a new (non-idle) lwp, but the current lwp got woken up by another
CPU while it was about to switch.

                        KASSERT(spc->spc_migrating == NULL);
                        if (l->l_target_cpu !=  NULL) { 
                                spc->spc_migrating = l; 
be instead:
                        if (l->l_target_cpu !=  NULL) { 
                                KASSERT(spc->spc_migrating == NULL);
                                spc->spc_migrating = l; 

I did the above change and it seems to work, can someone confirm this is
correct ?

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index