On Thu, Jan 20, 2022 at 04:08:28PM -0700, Thomas Frohwein wrote:
> On Fri, Jan 21, 2022 at 12:22:49AM +1100, Jonathan Gray wrote:
> > On Wed, Jan 19, 2022 at 11:04:26PM -0800, guent...@openbsd.org wrote:
> [...]
> > > The backtrace is kinda nonsensical, showing a copyout() call with no 
> > > predecessor, but maybe that's just from copy*() not setting up a proper 
> > > frame?  However, that's not a change.  Neither has there been any change 
> > > in the pmap layer in multiple months.  The areas of concern IMO are DRM 
> > > and (because it was the last thing mentioned) iwm, but the former seems 
> > > _much_ more likely.
> > 
> > Booting bsd.mp with inteldrm disabled works?
> 
> yes, boots and uses llvmpipe after I disable inteldrm*

this fixes sleeping with a mtx held found with kern.pool_debug=2
which may help

Index: sys/dev/pci/drm/drm_linux.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
retrieving revision 1.88
diff -u -p -r1.88 drm_linux.c
--- sys/dev/pci/drm/drm_linux.c 20 Jan 2022 06:33:03 -0000      1.88
+++ sys/dev/pci/drm/drm_linux.c 21 Jan 2022 07:20:32 -0000
@@ -936,11 +936,17 @@ int
 __xa_alloc(struct xarray *xa, u32 *id, void *entry, int limit, gfp_t gfp)
 {
        struct xarray_entry *xid;
-       int flags = (gfp & GFP_NOWAIT) ? PR_NOWAIT : PR_WAITOK;
        int start = (xa->xa_flags & XA_FLAGS_ALLOC1) ? 1 : 0;
        int begin;
 
-       xid = pool_get(&xa_pool, flags);
+       if (gfp & GFP_NOWAIT) {
+               xid = pool_get(&xa_pool, PR_NOWAIT);
+       } else {
+               mtx_leave(&xa->xa_lock);
+               xid = pool_get(&xa_pool, PR_WAITOK);
+               mtx_enter(&xa->xa_lock);
+       }
+
        if (xid == NULL)
                return -ENOMEM;
 
@@ -997,7 +1003,6 @@ __xa_store(struct xarray *xa, unsigned l
 {
        struct xarray_entry find, *res;
        void *prev;
-       int flags = (gfp & GFP_NOWAIT) ? PR_NOWAIT : PR_WAITOK;
 
        if (entry == NULL)
                return __xa_erase(xa, index);
@@ -1013,7 +1018,13 @@ __xa_store(struct xarray *xa, unsigned l
        }
 
        /* index not found, add new */
-       res = pool_get(&xa_pool, flags);
+       if (gfp & GFP_NOWAIT) {
+               res = pool_get(&xa_pool, PR_NOWAIT);
+       } else {
+               mtx_leave(&xa->xa_lock);
+               res = pool_get(&xa_pool, PR_WAITOK);
+               mtx_enter(&xa->xa_lock);
+       }
        if (res == NULL)
                return XA_ERROR(-ENOMEM);
        res->id = index;

Reply via email to