<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="margin: 0;">After reviewing the code, I believe that the combination of the __linux__ and _GNU_SOURCE macros effectively confirms whether the pthread_getname_np() API can be utilized. I will proceed with adding them. Thank you~</div><div style="margin: 0;"><div style="margin: 0;">#if defined(__linux__) && defined(_GNU_SOURCE)</div><div><br></div><div>ÔÚ 2024-04-25 09:08:59£¬"Îâ½£Ô¾" <wujianyue000@163.com> дµÀ£º</div></div><blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><p style="margin: 0;">Hello, Stephen,</p><div style="margin: 0;"><br></div><div style="margin: 0;">Good day</div><div style="margin: 0;">The issue is not caused by DPDK itself, but arises when the DPDK worker process attempts to set affinity to a cpuset that exceeds the limits set by the cgroup cpuset settings.</div><div style="margin: 0;">Original error prints are:</div><div style="margin: 0;"> PANIC in rte_eal_init():</div><div style="margin: 0;"> Cannot set affinity</div><div style="margin: 0;"> # Callstacks.</div><div style="margin: 0;"><br></div><div style="margin: 0;"><font face="arial"><span style="white-space-collapse: preserve;">Finding the detailed reason for the failure was challenging, so I added extra print statements to help diagnose the issue.</span></font></div><div style="margin: 0;"><font face="arial"><span style="white-space-collapse: preserve;">I understand your concern about maintaining OS independence with the rte_thread functions. </span></font><span style="white-space-collapse: preserve; font-family: arial;">This change aims to provide more context when errors occur, facilitating quicker troubleshooting. I agree that this introduces more code and could be seen as platform-specific. Perhaps we could implement this conditionally, only for platforms where such detailed logging is supported and useful.</span></div><div style="margin: 0;"><font face="arial"><span style="white-space-collapse: preserve;"><br></span></font></div><div style="margin: 0;"><span style="font-family: arial; white-space-collapse: preserve;">At 2024-04-24 23:50:21, "Stephen Hemminger" <stephen@networkplumber.org> wrote:</span></div><pre>>On Tue, 23 Apr 2024 11:02:43 +0800
>Jianyue Wu <wujianyue000@163.com> wrote:
>
>> Improve the robustness of setting thread affinity in DPDK
>> by adding detailed error logging.
>
>Is this an error you saw in your application or something inside DPDK?
>
>> Changes:
>> 1. Check the return value of pthread_setaffinity_np() and log an error
>> if the call fails.
>
>Not sure this is necessary. The rte_thread functions are intended to
>be os independent wrapper for threads. Does it need to be this chatty.
>
>> 2. Include the current thread name, the intended CPU set, and a detailed
>> error message in the log.
>
>This introduces a more code and ends up being Linux/BSD specific only
>for the case where application did something wrong.
</pre></div></blockquote></div>