From mboxrd@z Thu Jan 1 00:00:00 1970
From: bugzilla-daemon@freedesktop.org
Subject: [Bug 109794] LLVM not properly shutdown in `si_pipe.c`?
Date: Thu, 28 Feb 2019 06:51:08 +0000
Message-ID:
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1742643195=="
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 3E03C6E13F
for ; Thu, 28 Feb 2019 06:51:12 +0000 (UTC)
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
--===============1742643195==
Content-Type: multipart/alternative; boundary="15513366720.674c6A.10287"
Content-Transfer-Encoding: 7bit
--15513366720.674c6A.10287
Date: Thu, 28 Feb 2019 06:51:12 +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=3D109794
Bug ID: 109794
Summary: LLVM not properly shutdown in `si_pipe.c`?
Product: Mesa
Version: git
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: minor
Priority: medium
Component: Drivers/Gallium/radeonsi
Assignee: dri-devel@lists.freedesktop.org
Reporter: zegentzy@protonmail.com
QA Contact: dri-devel@lists.freedesktop.org
tl;dr; Shouldn't we be calling `LLVMShutdown()` somewhere?
I had a program which was calling:=20
```
eglInitialize(disp, &majoir, &minor);=20
eglTerminate(disp);=20
eglInitialize(disp, &majoir, &minor);
```
Which lead to mesa outputting the following before continuing on normally
during the second call to `eglInitalize`:
```
mesa: for the -simplifycfg-sink-common option: may only occur zero or one
times!
mesa: for the -global-isel-abort option: may only occur zero or one times!
```
This prompted an investigation me to investigate, and with the aid of @imir=
kin,
I think I got the cause.
You see, in an `eglInitialize` call `radeonsi_dri.so` gets loaded, which al=
so
loads in `libLLVM-9svn.so`, and eventually `ac_init_llvm_once()` gets called
more than once.
That's OK, for as the name implies, it only happens once.
Issue is, when `eglTerminate` is called, `radeonsi_dri.so` gets unloaded, b=
ut
not `libLLVM-9svn.so`. This means that the next time we all `eglInitialize`,
LLVM's `ManagedStatic`s will be preserved, but not our static var
`ac_init_llvm_target_once_flag`.
We can fix this by calling `LLVMShutdown` before unloading `radeonsi_dri.so=
`,
that way LLVM's `ManagedStatic`s are also reset.
Alas, I'm not familiar enough with the mesa codebase, so I got no clue where
the appropriate place to plop this function is. Any aid would be well
appreciated.
--=20
You are receiving this mail because:
You are the assignee for the bug.=
--15513366720.674c6A.10287
Date: Thu, 28 Feb 2019 06:51:12 +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
| Bug ID |
109794
|
| Summary |
LLVM not properly shutdown in `si_pipe.c`?
|
| Product |
Mesa
|
| Version |
git
|
| Hardware |
x86-64 (AMD64)
|
| OS |
Linux (All)
|
| Status |
NEW
|
| Severity |
minor
|
| Priority |
medium
|
| Component |
Drivers/Gallium/radeonsi
|
| Assignee |
dri-devel@lists.freedesktop.org
|
| Reporter |
zegentzy@protonmail.com
|
| QA Contact |
dri-devel@lists.freedesktop.org
|
tl;dr; Shouldn't we be calling `LLVMShutdown()` somewhere?
I had a program which was calling:=20
```
eglInitialize(disp, &majoir, &minor);=20
eglTerminate(disp);=20
eglInitialize(disp, &majoir, &minor);
```
Which lead to mesa outputting the following before continuing on normally
during the second call to `eglInitalize`:
```
mesa: for the -simplifycfg-sink-common option: may only occur zero or one
times!
mesa: for the -global-isel-abort option: may only occur zero or one times!
```
This prompted an investigation me to investigate, and with the aid of @=
imirkin,
I think I got the cause.
You see, in an `eglInitialize` call `radeonsi_dri.so` gets loaded, which al=
so
loads in `libLLVM-9svn.so`, and eventually `ac_init_llvm_once()` gets called
more than once.
That's OK, for as the name implies, it only happens once.
Issue is, when `eglTerminate` is called, `radeonsi_dri.so` gets unloaded, b=
ut
not `libLLVM-9svn.so`. This means that the next time we all `eglInitialize`,
LLVM's `ManagedStatic`s will be preserved, but not our static var
`ac_init_llvm_target_once_flag`.
We can fix this by calling `LLVMShutdown` before unloading `radeonsi_dri.so=
`,
that way LLVM's `ManagedStatic`s are also reset.
Alas, I'm not familiar enough with the mesa codebase, so I got no clue where
the appropriate place to plop this function is. Any aid would be well
appreciated.
You are receiving this mail because:
- You are the assignee for the bug.
=
--15513366720.674c6A.10287--
--===============1742643195==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline
X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs
IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz
dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs
--===============1742643195==--