Skip to contentSkip to conversation

LLVM not properly shutdown in `si_pipe.c`?

Bug 109794 [email protected] 1 participant 3 messages Feb 28, 2019 – Sep 25, 2019

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=109794

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: [email protected]
Reporter: [email protected]
QA Contact: [email protected]

tl;dr; Shouldn't we be calling LLVMShutdown() somewhere?

I had a program which was calling:

```
eglInitialize(disp, &majoir, &minor); 
eglTerminate(disp); 
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 also 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, but not libLLVM-9svn.so. This means that the next time we all eglInitialize, LLVM's ManagedStatics 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 ManagedStatics 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.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=109794

--- Comment #1 from Hal Gentz <[email protected]> --- s/an investigation//
s/in an eglInitialize call/when we call eglInitialize/ s/happens once./initializes stuff once./
s/we all/we call/

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=109794

GitLab Migration User <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |MOVED

--- Comment #2 from GitLab Migration User <[email protected]> --- -- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1377.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel