On 2019/06/06 14:55, Stuart Henderson wrote:
> I'm testing the "pump my sched" and read/write unlock diffs and ran into
> the panic below. Seems more likely that it would be connected with the
> sched diff rather than anything else. I'll build a WITNESS kernel and
> see if I can get more details if it hapens again.

Easily repeatable: Run xscreensaver. Let it lock. Try to unlock.

login: panic: kernel diagnostic assertion "__mp_lock_held(&sched_lock, 
curcpu()) == 0" failed: file "/src/cvs-openbsd/sys/kern/kern_lock.c", line 63
Stopped at      db_enter+0x10:  popq    %rbp
    TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
   6043  83667   1000         0x2          0    1  firefox
 320664  83667   1000         0x2  0x4000080    2  firefox
 523640  70812   1000         0x2  0x4000000    3  firefox
*307581  55620   1000        0x32          0    0K xscreensaver
db_enter() at db_enter+0x10
panic() at panic+0x128
__assert(ffffffff81af6d92,ffffffff81afc585,3f,ffffffff81b1a406) at __assert+0x2
e
__mp_lock_held(ffffffff811362e0,ffff800033cfe5e0) at __mp_lock_held
pageflttrap() at pageflttrap+0x78
kerntrap(ffff800033cfe6b0) at kerntrap+0x91
alltraps_kern(6,300,fffbffff,2,ffff800022009ff0,c0) at alltraps_kern+0x7b
setrunqueue(0,ffff8000342572a8,c0) at setrunqueue+0xbc
setrunnable(ffff8000342572a8,c0) at setrunnable+0xa5
ptsignal(ffff8000342572a8,13,0) at ptsignal+0x3c4
sys_kill(ffff800033c532a8,ffff800033cfe8d0,ffff800033cfe930) at sys_kill+0x1c5
syscall(ffff800033cfe9a0) at syscall+0x399
Xsyscall(6,7a,0,7a,13,7f7ffffe8cc8) at Xsyscall+0x128
end of kernel
end trace frame: 0x7f7ffffe8b60, count: 2
https://www.openbsd.org/ddb.html describes the minimum info required in bug
reports.  Insufficient info makes it difficult to find and fix bugs.
ddb{0}> sh witness
Sleep locks:
&prime_fpriv->lock (type: rwlock, depth: 0)&file_priv->fbs_lock (type: rwlock, d
epth: 0)futex (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6
) &map->lock (type: rwlock, depth: 5)  &kernel_lock (type: kernel_lock, depth: 6
) -- (already displayed)
 &pp->pr_lock (type: rwlock, depth: 1)  &kernel_lock (type: kernel_lock, depth:
 6) -- (already displayed)
swplk (type: rwlock, depth: 0) &map->lock (type: rwlock, depth: 5) -- (already d
isplayed)
 &ip->i_lock (type: rrwlock, depth: 2)  &kernel_lock (type: kernel_lock, depth:
 6) -- (already displayed)
  &map->lock (type: rwlock, depth: 5) -- (already displayed)
  &diskp->dk_lock (type: rwlock, depth: 3)   &kernel_lock (type: kernel_lock, d
epth: 6) -- (already displayed)
  &ufsdirhash_mtx (type: rwlock, depth: 3)   &dh->dh_mtx (type: rwlock, depth: 4
)  lockflk (type: rwlock, depth: 3)   &uidinfolk (type: rwlock, depth: 4)   &pp
->pr_lock (type: rwlock, depth: 4)   &pp->pr_lock (type: rwlock, depth: 4)  &dh
->dh_mtx (type: rwlock, depth: 4) -- (already displayed)
  &uv->uv_lock (type: rwlock, depth: 3)   &to->uv_lock (type: rwlock, depth: 4)
  &to->uv_lock (type: rwlock, depth: 4) -- (already displayed)
sysctllk (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6) --
 (already displayed)
 &map->lock (type: rwlock, depth: 5) -- (already displayed)
 &newfdp->fd_fd.fd_lock (type: rwlock, depth: 1)  &kernel_lock (type: kernel_lo
ck, depth: 6) -- (already displayed)
  &map->lock (type: rwlock, depth: 5) -- (already displayed)
  netlock (type: rwlock, depth: 2)   &kernel_lock (type: kernel_lock, depth: 6)
 -- (already displayed)
   pools (type: rwlock, depth: 3)    &kernel_lock (type: kernel_lock, depth: 6)
 -- (already displayed)
   &map->lock (type: rwlock, depth: 5) -- (already displayed)
   &ar->ar_lock (type: rwlock, depth: 3)   vlantag (type: rwlock, depth: 3)  lo
ckflk (type: rwlock, depth: 3) -- (already displayed)
  &ip->i_lock (type: rrwlock, depth: 2) -- (already displayed)
  vfs_stall (type: rwlock, depth: 2)   &kernel_lock (type: kernel_lock, depth: 6
) -- (already displayed)
  ptarrlk (type: rwlock, depth: 2) netlock (type: rwlock, depth: 2) -- (already
 displayed)
 tc_lock (type: rwlock, depth: 1) &ip->i_lock (type: rrwlock, depth: 2) -- (alr
eady displayed)
 vfs_stall (type: rwlock, depth: 2) -- (already displayed)
 sysctldlk (type: rwlock, depth: 1)&connector->hdcp_mutex (type: rwlock, depth:
 0)&mgr->lock (type: rwlock, depth: 0)&connector->mutex (type: rwlock, depth: 0
) &dev->mode_config.idr_mutex (type: rwlock, depth: 3)&dev_priv->dpll_lock (typ
e: rwlock, depth: 0)taskq (type: rwlock, depth: 0) &dev->struct_mutex (type: rw
lock, depth: 3)  &map->lock (type: rwlock, depth: 5) -- (already displayed)
  &uidinfolk (type: rwlock, depth: 4) -- (already displayed)
  &mgr->vm_lock (type: rwlock, depth: 5)  &dev_priv->pcu_lock (type: rwlock, de
pth: 4)   &dev_priv->gt_pm.rps.power.mutex (type: rwlock, depth: 5)  &power_dom
ains->lock (type: rwlock, depth: 4)  &dev_priv->mm.stolen_lock (type: rwlock, d
epth: 4)  &fbc->lock (type: rwlock, depth: 4)  &node->vm_lock (type: rwlock, de
pth: 4)  &obj->mm.lock (type: rwlock, depth: 4)   &map->lock (type: rwlock, dep
th: 5) -- (already displayed)
   &mgr->vm_lock (type: rwlock, depth: 5) -- (already displayed)
  &obj->mm.get_page.lock (type: rwlock, depth: 4) &mgr->vm_lock (type: rwlock, d
epth: 5) -- (already displayed)
 &obj->mm.lock (type: rwlock, depth: 4) -- (already displayed)
&dev_priv->av_mutex (type: rwlock, depth: 0)&dev_priv->sb_lock (type: rwlock, d
epth: 0)&mp->mnt_lock (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock,
 depth: 6) -- (already displayed)
 &map->lock (type: rwlock, depth: 5) -- (already displayed)
 &uidinfolk (type: rwlock, depth: 4) -- (already displayed)
 netlock (type: rwlock, depth: 2) -- (already displayed)
 &diskp->dk_lock (type: rwlock, depth: 3) -- (already displayed)
 &ip->i_lock (type: rrwlock, depth: 2) -- (already displayed)
 &np->n_lock (type: rrwlock, depth: 1)  &kernel_lock (type: kernel_lock, depth:
 6) -- (already displayed)
  netlock (type: rwlock, depth: 2) -- (already displayed)
  &ip->i_lock (type: rrwlock, depth: 2) -- (already displayed)
&sc->sc_lock (type: rwlock, depth: 0) &diskp->dk_lock (type: rwlock, depth: 3) -
- (already displayed)
 lockflk (type: rwlock, depth: 3) -- (already displayed)
&pp->pr_lock (type: rwlock, depth: 0)&rtptable.rtp_lk (type: rwlock, depth: 0)&
pkptable.pkp_lk (type: rwlock, depth: 0)taskq (type: rwlock, depth: 0) &kernel_
lock (type: kernel_lock, depth: 6) -- (already displayed)
taskq (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6) -- (a
lready displayed)
 netlock (type: rwlock, depth: 2) -- (already displayed)
&sc->vm_lock (type: rwlock, depth: 0)&sc->sc_lock (type: rwlock, depth: 0) &ker
nel_lock (type: kernel_lock, depth: 6) -- (already displayed)
 &sc->sc_cmd_lock (type: rwlock, depth: 1)  &kernel_lock (type: kernel_lock, de
pth: 6) -- (already displayed)
&sc->sc_doorbell_lock (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock,
 depth: 6) -- (already displayed)
&usbpalock (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6) -
- (already displayed)
&dev->object_name_lock (type: rwlock, depth: 0)taskq (type: rwlock, depth: 0)ta
skq (type: rwlock, depth: 0) &dev->struct_mutex (type: rwlock, depth: 3) -- (al
ready displayed)
 &dev_priv->pcu_lock (type: rwlock, depth: 4) -- (already displayed)
 &dev_priv->gt_pm.rps.power.mutex (type: rwlock, depth: 5) -- (already displaye
d)
 &dev->mode_config.idr_mutex (type: rwlock, depth: 3) -- (already displayed)
 &dev->mode_config.fb_lock (type: rwlock, depth: 1) &dev->mode_config.blob_lock
 (type: rwlock, depth: 3) &fbc->lock (type: rwlock, depth: 4) -- (already displ
ayed)
 &ifbdev->hpd_lock (type: rwlock, depth: 1) &helper->lock (type: rwlock, depth:
 1)  &kernel_lock (type: kernel_lock, depth: 6) -- (already displayed)
  &dev->struct_mutex (type: rwlock, depth: 3) -- (already displayed)
  &dev_priv->wm.wm_mutex (type: rwlock, depth: 3)  &dev_priv->gt_pm.rps.power.m
utex (type: rwlock, depth: 5) -- (already displayed)
  taskq (type: rwlock, depth: 2)  &dev->mode_config.mutex (type: rwlock, depth:
 2)   &kernel_lock (type: kernel_lock, depth: 6) -- (already displayed)
   &map->lock (type: rwlock, depth: 5) -- (already displayed)
   &dev->struct_mutex (type: rwlock, depth: 3) -- (already displayed)
   &dev_priv->wm.wm_mutex (type: rwlock, depth: 3) -- (already displayed)
   &dev_priv->gt_pm.rps.power.mutex (type: rwlock, depth: 5) -- (already displa
yed)
   &power_domains->lock (type: rwlock, depth: 4) -- (already displayed)
   &dev_priv->gmbus_mutex (type: rwlock, depth: 3)   &dev->mode_config.idr_mute
x (type: rwlock, depth: 3) -- (already displayed)
   &dev->mode_config.blob_lock (type: rwlock, depth: 3) -- (already displayed)
   &fbc->lock (type: rwlock, depth: 4) -- (already displayed)
   &aux->hw_mutex (type: rwlock, depth: 3)    &dev_priv->pps_mutex (type: rwloc
k, depth: 4)     &kernel_lock (type: kernel_lock, depth: 6) -- (already display
ed)
    &power_domains->lock (type: rwlock, depth: 4) -- (already displayed)
  &dev->mode_config.idr_mutex (type: rwlock, depth: 3) -- (already displayed)
  &dev->mode_config.blob_lock (type: rwlock, depth: 3) -- (already displayed)
  &fbc->lock (type: rwlock, depth: 4) -- (already displayed)
taskq (type: rwlock, depth: 0) &st->lock (type: rwlock, depth: 1)  &sc->sc_i2c_
lock (type: rwlock, depth: 2)   &kernel_lock (type: kernel_lock, depth: 6) -- (
already displayed)
&sc->sc_lck (type: rwlock, depth: 0) &map->lock (type: rwlock, depth: 5) -- (al
ready displayed)
taskq (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6) -- (a
lready displayed)
 netlock (type: rwlock, depth: 2) -- (already displayed)
taskq (type: rwlock, depth: 0) pools (type: rwlock, depth: 3) -- (already displ
ayed)
taskq (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6) -- (a
lready displayed)
 &diskp->dk_lock (type: rwlock, depth: 3) -- (already displayed)
 &dev->mode_config.mutex (type: rwlock, depth: 2) -- (already displayed)
 &helper->lock (type: rwlock, depth: 1) -- (already displayed)
timeout (type: rwlock, depth: 0) &kernel_lock (type: kernel_lock, depth: 6) -- (
already displayed)
 netlock (type: rwlock, depth: 2) -- (already displayed)

Spin locks:
/src/cvs-openbsd/sys/net/art.c:68 (type: mutex, depth: 0)/src/cvs-openbsd/sys/n
et/art.c:63 (type: mutex, depth: 0)&file_priv->mm.lock (type: mutex, depth: 0) &
si->softintr_lock (type: mutex, depth: 8) &sched_lock (type: sched_lock, depth:
 7)  &si->softintr_lock (type: mutex, depth: 8) -- (already displayed)
  &p->p_mtx (type: mutex, depth: 8)  /src/cvs-openbsd/sys/kern/kern_timeout.c:9
3 (type: mutex, depth: 8)  &p->p_mtx (type: mutex, depth: 8) /src/cvs-openbsd/s
ys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (already displayed)
 timeout (type: mutex, depth: 1)  &si->softintr_lock (type: mutex, depth: 8) --
 (already displayed)
  &p->p_mtx (type: mutex, depth: 8) -- (already displayed)
  &sched_lock (type: sched_lock, depth: 7) -- (already displayed)
  /src/cvs-openbsd/sys/kern/kern_malloc.c:104 (type: mutex, depth: 3)   &si->so
ftintr_lock (type: mutex, depth: 8) -- (already displayed)
   &map->mtx (type: mutex, depth: 4)    &si->softintr_lock (type: mutex, depth:
 8) -- (already displayed)
    &uvm.fpageqlock (type: mutex, depth: 5)     &si->softintr_lock (type: mutex
, depth: 8) -- (already displayed)
     &sched_lock (type: sched_lock, depth: 7) -- (already displayed)
     /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (al
ready displayed)
     /src/cvs-openbsd/sys/kern/kern_time.c:481 (type: mutex, depth: 6)    &uvm_
kmapent_mtx (type: mutex, depth: 5)    /src/cvs-openbsd/sys/kern/kern_timeout.c
:93 (type: mutex, depth: 8) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  /src/cvs-openbsd/sys/dev/rnd.c:223 (type: mutex, depth: 2)  /src/cvs-openbsd/
sys/dev/rnd.c:222 (type: mutex, depth: 2)  /src/cvs-openbsd/sys/kern/kern_task.
c:65 (type: mutex, depth: 2)   &sched_lock (type: sched_lock, depth: 7) -- (alr
eady displayed)
  /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alrea
dy displayed)
  &tq->tq_mtx (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, depth:
 8) -- (already displayed)
   &sched_lock (type: sched_lock, depth: 7) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  &pp->pr_lock (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, depth
: 8) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  &tq->tq_mtx (type: mutex, depth: 2)   &sched_lock (type: sched_lock, depth: 7
) -- (already displayed)
  &setperf_mp_mutex (type: mutex, depth: 2)  &ifiq->ifiq_mtx (type: mutex, dept
h: 2)  &tq->tq_mtx (type: mutex, depth: 6)   &sched_lock (type: sched_lock, dep
th: 7) -- (already displayed)
  &tq->tq_mtx (type: mutex, depth: 2)   &sched_lock (type: sched_lock, depth: 7
) -- (already displayed)
  &dev->event_lock (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, d
epth: 8) -- (already displayed)
   &sched_lock (type: sched_lock, depth: 7) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_malloc.c:104 (type: mutex, depth: 3) -- (alre
ady displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
   &dev->vbl_lock (type: mutex, depth: 3)    &dev->vblank_time_lock (type: mute
x, depth: 4)     &dev_priv->irq_lock (type: mutex, depth: 5)      &sched_lock (
type: sched_lock, depth: 7) -- (already displayed)
      &tq->tq_mtx (type: mutex, depth: 6) -- (already displayed)
      &dev_priv->uncore.lock (type: mutex, depth: 6)       /src/cvs-openbsd/sys
/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (already displayed)
     &dev_priv->uncore.lock (type: mutex, depth: 6) -- (already displayed)
     &sl->lock (type: mutex, depth: 5)    &wqh->lock (type: mutex, depth: 4)    
 &
sched_lock (type: sched_lock, depth: 7) -- (already displayed)
   &dev->vblank_time_lock (type: mutex, depth: 4) -- (already displayed)
   &wqh->lock (type: mutex, depth: 4) -- (already displayed)
   &x->wait.lock (type: mutex, depth: 3)    &sched_lock (type: sched_lock, dept
h: 7) -- (already displayed)
   &wqh->lock (type: mutex, depth: 3)    &sched_lock (type: sched_lock, depth: 7
) -- (already displayed)
  &iopl->mtx (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, depth: 8
) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  &bq->bufq_mtx (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, dept
h: 8) -- (already displayed)
   &sched_lock (type: sched_lock, depth: 7) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  &diskp->dk_mtx (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, dep
th: 8) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  &ap->ap_ccb_mtx (type: mutex, depth: 2)   &si->softintr_lock (type: mutex, de
pth: 8) -- (already displayed)
   /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alre
ady displayed)
  &pp->pr_lock (type: mutex, depth: 2)  &p->p_mtx (type: mutex, depth: 8) -- (a
lready displayed)
  /src/cvs-openbsd/sys/kern/kern_task.c:83 (type: mutex, depth: 2)   &sched_loc
k (type: sched_lock, depth: 7) -- (already displayed)
  &dev_priv->irq_lock (type: mutex, depth: 5) -- (already displayed)
  &dev_priv->uncore.lock (type: mutex, depth: 6) -- (already displayed)
  &tq->tq_mtx (type: mutex, depth: 2)   &sched_lock (type: sched_lock, depth: 7
) -- (already displayed)
  &wqh->lock (type: mutex, depth: 2)   &sched_lock (type: sched_lock, depth: 7)
 -- (already displayed)
&file_private->table_lock (type: mutex, depth: 0) &pp->pr_lock (type: mutex, de
pth: 1)/src/cvs-openbsd/sys/kern/kern_sig.c:92 (type: mutex, depth: 0)&pp->pr_l
ock (type: mutex, depth: 0)/src/cvs-openbsd/sys/uvm/uvm_device.c:57 (type: mute
x, depth: 0)/src/cvs-openbsd/sys/net/pfkeyv2.c:172 (type: mutex, depth: 0)/src/
cvs-openbsd/sys/netinet6/ip6_input.c:118 (type: mutex, depth: 0)/src/cvs-openbs
d/sys/netinet/if_ether.c:93 (type: mutex, depth: 0)/src/cvs-openbsd/sys/netinet
/ip_input.c:112 (type: mutex, depth: 0) &si->softintr_lock (type: mutex, depth:
 8) -- (already displayed)
 /src/cvs-openbsd/sys/kern/kern_timeout.c:93 (type: mutex, depth: 8) -- (alread
y displayed)
&pp->pr_lock (type: mutex, depth: 0)&pp->pr_lock (type: mutex, depth: 0)panic: 
kernel diagnostic assertion "__mp_lock_held(&sched_lock, curcpu()) == 0" 
failed: file "/src/cvs-openbsd/sys/kern/kern_lock.c", line 63
Stopped
 at     db_enter+0x10:  popq    %rbp
db_enter() at db_enter+0x10
panic() at panic+0x128
__assert(ffffffff81af6d92,ffffffff81afc585,3f,ffffffff81b1a406) at __assert+0x2
e
__mp_lock_held(ffffffff811362e0,ffff800033cfdec0) at __mp_lock_held
pageflttrap() at pageflttrap+0x78
kerntrap(ffff800033cfdf90) at kerntrap+0x91
alltraps_kern(6,8,0,0,0,73) at alltraps_kern+0x7b
strlen(ffffffff81afb7ed,14,0,0,ffff800033cfe180,ffffffff81afb7ed) at strlen+0x8
1
db_printf(ffffffff81afb7ed) at db_printf+0x6a
witness_ddb_display_descendants(fffffd810001d540,0,c0ff271ee0de782c) at witness
_ddb_display_descendants+0x64
db_witness_display(ffffffff814d2ed0,0,ffffffffffffffff,ffff800033cfe240) at db_
witness_display+0x132
db_command(ffffffff81d506b8,ffffffff81d314d0) at db_command+0x28e
db_command_loop() at db_command_loop+0x96
db_trap() at db_trap+0x138
end trace frame: 0xffff800033cfe400, count: 0
ddb{0}> sh all locks
CPU 0:
exclusive sched_lock &sched_lock r = 0 (0xffffffff81e75f18)
Process 55620 (xscreensaver) thread 0xffff800033c532a8 (307581)
exclusive kernel_lock &kernel_lock r = 0 (0xffffffff81e44910)
exclusive sched_lock &sched_lock r = 0 (0xffffffff81e75f18)

Reply via email to