NetBSD-Bugs archive

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

Re: kern/56557: Boot fails with DRM assertion failure



The following reply was made to PR kern/56557; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gson%gson.org@localhost
Subject: Re: kern/56557: Boot fails with DRM assertion failure
Date: Fri, 24 Dec 2021 15:36:47 +0000

 This is a multi-part message in MIME format.
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1
 
 Umpteenth's time's the charm, right?
 
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1
 Content-Type: text/plain; charset="ISO-8859-1"; name="wwcheck_v2"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="wwcheck_v2.patch"
 
 diff --git a/sys/external/bsd/drm2/linux/linux_ww_mutex.c b/sys/external/bs=
 d/drm2/linux/linux_ww_mutex.c
 index 5e443aa3f54b..75e45a250497 100644
 --- a/sys/external/bsd/drm2/linux/linux_ww_mutex.c
 +++ b/sys/external/bsd/drm2/linux/linux_ww_mutex.c
 @@ -108,6 +108,21 @@ ww_acquire_done(struct ww_acquire_ctx *ctx)
  	ctx->wwx_acquire_done =3D true;
  }
 =20
 +static void
 +ww_acquire_done_check(struct ww_mutex *mutex, struct ww_acquire_ctx *ctx)
 +{
 +
 +	/*
 +	 * If caller has invoked ww_acquire_done, we must already hold
 +	 * this mutex.
 +	 */
 +	KASSERT(mutex_owned(&mutex->wwm_lock));
 +	KASSERTMSG((!ctx->wwx_acquire_done ||
 +		(mutex->wwm_state =3D=3D WW_CTX && mutex->wwm_u.ctx =3D=3D ctx)),
 +	    "ctx %p done acquiring locks, refusing to acquire %p",
 +	    ctx, mutex);
 +}
 +
  void
  ww_acquire_fini(struct ww_acquire_ctx *ctx)
  {
 @@ -552,8 +567,6 @@ ww_mutex_lock(struct ww_mutex *mutex, struct ww_acquire=
 _ctx *ctx)
 =20
  	KASSERTMSG((ctx->wwx_owner =3D=3D curlwp),
  	    "ctx %p owned by %p, not self (%p)", ctx, ctx->wwx_owner, curlwp);
 -	KASSERTMSG(!ctx->wwx_acquire_done,
 -	    "ctx %p done acquiring locks, can't acquire more", ctx);
  	KASSERTMSG((ctx->wwx_acquired !=3D ~0U),
  	    "ctx %p finished, can't be used any more", ctx);
  	KASSERTMSG((ctx->wwx_class =3D=3D mutex->wwm_class),
 @@ -561,6 +574,7 @@ ww_mutex_lock(struct ww_mutex *mutex, struct ww_acquire=
 _ctx *ctx)
  	    ctx, ctx->wwx_class, mutex, mutex->wwm_class);
 =20
  	mutex_enter(&mutex->wwm_lock);
 +	ww_acquire_done_check(mutex, ctx);
  retry:	switch (mutex->wwm_state) {
  	case WW_UNLOCKED:
  		WW_WANTLOCK(mutex);
 @@ -673,8 +687,6 @@ ww_mutex_lock_interruptible(struct ww_mutex *mutex, str=
 uct ww_acquire_ctx *ctx)
 =20
  	KASSERTMSG((ctx->wwx_owner =3D=3D curlwp),
  	    "ctx %p owned by %p, not self (%p)", ctx, ctx->wwx_owner, curlwp);
 -	KASSERTMSG(!ctx->wwx_acquire_done,
 -	    "ctx %p done acquiring locks, can't acquire more", ctx);
  	KASSERTMSG((ctx->wwx_acquired !=3D ~0U),
  	    "ctx %p finished, can't be used any more", ctx);
  	KASSERTMSG((ctx->wwx_class =3D=3D mutex->wwm_class),
 @@ -682,6 +694,7 @@ ww_mutex_lock_interruptible(struct ww_mutex *mutex, str=
 uct ww_acquire_ctx *ctx)
  	    ctx, ctx->wwx_class, mutex, mutex->wwm_class);
 =20
  	mutex_enter(&mutex->wwm_lock);
 +	ww_acquire_done_check(mutex, ctx);
  retry:	switch (mutex->wwm_state) {
  	case WW_UNLOCKED:
  		WW_WANTLOCK(mutex);
 @@ -795,8 +808,6 @@ ww_mutex_lock_slow(struct ww_mutex *mutex, struct ww_ac=
 quire_ctx *ctx)
 =20
  	KASSERTMSG((ctx->wwx_owner =3D=3D curlwp),
  	    "ctx %p owned by %p, not self (%p)", ctx, ctx->wwx_owner, curlwp);
 -	KASSERTMSG(!ctx->wwx_acquire_done,
 -	    "ctx %p done acquiring locks, can't acquire more", ctx);
  	KASSERTMSG((ctx->wwx_acquired !=3D ~0U),
  	    "ctx %p finished, can't be used any more", ctx);
  	KASSERTMSG((ctx->wwx_acquired =3D=3D 0),
 @@ -807,6 +818,7 @@ ww_mutex_lock_slow(struct ww_mutex *mutex, struct ww_ac=
 quire_ctx *ctx)
  	    ctx, ctx->wwx_class, mutex, mutex->wwm_class);
 =20
  	mutex_enter(&mutex->wwm_lock);
 +	ww_acquire_done_check(mutex, ctx);
  retry:	switch (mutex->wwm_state) {
  	case WW_UNLOCKED:
  		mutex->wwm_state =3D WW_CTX;
 @@ -874,8 +886,6 @@ ww_mutex_lock_slow_interruptible(struct ww_mutex *mutex,
 =20
  	KASSERTMSG((ctx->wwx_owner =3D=3D curlwp),
  	    "ctx %p owned by %p, not self (%p)", ctx, ctx->wwx_owner, curlwp);
 -	KASSERTMSG(!ctx->wwx_acquire_done,
 -	    "ctx %p done acquiring locks, can't acquire more", ctx);
  	KASSERTMSG((ctx->wwx_acquired !=3D ~0U),
  	    "ctx %p finished, can't be used any more", ctx);
  	KASSERTMSG((ctx->wwx_acquired =3D=3D 0),
 @@ -886,6 +896,7 @@ ww_mutex_lock_slow_interruptible(struct ww_mutex *mutex,
  	    ctx, ctx->wwx_class, mutex, mutex->wwm_class);
 =20
  	mutex_enter(&mutex->wwm_lock);
 +	ww_acquire_done_check(mutex, ctx);
  retry:	switch (mutex->wwm_state) {
  	case WW_UNLOCKED:
  		mutex->wwm_state =3D WW_CTX;
 
 --=_17Wymd7lPaKOmlAiVMiz9N/EY5eA0fm1--
 


Home | Main Index | Thread Index | Old Index