This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM4378: AM437x PVR rendering problem

Part Number: AM4378

SDK:ti-processor-sdk-linux-am437x-evm-09.03.05.02

My Qt Embedded application runs on an AM437x environment with Qt version 5.15.15.
Due to an SDK upgrade from 07.03.00.005 to 09.03.05.02, my system was updated to kernel 6.1.119 and the filesystem was also changed. After the update, I encountered an issue:

Without any changes to my application code (only switching the cross-compiler and sysroot to those from SDK 09.03.05.02), After upgrading the kernel from 5.4.106 to 6.1.119, the CPU utilization of my program's QSGRrenderThread thread increased significantly. Under identical conditions, CPU usage rose by 10% compared to the program running on kernel 5.4.106. Perf analysis revealed extensive memcpy operations within QSGRrenderThread, and this CPU utilization spike is directly attributable to these memcpy operations.
I now suspect this is due to rendering operations not being zero-copy or utilizing DMA.

Why is this happening? Are there any configurations or actions that can help me diagnose and resolve this issue?

  • Hello, 

    Please allow for some time to conduct some testing on our end. We will respond as soon as we gather more information. 

    Thanks,

    Shriya

  • hello,Is there any new information?

  • I also found that there is a memory leak in the pvrsrvkm driver.

    I enabled the kernel memory debugging configuration. like this:

    CONFIG_SLUB_DEBUG=y
    CONFIG_SLUB_DEBUG_ON=y

    CONFIG_DEBUG_KMEMLEAK=y
    CONFIG_DEBUG_KMEMLEAK_MEM_POOL_SIZE=16000
    # CONFIG_DEBUG_KMEMLEAK_TEST is not set
    # CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF is not set
    CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y

    Then I tested my QT program and found that there was a leak when the PVR driver was called in the rendering thread. The kernel displayed the following:

    [14:53:46670]root@CX15:~# cat /proc/kmsg 
    [14:53:46736]<6>[  738.781798] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
    [14:53:46743]<6>[ 1390.726571] kmemleak: 6 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
    [14:53:48465]^C
    [14:54:00465]root@CX15:~# cat /sys/kernel/debug/kmemleak
    [14:54:00687]unreferenced object 0xd50ae940 (size 64):
    [14:54:00688]  comm "QSGRenderThread", pid 412, jiffies 4294944063 (age 1561.650s)
    [14:54:00688]  hex dump (first 32 bytes):
    [14:54:00689]    00 00 00 00 40 b0 03 d5 40 8b fc 00 6b 6b 6b 6b  ....@...@...kkkk
    [14:54:00699]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [14:54:00699]  backtrace:
    [14:54:00699]    [<c023cf80>] __kmalloc+0x40/0x178
    [14:54:00699]    [<bf00071c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [14:54:00699]    [<bf00c928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [14:54:00699]    [<bf00ca64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [14:54:00699]    [<bf011178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [14:54:00700]    [<bf011764>] RA_Alloc+0x5c/0x34c [pvrsrvkm]
    [14:54:00700]    [<bf008464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [14:54:00700]    [<bf008be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [14:54:00700]    [<bf009428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [14:54:00700]    [<bf014094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [14:54:00700]    [<bf015ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [14:54:00700]    [<bf004238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [14:54:00700]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [14:54:00700]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [14:54:00700]    [<c0100060>] ret_fast_syscall+0x0/0x54
    [14:54:00701]unreferenced object 0xd51b0c40 (size 64):
    [14:54:00701]  comm "QSGRenderThread", pid 412, jiffies 4294945261 (age 1549.670s)
    [14:54:00701]  hex dump (first 32 bytes):
    [14:54:00701]    00 00 00 00 80 0b 1b d5 00 e0 3a 01 6b 6b 6b 6b  ..........:.kkkk
    [14:54:00701]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [14:54:00701]  backtrace:
    [14:54:00701]    [<c023cf80>] __kmalloc+0x40/0x178
    [14:54:00701]    [<bf00071c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [14:54:00701]    [<bf00c928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [14:54:00701]    [<bf00ca64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [14:54:00702]    [<bf011178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [14:54:00702]    [<bf0119bc>] RA_Alloc+0x2b4/0x34c [pvrsrvkm]
    [14:54:00702]    [<bf008464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [14:54:00702]    [<bf008be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [14:54:00702]    [<bf009428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [14:54:00702]    [<bf014094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [14:54:00702]    [<bf015ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [14:54:00702]    [<bf004238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [14:54:00702]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [14:54:00702]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [14:54:00703]    [<c0100060>] ret_fast_syscall+0x0/0x54
    [14:54:00703]unreferenced object 0xd518a400 (size 64):
    [14:54:00703]  comm "QSGRenderThread", pid 412, jiffies 4294945719 (age 1545.100s)
    [14:54:00703]  hex dump (first 32 bytes):
    [14:54:00703]    00 00 00 00 80 ce 7e d4 80 d9 39 01 6b 6b 6b 6b  ......~...9.kkkk
    [14:54:00703]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [14:54:00703]  backtrace:
    [14:54:00703]    [<c023cf80>] __kmalloc+0x40/0x178
    [14:54:00703]    [<bf00071c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [14:54:00703]    [<bf00c928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [14:54:00711]    [<bf00ca64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [14:54:00711]    [<bf011178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [14:54:00711]    [<bf011764>] RA_Alloc+0x5c/0x34c [pvrsrvkm]
    [14:54:00711]    [<bf008464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [14:54:00711]    [<bf008be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [14:54:00711]    [<bf009428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [14:54:00711]    [<bf014094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [14:54:00711]    [<bf015ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [14:54:00711]    [<bf004238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [14:54:00711]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [14:54:00711]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [14:54:00713]    [<c0100060>] ret_fast_syscall+0x0/0x54
    [14:54:00780]unreferenced object 0xd520ac40 (size 64):
    [14:54:00790]  comm "QSGRenderThread", pid 412, jiffies 4294946945 (age 1532.910s)
    [14:54:00791]  hex dump (first 32 bytes):
    [14:54:00792]    00 00 00 00 c0 aa 20 d5 80 e1 fc 00 6b 6b 6b 6b  ...... .....kkkk
    [14:54:00805]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [14:54:00805]  backtrace:
    [14:54:00805]    [<c023cf80>] __kmalloc+0x40/0x178
    [14:54:00805]    [<bf00071c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [14:54:00805]    [<bf00c928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [14:54:00806]    [<bf00ca64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [14:54:00806]    [<bf011178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [14:54:00806]    [<bf011764>] RA_Alloc+0x5c/0x34c [pvrsrvkm]
    [14:54:00806]    [<bf008464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [14:54:00806]    [<bf008be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [14:54:00806]    [<bf009428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [14:54:00806]    [<bf014094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [14:54:00806]    [<bf015ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [14:54:00807]    [<bf004238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [14:54:00807]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [14:54:00807]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [14:54:00807]    [<c0100060>] ret_fast_syscall+0x0/0x54
    [14:54:00807]unreferenced object 0xcf6d2dc0 (size 64):
    [14:54:00807]  comm "QSGRenderThread", pid 412, jiffies 4294948057 (age 1521.800s)
    [14:54:00807]  hex dump (first 32 bytes):
    [14:54:00807]    00 00 00 00 00 37 74 d4 20 ba 39 01 6b 6b 6b 6b  .....7t. .9.kkkk
    [14:54:00808]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [14:54:00808]  backtrace:
    [14:54:00808]    [<c023cf80>] __kmalloc+0x40/0x178
    [14:54:00808]    [<bf00071c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [14:54:00808]    [<bf00c928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [14:54:00808]    [<bf00ca64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [14:54:00808]    [<bf011178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [14:54:00809]    [<bf011764>] RA_Alloc+0x5c/0x34c [pvrsrvkm]
    [14:54:00809]    [<bf008464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [14:54:00809]    [<bf008be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [14:54:00809]    [<bf009428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [14:54:00809]    [<bf014094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [14:54:00809]    [<bf015ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [14:54:00809]    [<bf004238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [14:54:00810]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [14:54:00810]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [14:54:00810]    [<c0100060>] ret_fast_syscall+0x0/0x54
    [14:54:00810]unreferenced object 0xcf6df040 (size 64):
    [14:54:00810]  comm "QSGRenderThread", pid 412, jiffies 4294958494 (age 1417.450s)
    [14:54:00810]  hex dump (first 32 bytes):
    [14:54:00810]    00 00 00 00 c0 ed 6c cf 80 b4 39 01 6b 6b 6b 6b  ......l...9.kkkk
    [14:54:00810]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [14:54:00810]  backtrace:
    [14:54:00810]    [<c023cf80>] __kmalloc+0x40/0x178
    [14:54:00811]    [<bf00071c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [14:54:00811]    [<bf00c928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [14:54:00816]    [<bf00ca64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [14:54:00816]    [<bf011178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [14:54:00816]    [<bf011764>] RA_Alloc+0x5c/0x34c [pvrsrvkm]
    [14:54:00816]    [<bf008464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [14:54:00817]    [<bf008be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [14:54:00817]    [<bf009428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [14:54:00817]    [<bf014094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [14:54:00817]    [<bf015ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [14:54:00817]    [<bf004238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [14:54:00817]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [14:54:00817]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [14:54:00819]    [<c0100060>] ret_fast_syscall+0x0/0x54

    During this test, it was found that the value of SUnreclaim in /proc/meminfo kept increasing.

    here is the dmesg and memory info:

    dmesg and meminfo.log

  • Hello, 

    Would you be able to provide the application/sample code you are running? I will get back to you regarding the memory leak; however, this may be a separate issue from the initial problem with QSGRenderThread. 

    Regards,

    Shriya

  • hello ,I use the example of qt-everywhere-opensource-src-5.15.16.tar.xz, the example code  is "qtdeclarative/examples/quick/imageelements"

    kmemleak info is:

    [08:35:16850]root@CX15:~# cat /sys/kernel/debug/kmemleak
    [08:35:17012]unreferenced object 0xcbaf9b80 (size 64):
    [08:35:17012]  comm "QSGRenderThread", pid 262, jiffies 1649235 (age 35774.020s)
    [08:35:17012]  hex dump (first 32 bytes):
    [08:35:17012]    00 00 00 00 00 87 51 c4 00 69 c4 00 6b 6b 6b 6b  ......Q..i..kkkk
    [08:35:17012]    6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
    [08:35:17012]  backtrace:
    [08:35:17012]    [<c023cf80>] __kmalloc+0x40/0x178
    [08:35:17013]    [<bf0dd71c>] OSAllocMem_Impl+0x5c/0x70 [pvrsrvkm]
    [08:35:17013]    [<bf0e9928>] HASH_Insert_Extended+0x3c/0x164 [pvrsrvkm]
    [08:35:17013]    [<bf0e9a64>] HASH_Insert+0x14/0x1c [pvrsrvkm]
    [08:35:17013]    [<bf0ee178>] _AttemptAllocAligned+0x220/0x408 [pvrsrvkm]
    [08:35:17013]    [<bf0ee764>] RA_Alloc+0x5c/0x34c [pvrsrvkm]
    [08:35:17013]    [<bf0e5464>] BM_Alloc+0xf4/0x554 [pvrsrvkm]
    [08:35:17013]    [<bf0e5be4>] AllocDeviceMem.constprop.0+0xc4/0x1a0 [pvrsrvkm]
    [08:35:17013]    [<bf0e6428>] _PVRSRVAllocDeviceMemKM+0xe0/0x20c [pvrsrvkm]
    [08:35:17014]    [<bf0f1094>] PVRSRVAllocDeviceMemBW+0x180/0x434 [pvrsrvkm]
    [08:35:17014]    [<bf0f2ea0>] BridgedDispatchKM+0x8c/0x22c [pvrsrvkm]
    [08:35:17014]    [<bf0e1238>] PVRSRV_BridgeDispatchKM+0xe0/0x338 [pvrsrvkm]
    [08:35:17014]    [<c054fc88>] drm_ioctl+0x1dc/0x38c
    [08:35:17014]    [<c02a020c>] sys_ioctl+0x11c/0xb80
    [08:35:17016]    [<c0100060>] ret_fast_syscall+0x0/0x54
    

  • Hello, 

    Thank you for providing the use case. I will get back to you after testing the application on our end. 

    Regards,

    Shriya