-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VC4 kernel framework driver - memory leak #122
Comments
I think it's leaking the dma_fences, certainly the "01" refcount in the hexdump looks suspiciously like them. Could you try the attached patch? 0001-drm-vc4-Release-fence-after-signalling.txt (Sorry, filename is off because GitHub, ridiculously so, does not allow attaching .patch files) |
Hello Stefan, However, another memleak appeared(it may already have been there before, I just did not see it), see below: unreferenced object 0x842aa340 (size 128): Thank you, |
That is an unrelated leak (another refcounting fail, 01 00..) |
Hello Stefan, Thank you, |
Since this is also vc4 related, it should be reported here in this repository and not to the raspberrypi guys. |
Thank you Stefan. The originally reported issue was resolved by the provided patch. I am closing the case and will open a new one for the second memory leak. |
We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt/linux#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com>
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt/linux#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt/linux#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Source: Kernel.org MR: 93353 Type: Integration Disposition: Backport from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable linux-4.14.y ChangeID: 4826773306b5275055632a59eda7957ae543eecd Description: [ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt/linux#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster@mvista.com>
We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt/linux#122 Fixes: cdec4d361323 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com
Source: Kernel.org MR: 93353 Type: Integration Disposition: Backport from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable linux-4.14.y ChangeID: 4826773306b5275055632a59eda7957ae543eecd Description: [ Upstream commit babc811 ] We were never releasing the initial fence reference that is obtained through dma_fence_init. Link: anholt/linux#122 Fixes: cdec4d3 ("drm/vc4: Expose dma-buf fences for V3D rendering.") Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1512236444-301-1-git-send-email-stschake@gmail.com Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster@mvista.com>
Hi all,
(redirected here via: raspberrypi#2293)
I have identified a memory leak in the VC4 kernel framework driver implementation on raspberry pi 3b. Details follow below:
kernel: 4.14.0-v7+
compiler: gcc-6.4
raspberry pi running in 32bit mode
OS: Gentoo Linux
Kernel configuration is attached, see below.
Whenever kodi(v17.6) is playing video, I can see that /proc/slabinfo reports number of kmalloc-128 constantly increasing and never releasing:
kmalloc-128 84916 84924 384 21 2 : tunables 0 0 0 : slabdata 4044 4044 0
In about 24 hours this has taken up about 600MB of the memory and the Pi needs to be restarted to avoid swapping. If I stop kodi playback and leave it idle, the kmalloc-128 remains the same until playback is resumed which starts increasing again. If I stop the X server and kodi altogether, the memory is not released.
The memleak pattern is like the one below
(from /sys/kernel/debug/kmemleak):
unreferenced object 0x95ce16c0 (size 128):
comm "kodi.bin", pid 2075, jiffies 891363 (age 2338.023s)
hex dump (first 32 bytes):
01 00 00 00 5c ed 1e 7f 00 00 00 00 00 00 00 00 ...............
d0 16 ce 95 d0 16 ce 95 00 3a fb b4 00 00 00 00 .........:......
backtrace:
[<802827c8>] kmem_cache_alloc_trace+0x234/0x2f8
[<7f1e461c>] vc4_submit_cl_ioctl+0x730/0xb50 [vc4]
[<7f0d796c>] drm_ioctl_kernel+0x78/0xb8 [drm]
[<7f0d7cd4>] drm_ioctl+0x1b4/0x37c [drm]
[<802ac090>] do_vfs_ioctl+0xb0/0x8b4
[<802ac8d8>] SyS_ioctl+0x44/0x6c
[<80108140>] ret_fast_syscall+0x0/0x28
[] 0xffffffff
Let me know if additional information is required to track this issue down.
rpi-4.14.y-kernel_configuration_file.gz
Saw another issue still open here for memory leak, but what I report happens with pretty high CMA, 256MB, so not related to low CMA setting. Also the trace is different.
Thank you,
-Nikolay
The text was updated successfully, but these errors were encountered: