From: bugzilla-daemon@freedesktop.org Subject: [Bug 103304] multi-threaded usage of Gallium RadeonSI leads to NULL pointer exception in pb_cache_reclaim_buffer Date: Wed, 18 Oct 2017 10:43:37 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1422149064==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [IPv6:2610:10:20:722:a800:ff:fe98:4b55]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E8B66E86A for ; Wed, 18 Oct 2017 10:43:37 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1422149064== Content-Type: multipart/alternative; boundary="15083234170.F68726.12657"; charset="UTF-8" --15083234170.F68726.12657 Date: Wed, 18 Oct 2017 10:43:37 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D103304 --- Comment #3 from Nicolai H=C3=A4hnle --- After thinking about it some more, I think it's very likely that your application also has a bug, a write-after-read bug to be precise. What I'm suspecting is that you're doing this: Thread 1 Thread 2 -------- -------- glBindTexture(tex); glDraw*(...); glFlush(); glTextureSubImage(tex, ...); Unless you use glFinish() or glFenceSync() / glWaitSync() synchronization, there is no guarantee that thread 1's draw has completed before thread 2's texture change. In other words, the implementation is allowed to execute the texture modification *before* the draw. Especially with Gallium threading, = this is quite likely to happen. (We still also have a bug in the driver, but until I can actually double-ch= eck your code, I'd say it's quite likely that you have a write-after-read hazard like the one explained above.) --=20 You are receiving this mail because: You are the assignee for the bug.= --15083234170.F68726.12657 Date: Wed, 18 Oct 2017 10:43:37 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Commen= t # 3 on bug 10330= 4 from Nicolai H=C3=A4hnle
After thinking about it some more, I think it's very likely th=
at your
application also has a bug, a write-after-read bug to be precise.

What I'm suspecting is that you're doing this:

  Thread 1              Thread 2
  --------              --------
  glBindTexture(tex);
  glDraw*(...);
  glFlush();
                        glTextureSubImage(tex, ...);

Unless you use glFinish() or glFenceSync() / glWaitSync() synchronization,
there is no guarantee that thread 1's draw has completed before thread 2's
texture change. In other words, the implementation is allowed to execute the
texture modification *before* the draw. Especially with Gallium threading, =
this
is quite likely to happen.

(We still also have a bug in the driver, but until I can actually double-ch=
eck
your code, I'd say it's quite likely that you have a write-after-read hazard
like the one explained above.)


You are receiving this mail because:
  • You are the assignee for the bug.
= --15083234170.F68726.12657-- --===============1422149064== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1422149064==--