All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@freedesktop.org
To: dri-devel@lists.freedesktop.org
Subject: [Bug 109794] LLVM not properly shutdown in `si_pipe.c`?
Date: Thu, 28 Feb 2019 06:51:08 +0000	[thread overview]
Message-ID: <bug-109794-502@http.bugs.freedesktop.org/> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2027 bytes --]

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: 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: 
```
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 `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.

[-- Attachment #1.2: Type: text/html, Size: 3414 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2019-02-28  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-28  6:51 bugzilla-daemon [this message]
2019-02-28  6:55 ` [Bug 109794] LLVM not properly shutdown in `si_pipe.c`? bugzilla-daemon
2019-09-25 18:49 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109794-502@http.bugs.freedesktop.org/ \
    --to=bugzilla-daemon@freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.