> Date: Thu, 26 Nov 2020 14:19:01 -0300
> From: Martin Pieuchot <m...@openbsd.org>
> 
> As reported by AIsha Tammy on bugs@, there's a current recursion
> possible with the pageqlock:
> 
>    ddb> trace
>    db_enter() at db_enter+0x10
>    panic(ffffffff81dcd47c) at panic+0x12a
>    mtx_enter(ffffffffB219ed00) at mtx_enter+0x81
>    uvm_objfree(fffffd8015f2c9a0) at uvm_objfree+0x61
>    buf_dealloc_mem(fffffd8015f2c8e0) at buf_dealloc_mem+0x7c
>    buf_put(fffffd8O15f2c8e0) at buf _put+Oxcd
>    brelse(fffffd8O15f2c8e0) at brelse+0x3df
>    sd_buf_done(fffffd8014a27028) at sd_buf_done+0xf9
>    vioblk_vq_done (ffff8000000c 7050) at vioblk_vq_done+0x6f
>    virtio_check_vqs (ffff80000009ce00) at virtio_check_vqs+0xfe
>    intr_handler (ffff80000e6dea70, ffff800000047700) at intr_handler+0x38
>    Xintr_ioapic_edge19_untramp() at Xintr_ioapic_edge19_untramp+0x18f
>    mtx_enter (fffffd8002699680) at mtx_enter+0xb
>    uvm_pagedeactivate(fffffd800Z2699680) at uvm_pagedeactivate+0x105
>    uyvmpd_scan() at uvmpd_scan+0x259
>    uvm_pageout (ffff8000ffff9718) at uvm_pageout +0x375
>    end trace frame: 0x0, count: -16
> 
> Diff below should prevent that, ok?

Yes, that is necessary now that you're taking the lock in uvm_objfree().

ok kettenis@

> Index: uvm/uvm_page.c
> ===================================================================
> RCS file: /cvs/src/sys/uvm/uvm_page.c,v
> retrieving revision 1.151
> diff -u -p -r1.151 uvm_page.c
> --- uvm/uvm_page.c    24 Nov 2020 13:49:09 -0000      1.151
> +++ uvm/uvm_page.c    26 Nov 2020 17:17:55 -0000
> @@ -180,7 +180,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr
>       TAILQ_INIT(&uvm.page_active);
>       TAILQ_INIT(&uvm.page_inactive_swp);
>       TAILQ_INIT(&uvm.page_inactive_obj);
> -     mtx_init(&uvm.pageqlock, IPL_NONE);
> +     mtx_init(&uvm.pageqlock, IPL_VM);
>       mtx_init(&uvm.fpageqlock, IPL_VM);
>       uvm_pmr_init();
>  
> 
> 

Reply via email to