#
64f27886 |
| 02-Nov-2024 |
David Marchand <david.marchand@redhat.com> |
eal/unix: optimize thread creation
Setting the cpu affinity of the child thread from the parent thread is racy when using pthread_setaffinity_np, as the child thread may start running and initialize
eal/unix: optimize thread creation
Setting the cpu affinity of the child thread from the parent thread is racy when using pthread_setaffinity_np, as the child thread may start running and initialize before affinity is set.
On the other hand, setting the cpu affinity from the child thread itself may fail, so the parent thread waits for the child thread to report whether this call succeeded.
This synchronisation point resulted in a significant slow down of rte_thread_create() (as seen in the lcores_autotest unit tests, in OBS for some ARM systems).
Another option for setting cpu affinity is to use the not portable pthread_attr_setaffinity_np available in FreeBSD and glibc, but not available in musl.
Fixes: b28c6196b132 ("eal/unix: fix thread creation") Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Luca Boccassi <bluca@debian.org> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
show more ...
|
#
ae67895b |
| 08-Dec-2023 |
David Marchand <david.marchand@redhat.com> |
lib: add more logging helpers
Add helpers for logging messages in libraries instead of calling RTE_LOG() directly. Those helpers take care of adding a \n: this will make the transition to RTE_LOG_LI
lib: add more logging helpers
Add helpers for logging messages in libraries instead of calling RTE_LOG() directly. Those helpers take care of adding a \n: this will make the transition to RTE_LOG_LINE trivial.
Note: - for acl and sched libraries that still has some debug multilines messages, a direct call to RTE_LOG is used: this will make it easier to notice such special cases,
Signed-off-by: David Marchand <david.marchand@redhat.com>
show more ...
|
#
1c1abf17 |
| 13-Sep-2023 |
Thomas Monjalon <thomas@monjalon.net> |
lib: convert to internal control threads
Calls to rte_ctrl_thread_create() are replaced with rte_thread_create_internal_control(). Other pthread-related functions are replaced with the rte_thread AP
lib: convert to internal control threads
Calls to rte_ctrl_thread_create() are replaced with rte_thread_create_internal_control(). Other pthread-related functions are replaced with the rte_thread API. Only pthread_cancel() has no replacement.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Morten Brørup <mb@smartsharesystems.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
show more ...
|
#
b28c6196 |
| 16-Mar-2023 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal/unix: fix thread creation
In rte_thread_create setting affinity after pthread_create may fail. Such a failure should result in the entire rte_thread_create failing but doesn't.
Additionally if
eal/unix: fix thread creation
In rte_thread_create setting affinity after pthread_create may fail. Such a failure should result in the entire rte_thread_create failing but doesn't.
Additionally if there is a failure to set affinity a race exists where the creating thread will free ctx and depending on scheduling of the new thread it may also free ctx (double free).
Resolve the above by setting the affinity from the newly created thread using a condition variable to signal the completion of the thread start wrapper having completed.
Since we are now waiting for the thread start wrapper to complete we can allocate the thread start wrapper context on the stack. While here clean up the variable naming in the context to better highlight the fields of the context require synchronization between the creating and created thread.
Fixes: ce6e911d20f6 ("eal: add thread lifetime API") Cc: stable@dpdk.org
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Signed-off-by: David Marchand <david.marchand@redhat.com>
show more ...
|
#
a2e94ca8 |
| 05-Oct-2022 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: add thread comparison helper
Add rte_thread_equal() that tests if two rte_thread_id are equal.
Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com> Signed-off-by: Tyler Retzlaff <roret
eal: add thread comparison helper
Add rte_thread_equal() that tests if two rte_thread_id are equal.
Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
show more ...
|
#
ce6e911d |
| 05-Oct-2022 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: add thread lifetime API
The *rte_thread_create()* function can optionally receive an rte_thread_attr_t object that will cause the thread to be created with the affinity and priority described b
eal: add thread lifetime API
The *rte_thread_create()* function can optionally receive an rte_thread_attr_t object that will cause the thread to be created with the affinity and priority described by the attributes object. If no rte_thread_attr_t is passed (parameter is NULL), the default affinity and priority are used.
On Windows, the function executed by a thread when the thread starts is represented by a function pointer of type DWORD (*func) (void*). On other platforms, the function pointer is a void* (*func) (void*).
Performing a cast between these two types of function pointers to uniformize the API on all platforms may result in undefined behavior. To fix this issue, a wrapper that respects the signature required by CreateThread() has been created on Windows.
Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
show more ...
|
#
ca04c78b |
| 24-May-2022 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: get/set thread priority per thread identifier
Add functions for setting and getting the priority of a thread. Priorities on multiple platforms are similarly determined by a priority value and a
eal: get/set thread priority per thread identifier
Add functions for setting and getting the priority of a thread. Priorities on multiple platforms are similarly determined by a priority value and a priority class/policy.
Currently in DPDK most threads operate at the OS-default priority level but there are cases when increasing the priority is useful. For example, high performance applications may require elevated priority levels.
For these reasons, EAL will expose two priority levels which are named suggestively "normal" and "realtime_critical" and are computed as follows:
On Linux, the following mapping is created: RTE_THREAD_PRIORITY_NORMAL corresponds to * policy SCHED_OTHER * priority value: (sched_get_priority_min(SCHED_OTHER) + sched_get_priority_max(SCHED_OTHER))/2; RTE_THREAD_PRIORITY_REALTIME_CRITICAL corresponds to * policy SCHED_RR * priority value: sched_get_priority_max(SCHED_RR);
On Windows, the following mapping is created: RTE_THREAD_PRIORITY_NORMAL corresponds to * class NORMAL_PRIORITY_CLASS * priority THREAD_PRIORITY_NORMAL RTE_THREAD_PRIORITY_REALTIME_CRITICAL corresponds to * class REALTIME_PRIORITY_CLASS (when running with privileges) * class HIGH_PRIORITY_CLASS (when running without privileges) * priority THREAD_PRIORITY_TIME_CRITICAL
Note that on Linux the resulting priority value will be 0, in accordance to the documentation that mention the value should be 0 for SCHED_OTHER policy.
Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
show more ...
|
#
b70a9b78 |
| 12-May-2022 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: get/set thread affinity per thread identifier
Implement functions for getting/setting thread affinity. Threads can be pinned to specific cores by setting their affinity attribute.
Windows erro
eal: get/set thread affinity per thread identifier
Implement functions for getting/setting thread affinity. Threads can be pinned to specific cores by setting their affinity attribute.
Windows error codes are translated to errno-style error codes. The possible return values are chosen so that we have as much semantic compatibility between platforms as possible.
note: convert_cpuset_to_affinity has a limitation that all cpus of the set belong to the same processor group.
Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
show more ...
|
#
56539289 |
| 12-May-2022 |
Tyler Retzlaff <roretzla@linux.microsoft.com> |
eal: provide current thread identifier
Provide a portable type-safe thread identifier. Provide rte_thread_self for obtaining current thread identifier.
Signed-off-by: Narcisa Vasile <navasile@linux
eal: provide current thread identifier
Provide a portable type-safe thread identifier. Provide rte_thread_self for obtaining current thread identifier.
Signed-off-by: Narcisa Vasile <navasile@linux.microsoft.com> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
show more ...
|
#
30a1de10 |
| 15-Feb-2022 |
Sean Morrissey <sean.morrissey@intel.com> |
lib: remove unneeded header includes
These header includes have been flagged by the iwyu_tool and removed.
Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
|
#
99a2dd95 |
| 20-Apr-2021 |
Bruce Richardson <bruce.richardson@intel.com> |
lib: remove librte_ prefix from directory names
There is no reason for the DPDK libraries to all have 'librte_' prefix on the directory names. This prefix makes the directory names longer and also m
lib: remove librte_ prefix from directory names
There is no reason for the DPDK libraries to all have 'librte_' prefix on the directory names. This prefix makes the directory names longer and also makes it awkward to add features referring to individual libraries in the build - should the lib names be specified with or without the prefix. Therefore, we can just remove the library prefix and use the library's unique name as the directory name, i.e. 'eal' rather than 'librte_eal'
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
show more ...
|