dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Bug 108381] amdgpu_bo_import and amdgpu_bo_free are not paired which leaks amdgpu_bo
@ 2018-10-16  5:11 bugzilla-daemon
  2018-10-16  5:12 ` bugzilla-daemon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bugzilla-daemon @ 2018-10-16  5:11 UTC (permalink / raw)
  To: dri-devel


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

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

            Bug ID: 108381
           Summary: amdgpu_bo_import and amdgpu_bo_free are not paired
                    which leaks amdgpu_bo
           Product: Mesa
           Version: 18.2
          Hardware: All
                OS: Linux (All)
            Status: NEW
          Severity: major
          Priority: medium
         Component: Drivers/Gallium/radeonsi
          Assignee: dri-devel@lists.freedesktop.org
          Reporter: zhangyong@lbesec.com
        QA Contact: dri-devel@lists.freedesktop.org

Created attachment 142039
  --> https://bugs.freedesktop.org/attachment.cgi?id=142039&action=edit
sample code to reproduce the issue

amdgpu_bo is reference counted, libdrm expects the number of calls to
amdgpu_bo_import must be equal to amdgpu_bo_free.

When importing prime fd into mesa, amdgpu_bo_from_handle will be called, which
calls amdgpu_bo_import to get the unique handle (which in fact is a pointer to
amdgpu_bo), then wrapped into amdgpu_winsys_bo object.

The problem is amdgpu_winsys_bo is also reference counted, if one tries to
import the same prime fd for multiple times, amdgpu_bo_import will be called
for multiple times, but only one amdgpu_winsys_bo will be created, so
amdgpu_bo_free will be called for only once, eventually leaks memory.

I have attached a sample code to reproduce this issue.

a possible solution is to call amdgpu_bo_free after amdgpu_bo_import if
result.buf_handle can be found in ws->bo_export_table, which will balance the
number of calls to amdgpu_bo_import and amdgpu_bo_free.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-07  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-16  5:11 [Bug 108381] amdgpu_bo_import and amdgpu_bo_free are not paired which leaks amdgpu_bo bugzilla-daemon
2018-10-16  5:12 ` bugzilla-daemon
2018-10-16  9:17 ` bugzilla-daemon
2019-06-07  8:30 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).