NetBSD-Bugs archive

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

Re: kern/53441: nouveau panic in 8.0_RC2 amd64



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

From: Taylor R Campbell <campbell%mumble.net@localhost>
To: Greg Oster <oster%NetBSD.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/53441: nouveau panic in 8.0_RC2 amd64
Date: Fri, 10 Aug 2018 23:26:31 +0000

 This is a multi-part message in MIME format.
 --=_Nwac1jXA/0rVUrtExBwAgxmAQFvib7Kf
 
 Please try the attached patch and let me know if it helps.
 
 --=_Nwac1jXA/0rVUrtExBwAgxmAQFvib7Kf
 Content-Type: text/plain; charset="ISO-8859-1"; name="53441"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="53441.patch"
 
 From ef5781c793d890187ac766847a0228296c8edc2c Mon Sep 17 00:00:00 2001
 From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
 Date: Fri, 10 Aug 2018 22:29:26 +0000
 Subject: [PATCH] Attempt to sort out race between nouveau_fence_done/signal.
 
 ---
  .../bsd/drm2/dist/drm/nouveau/nouveau_fence.c      | 28 ++++++++++++++++++=
 ----
  1 file changed, 23 insertions(+), 5 deletions(-)
 
 diff --git a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c b/sys/e=
 xternal/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
 index 2a83285e07da..49bdb96273dd 100644
 --- a/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
 +++ b/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
 @@ -126,21 +126,27 @@ nouveau_fence_work(struct nouveau_fence *fence,
  	spin_unlock(&fctx->lock);
  }
 =20
 -static void
 -nouveau_fence_update(struct nouveau_channel *chan)
 +static bool
 +nouveau_fence_update(struct nouveau_channel *chan,
 +    struct nouveau_fence *fence0)
  {
  	struct nouveau_fence_chan *fctx =3D chan->fence;
  	struct nouveau_fence *fence, *fnext;
 +	bool signalled =3D false;	/* Did we signal fence0?  */
 =20
  	spin_lock(&fctx->lock);
  	list_for_each_entry_safe(fence, fnext, &fctx->pending, head) {
  		if (fctx->read(chan) < fence->sequence)
  			break;
 =20
 +		if (fence =3D=3D fence0)
 +			signalled =3D true;
  		nouveau_fence_signal(fence);
  		nouveau_fence_unref(&fence);
  	}
  	spin_unlock(&fctx->lock);
 +
 +	return signalled;
  }
 =20
  int
 @@ -167,9 +173,21 @@ nouveau_fence_emit(struct nouveau_fence *fence, struct=
  nouveau_channel *chan)
  bool
  nouveau_fence_done(struct nouveau_fence *fence)
  {
 -	if (fence->channel)
 -		nouveau_fence_update(fence->channel);
 -	return !fence->channel;
 +	struct nouveau_channel *chan;
 +
 +	/*
 +	 * The lock under which the fence transitions from the
 +	 * not-signalled state to the signalled state is stored in the
 +	 * channel.  The way the signalled state is indicated is by
 +	 * nulling the pointer to the channel.  Soooo...  We load the
 +	 * channel pointer once, and hope that the reference counting
 +	 * mechanism for fences keeps the fence from dying too.
 +	 */
 +	chan =3D fence->channel;
 +	__insn_barrier();
 +	if (chan)
 +		return nouveau_fence_update(chan, fence);
 +	return !chan;
  }
 =20
  static int
 --=20
 2.11.0
 
 
 --=_Nwac1jXA/0rVUrtExBwAgxmAQFvib7Kf--
 


Home | Main Index | Thread Index | Old Index