From: bugzilla-daemon@freedesktop.org
To: dri-devel@lists.freedesktop.org
Subject: [Bug 108381] amdgpu_bo_import and amdgpu_bo_free are not paired which leaks amdgpu_bo
Date: Tue, 16 Oct 2018 05:11:55 +0000 [thread overview]
Message-ID: <bug-108381-502@http.bugs.freedesktop.org/> (raw)
[-- 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
next reply other threads:[~2018-10-16 5:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 5:11 bugzilla-daemon [this message]
2018-10-16 5:12 ` [Bug 108381] amdgpu_bo_import and amdgpu_bo_free are not paired which leaks amdgpu_bo bugzilla-daemon
2018-10-16 9:17 ` bugzilla-daemon
2019-06-07 8:30 ` 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-108381-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 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).