Hi Lucas, Julien has written an X driver for OMAP5 SoC (which has Vivante's GC320). We're seeing a memory leak when using omapdrm for display and etnaviv for X 2D rendering. The X driver uses DRI3, so dmabuf import/export is involved. I've written a simple DRI3 tester, which supports using different buffer allocation methods: https://github.com/TexasInstruments/dri3wsegl/blob/master/dri3test.c With each run, I can see buffers being left lying around, visible in both omapdrm's and etnaviv's 'gem' debugfs file. And they're there even after killing X. If I try to rmmod etnaviv, I get the warnings below. Unloading omapdrm is not possible, as it's being referenced by something (presumably by etnaviv having imported omapdrm's dmabufs). I haven't debugged this much yet, but we do use dmabuf import & export successfully with omapdrm and v4l2. Has etnaviv dmabuf import/export been tested? Of course, it could be something else than dmabuf related issue too... Tomi # rmmod etnaviv [ 272.131962] ------------[ cut here ]------------ [ 272.136781] WARNING: CPU: 0 PID: 530 at drivers/gpu/drm/drm_mm.c:913 drm_mm_takedown+0x28/0x38 [drm] [ 272.147753] Memory manager not clean during takedown. [ 272.153016] Modules linked in: etnaviv(-) gpu_sched omapdrm drm_kms_helper drm drm_panel_orientation_quirks cfbfillrect cfbimgblt cfbcopyarea con nector_dvi panel_dsi_cm panel_dpi connector_analog_tv connector_hdmi encoder_tpd12s015 encoder_tfp410 omapdss omapdss_base cec snd_soc_omap_hdmi_aud io [ 272.180007] CPU: 1 PID: 530 Comm: rmmod Tainted: G W 4.17.0-rc5-00007-g03fe2c79be5b #9 [ 272.189283] Hardware name: Generic DRA74X (Flattened Device Tree) [ 272.195416] Backtrace: [ 272.197908] [<c010f5e0>] (dump_backtrace) from [<c010f8b0>] (show_stack+0x18/0x1c) [ 272.205528] r7:00000000 r6:600e0013 r5:00000000 r4:c0fc17a8 [ 272.211233] [<c010f898>] (show_stack) from [<c09d1218>] (dump_stack+0xac/0xe0) [ 272.218507] [<c09d116c>] (dump_stack) from [<c013eaec>] (__warn+0xe8/0x114) [ 272.225514] r7:00000009 r6:bf101538 r5:00000000 r4:ed437d84 [ 272.231214] [<c013ea04>] (__warn) from [<c013eb64>] (warn_slowpath_fmt+0x4c/0x6c) [ 272.238745] r9:ed436000 r8:ee2cac44 r7:ed196800 r6:ffffffec r5:bf10150c r4:c0f08948 [ 272.246694] [<c013eb1c>] (warn_slowpath_fmt) from [<bf0cf904>] (drm_mm_takedown+0x28/0x38 [drm]) [ 272.255532] r3:ed27d33c r2:bf10150c [ 272.259136] r5:ed1def40 r4:ed18dc00 [ 272.262879] [<bf0cf8dc>] (drm_mm_takedown [drm]) from [<bf1d94c0>] (etnaviv_iommu_destroy+0x18/0x38 [etnaviv]) [ 272.272978] [<bf1d94a8>] (etnaviv_iommu_destroy [etnaviv]) from [<bf1d50ac>] (etnaviv_gpu_unbind+0x98/0xbc [etnaviv]) [ 272.283646] r5:ed1def40 r4:ed15a810 [ 272.287274] [<bf1d5014>] (etnaviv_gpu_unbind [etnaviv]) from [<c0645760>] (component_unbind+0x38/0x74) [ 272.296634] r5:ed1def40 r4:ed1de240 [ 272.300243] [<c0645728>] (component_unbind) from [<c0645844>] (component_unbind_all+0xa8/0xd4) [ 272.308904] r5:00000000 r4:ed1def40 [ 272.312530] [<c064579c>] (component_unbind_all) from [<bf1d0e38>] (etnaviv_unbind+0x2c/0x48 [etnaviv]) [ 272.321892] r7:ee2cac10 r6:ed232080 r5:ed25c010 r4:ed196800 [ 272.327612] [<bf1d0e0c>] (etnaviv_unbind [etnaviv]) from [<c06455e8>] (take_down_master+0x2c/0x44) [ 272.336624] r7:ee2cac10 r6:bf1da2b8 r5:ee343c10 r4:ed1def40 [ 272.342324] [<c06455bc>] (take_down_master) from [<c0645900>] (component_del+0x90/0x124) [ 272.350463] r5:ee343c10 r4:ed1de240 [ 272.354090] [<c0645870>] (component_del) from [<bf1d5290>] (etnaviv_gpu_platform_remove+0x1c/0x34 [etnaviv]) [ 272.363974] r7:ee2cac10 r6:bf1dd260 r5:ee343c10 r4:ee343c10 [ 272.369695] [<bf1d5274>] (etnaviv_gpu_platform_remove [etnaviv]) from [<c064efe8>] (platform_drv_remove+0x28/0x48) [ 272.380102] r5:ee343c10 r4:ee343c10 [ 272.383712] [<c064efc0>] (platform_drv_remove) from [<c064cfec>] (device_release_driver_internal+0x170/0x218) [ 272.393682] r5:ee343c44 r4:ee343c10 [ 272.397293] [<c064ce7c>] (device_release_driver_internal) from [<c064d0f0>] (driver_detach+0x40/0x74) [ 272.406570] r9:ed436000 r8:c01011c4 r7:0003deec r6:00000800 r5:bf1dd260 r4:ee343c10 [ 272.414365] [<c064d0b0>] (driver_detach) from [<c064bbcc>] (bus_remove_driver+0x64/0xdc) [ 272.422504] r5:c0f08948 r4:bf1dd260 [ 272.426111] [<c064bb68>] (bus_remove_driver) from [<c064df48>] (driver_unregister+0x30/0x50) [ 272.434598] r5:c0f08948 r4:bf1dd260 [ 272.438205] [<c064df18>] (driver_unregister) from [<c064f0d0>] (platform_driver_unregister+0x14/0x18) [ 272.447478] r5:c0f08948 r4:bf1dd440 [ 272.451104] [<c064f0bc>] (platform_driver_unregister) from [<bf1d9e2c>] (etnaviv_exit+0x14/0x1e8 [etnaviv]) [ 272.460925] [<bf1d9e18>] (etnaviv_exit [etnaviv]) from [<c01fc80c>] (sys_delete_module+0x1ac/0x26c) [ 272.470028] [<c01fc660>] (sys_delete_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28) [ 272.478341] Exception stack(0xed437fa8 to 0xed437ff0) [ 272.483430] 7fa0: 0003deb0 bee68c08 0003deec 00000800 b6e8fd78 00000000 [ 272.491660] 7fc0: 0003deb0 bee68c08 00000000 00000081 bee68ef6 0003deb0 bee68dec 00000001 [ 272.499887] 7fe0: b6e52f30 bee68bac 000205bc b6e52f3c [ 272.504975] r7:00000081 r6:00000000 r5:bee68c08 r4:0003deb0 [ 272.511095] irq event stamp: 8963 [ 272.514543] hardirqs last enabled at (8975): [<c09efa20>] _raw_spin_unlock_irq+0x2c/0x64 [ 272.522933] hardirqs last disabled at (9006): [<c09e7fa4>] __schedule+0xcc/0xe70 [ 272.530471] softirqs last enabled at (9002): [<c0102524>] __do_softirq+0x37c/0x69c [ 272.538414] softirqs last disabled at (9027): [<c0147848>] irq_exit+0x12c/0x15c [ 272.545943] ---[ end trace e953bc797b847c51 ]--- [ 272.585280] ------------[ cut here ]------------ [ 272.590417] WARNING: CPU: 1 PID: 530 at drivers/gpu/drm/drm_mm.c:913 drm_mm_takedown+0x28/0x38 [drm] [ 272.599683] Memory manager not clean during takedown. [ 272.604830] Modules linked in: etnaviv(-) gpu_sched omapdrm drm_kms_helper drm drm_panel_orientation_quirks cfbfillrect cfbimgblt cfbcopyarea con nector_dvi panel_dsi_cm panel_dpi connector_analog_tv connector_hdmi encoder_tpd12s015 encoder_tfp410 omapdss omapdss_base cec snd_soc_omap_hdmi_aud io [ 272.631344] CPU: 1 PID: 530 Comm: rmmod Tainted: G W 4.17.0-rc5-00007-g03fe2c79be5b #9 [ 272.640620] Hardware name: Generic DRA74X (Flattened Device Tree) [ 272.646750] Backtrace: [ 272.649235] [<c010f5e0>] (dump_backtrace) from [<c010f8b0>] (show_stack+0x18/0x1c) [ 272.656851] r7:00000000 r6:600e0013 r5:00000000 r4:c0fc17a8 [ 272.662555] [<c010f898>] (show_stack) from [<c09d1218>] (dump_stack+0xac/0xe0) [ 272.669826] [<c09d116c>] (dump_stack) from [<c013eaec>] (__warn+0xe8/0x114) [ 272.676831] r7:00000009 r6:bf101538 r5:00000000 r4:ed437d84 [ 272.682529] [<c013ea04>] (__warn) from [<c013eb64>] (warn_slowpath_fmt+0x4c/0x6c) [ 272.690058] r9:ed436000 r8:ee2cac44 r7:ee2cac10 r6:ed232080 r5:bf10150c r4:c0f08948 [ 272.697967] [<c013eb1c>] (warn_slowpath_fmt) from [<bf0cf904>] (drm_mm_takedown+0x28/0x38 [drm]) [ 272.706803] r3:ed7eac4c r2:bf10150c [ 272.710406] r5:ed25c010 r4:ed369cc0 [ 272.714235] [<bf0cf8dc>] (drm_mm_takedown [drm]) from [<bf0daa8c>] (drm_vma_offset_manager_destroy+0x1c/0x28 [drm]) [ 272.724953] [<bf0daa70>] (drm_vma_offset_manager_destroy [drm]) from [<bf0c9e00>] (drm_gem_destroy+0x18/0x2c [drm]) [ 272.735445] r5:ed25c010 r4:ed196800 [ 272.739271] [<bf0c9de8>] (drm_gem_destroy [drm]) from [<bf0cc774>] (drm_dev_fini+0xa8/0xb0 [drm]) [ 272.748194] r5:ed25c010 r4:ed196800 [ 272.752020] [<bf0cc6cc>] (drm_dev_fini [drm]) from [<bf0cc7bc>] (drm_dev_put.part.0+0x40/0x4c [drm]) [ 272.761204] r5:ed25c010 r4:ed196800 [ 272.765029] [<bf0cc77c>] (drm_dev_put.part.0 [drm]) from [<bf0cc7fc>] (drm_dev_unref+0x18/0x1c [drm]) [ 272.774302] r5:ed25c010 r4:ed196800 [ 272.778040] [<bf0cc7e4>] (drm_dev_unref [drm]) from [<bf1d0e50>] (etnaviv_unbind+0x44/0x48 [etnaviv]) [ 272.787337] [<bf1d0e0c>] (etnaviv_unbind [etnaviv]) from [<c06455e8>] (take_down_master+0x2c/0x44) [ 272.796348] r7:ee2cac10 r6:bf1da2b8 r5:ee343c10 r4:ed1def40 [ 272.802049] [<c06455bc>] (take_down_master) from [<c0645900>] (component_del+0x90/0x124) [ 272.810186] r5:ee343c10 r4:ed1de240 [ 272.813812] [<c0645870>] (component_del) from [<bf1d5290>] (etnaviv_gpu_platform_remove+0x1c/0x34 [etnaviv]) [ 272.823695] r7:ee2cac10 r6:bf1dd260 r5:ee343c10 r4:ee343c10 [ 272.829415] [<bf1d5274>] (etnaviv_gpu_platform_remove [etnaviv]) from [<c064efe8>] (platform_drv_remove+0x28/0x48) [ 272.839820] r5:ee343c10 r4:ee343c10 [ 272.843428] [<c064efc0>] (platform_drv_remove) from [<c064cfec>] (device_release_driver_internal+0x170/0x218) [ 272.853396] r5:ee343c44 r4:ee343c10 [ 272.857006] [<c064ce7c>] (device_release_driver_internal) from [<c064d0f0>] (driver_detach+0x40/0x74) [ 272.866280] r9:ed436000 r8:c01011c4 r7:0003deec r6:00000800 r5:bf1dd260 r4:ee343c10 [ 272.874075] [<c064d0b0>] (driver_detach) from [<c064bbcc>] (bus_remove_driver+0x64/0xdc) [ 272.882213] r5:c0f08948 r4:bf1dd260 [ 272.885821] [<c064bb68>] (bus_remove_driver) from [<c064df48>] (driver_unregister+0x30/0x50) [ 272.894307] r5:c0f08948 r4:bf1dd260 [ 272.897912] [<c064df18>] (driver_unregister) from [<c064f0d0>] (platform_driver_unregister+0x14/0x18) [ 272.907183] r5:c0f08948 r4:bf1dd440 [ 272.910808] [<c064f0bc>] (platform_driver_unregister) from [<bf1d9e2c>] (etnaviv_exit+0x14/0x1e8 [etnaviv]) [ 272.920626] [<bf1d9e18>] (etnaviv_exit [etnaviv]) from [<c01fc80c>] (sys_delete_module+0x1ac/0x26c) [ 272.929728] [<c01fc660>] (sys_delete_module) from [<c0101000>] (ret_fast_syscall+0x0/0x28) [ 272.938040] Exception stack(0xed437fa8 to 0xed437ff0) [ 272.943129] 7fa0: 0003deb0 bee68c08 0003deec 00000800 b6e8fd78 00000000 [ 272.951358] 7fc0: 0003deb0 bee68c08 00000000 00000081 bee68ef6 0003deb0 bee68dec 00000001 [ 272.959583] 7fe0: b6e52f30 bee68bac 000205bc b6e52f3c [ 272.964669] r7:00000081 r6:00000000 r5:bee68c08 r4:0003deb0 [ 272.970490] irq event stamp: 19655 [ 272.973986] hardirqs last enabled at (19673): [<c01bb180>] console_unlock+0x458/0x678 [ 272.982019] hardirqs last disabled at (19690): [<c01badb4>] console_unlock+0x8c/0x678 [ 272.989902] softirqs last enabled at (19688): [<c0102524>] __do_softirq+0x37c/0x69c [ 272.997765] softirqs last disabled at (19707): [<c0147848>] irq_exit+0x12c/0x15c [ 273.005267] ---[ end trace e953bc797b847c52 ]--- Tomi -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel