How to release resources that hadn't released by USDPAA application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to release resources that hadn't released by USDPAA application

1,695 Views
tuanna
Contributor I

Hello everyone,

I'm developing usdpaa-apps using usdpaa sources from QorIQ SDK 2.0, my apps is based on reflector demo source. And my problem is when applications got a crash, then it isn't correctly release resources and make a leak. After many times crash it became out of resources and can not start. So have any way to manual (or auto) release resources after got a leak.

Kernel log after leak:

USDPAA process leaking 118 FQIDs

USDPAA process leaking 3 BPIDs

USDPAA process leaking 4 QPOOLs

qman_retire_fq failed on FQ 0x5f, result=0xf2

qman_retire_fq failed on FQ 0x5f, result=0xf2

FQID range [95..95] (1) has 1 leaks

2 Replies

1,498 Views
yipingwang
NXP TechSupport
NXP TechSupport

Hello Tuan Nguyen,

Because USDPAA processes open the /dev/fsl_usdpaa device and perform all resource management through that file-descriptor, the kernel device driver can track what resources are allocated and deallocated by those process. When such a process exits (intentionally or otherwise) the file-descriptor is cleaned up and this allows the device driver to check which resources had not been explicitly released by the application. If there are unreleased frame queues, buffer pools, pool channels or congestion groups, the kernel driver will issue leak warnings to the kernel log (and/or the serial console).

Examples:

USDPAA process leaking 10 FQIDs

USDPAA process leaking 4 QPOOLs

Leaked resources are not automatically returned to the allocators, because the current drivers do not yet support automatic clean up and recovery of resources that are left in an undefined (and possibly volatile) state.

Even when applications explicitly deallocate resources back to the kernel-managed allocators (subsequently described here in the "Multi-process PPAC Applications" topic), there is no protection against applications that fail to first put those resources back into their expected “power-on” states. As such, an application that does not correctly clean up resources can, for the current version of the SDK, pollute the allocators with resources that will be allocated out to other users and lead to undefined results.

An exception to the last comment is for QMan and BMan portals, which due to them being UIO-based means they are implicitly “deallocated” when a process exits. In a future release, portals will likely no longer be UIO-based, and in any case, they will likely be “cleaned up” on process-exit.


Have a great day,
Yiping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,498 Views
tuanna
Contributor I

Thank you, Yiping 

0 Kudos
Reply