| 4d8bdd8b | 04-May-2022 |
Anatoly Burakov <[email protected]> |
malloc: fix ASan handling for unmapped memory
Currently, when we free previously allocated memory, we mark the area as "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a malloc ele
malloc: fix ASan handling for unmapped memory
Currently, when we free previously allocated memory, we mark the area as "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a malloc element will cause pages to be unmapped from memory and re-backed with anonymous memory again. This may cause ASan's "use-after-free" error down the line, because the allocator will try to write into memory areas recently marked as "freed".
To fix this, we need to mark the unmapped memory area as "available", and fixup surrounding malloc element header/trailers to enable later malloc routines to safely write into new malloc elements' headers or trailers.
Bugzilla ID: 994 Fixes: 6cc51b1293ce ("mem: instrument allocator for ASan") Cc: [email protected]
Reported-by: David Marchand <[email protected]> Signed-off-by: Anatoly Burakov <[email protected]>
show more ...
|
| a95d7054 | 05-Apr-2022 |
David Marchand <[email protected]> |
eal: factorize lcore main loop
All OS implementations provide the same main loop. Introduce helpers (shared for Linux and FreeBSD) to handle synchronisation between main and threads and factorize th
eal: factorize lcore main loop
All OS implementations provide the same main loop. Introduce helpers (shared for Linux and FreeBSD) to handle synchronisation between main and threads and factorize the rest as common code. Thread id are now logged as string in a common format across OS.
Note: - this change also fixes Windows EAL: worker threads cpu affinity was incorrectly reported in log.
- libabigail flags this change as breaking ABI in clang builds: 1 function with some indirect sub-type change:
[C] 'function int rte_eal_remote_launch(int (void*)*, void*, unsigned int)' at eal_common_launch.c:35:1 has some indirect sub-type changes: parameter 1 of type 'int (void*)*' changed: in pointed to type 'function type int (void*)' at rte_launch.h:31:1: entity changed from 'function type int (void*)' to 'typedef lcore_function_t' at rte_launch.h:31:1 type size hasn't changed
This is being investigated on libabigail side. For now, we don't have much choice but to waive reports on this symbol.
Signed-off-by: David Marchand <[email protected]> Acked-by: Morten Brørup <[email protected]> Acked-by: Tyler Retzlaff <[email protected]>
show more ...
|
| e8dc971b | 13-Nov-2021 |
Stephen Hemminger <[email protected]> |
eal: cleanup multiprocess hotplug resources
When rte_eal_cleanup is called, hotplug should unregister the resources associated with the multi-process server.
Signed-off-by: Stephen Hemminger <steph
eal: cleanup multiprocess hotplug resources
When rte_eal_cleanup is called, hotplug should unregister the resources associated with the multi-process server.
Signed-off-by: Stephen Hemminger <[email protected]>
show more ...
|
| 6e858b4d | 13-Nov-2021 |
Stephen Hemminger <[email protected]> |
ipc: end multiprocess thread during cleanup
When rte_eal_cleanup is called, all control threads should exit. For the mp thread, this best handled by closing the mp_socket and letting the thread see
ipc: end multiprocess thread during cleanup
When rte_eal_cleanup is called, all control threads should exit. For the mp thread, this best handled by closing the mp_socket and letting the thread see that.
This also fixes potential problems where the mp_socket gets another hard error, and the thread runs away repeating itself by reading the same error.
Fixes: 85d6815fa6d0 ("eal: close multi-process socket during cleanup") Cc: [email protected]
Signed-off-by: Stephen Hemminger <[email protected]> Acked-by: Anatoly Burakov <[email protected]>
show more ...
|
| 5f4eb82f | 13-Nov-2021 |
Stephen Hemminger <[email protected]> |
log: close in cleanup stage
When application calls rte_eal_cleanup on shutdown, the DPDK log should be closed and cleaned up.
This helps reduce false reports from tools like ASAN and valgrind that
log: close in cleanup stage
When application calls rte_eal_cleanup on shutdown, the DPDK log should be closed and cleaned up.
This helps reduce false reports from tools like ASAN and valgrind that track memory leaks.
Signed-off-by: Stephen Hemminger <[email protected]>
show more ...
|
| f3ca33bb | 18-Jan-2022 |
Srikanth Yalavarthi <[email protected]> |
eal: add internal function to get base address
Added an internal helper to get OS-specific EAL mapping base address
This helper can be used by the drivers to program offload / accelerator devices,
eal: add internal function to get base address
Added an internal helper to get OS-specific EAL mapping base address
This helper can be used by the drivers to program offload / accelerator devices, where the base address can be used as a reference address by the accelerator to access the host memory
An address can also be represented as an offset relative to the base address using smaller data types
Signed-off-by: Srikanth Yalavarthi <[email protected]> Acked-by: Dmitry Kozlyuk <[email protected]> Acked-by: Anatoly Burakov <[email protected]>
show more ...
|
| 0dff3f26 | 03-Feb-2022 |
Dmitry Kozlyuk <[email protected]> |
eal: extend --huge-unlink for hugepage file reuse
Expose Linux EAL ability to reuse existing hugepage files via --huge-unlink=never switch. Default behavior is unchanged, it can also be specified us
eal: extend --huge-unlink for hugepage file reuse
Expose Linux EAL ability to reuse existing hugepage files via --huge-unlink=never switch. Default behavior is unchanged, it can also be specified using --huge-unlink=existing for consistency. Old --huge-unlink switch is kept, it is an alias for --huge-unlink=always. Add a test case for the --huge-unlink=never mode.
Signed-off-by: Dmitry Kozlyuk <[email protected]> Acked-by: Thomas Monjalon <[email protected]> Acked-by: Anatoly Burakov <[email protected]>
show more ...
|
| 32b4771c | 03-Feb-2022 |
Dmitry Kozlyuk <[email protected]> |
eal/linux: allow hugepage file reuse
Linux EAL ensured that mapped hugepages are clean by always mapping from newly created files: existing hugepage backing files were always removed. In this case,
eal/linux: allow hugepage file reuse
Linux EAL ensured that mapped hugepages are clean by always mapping from newly created files: existing hugepage backing files were always removed. In this case, the kernel clears the page to prevent data leaks, because the mapped memory may contain leftover data from the previous process that was using this memory. Clearing takes the bulk of the time spent in mmap(2), increasing EAL initialization time.
Introduce a mode to keep existing files and reuse them in order to speed up initial memory allocation in EAL. Hugepages mapped from such files may contain data left by the previous process that used this memory, so RTE_MEMSEG_FLAG_DIRTY is set for their segments. If multiple hugepages are mapped from the same file: 1. When fallocate(2) is used, all memory mapped from this file is considered dirty, because it is unknown which parts of the file are holes. 2. When ftruncate(3) is used, memory mapped from this file is considered dirty unless the file is extended to create a new mapping, which implies clean memory.
Signed-off-by: Dmitry Kozlyuk <[email protected]> Reviewed-by: Anatoly Burakov <[email protected]>
show more ...
|
| 2edd037c | 03-Feb-2022 |
Dmitry Kozlyuk <[email protected]> |
mem: add dirty malloc element support
EAL malloc layer assumed all free elements content is filled with zeros ("clean"), as opposed to uninitialized ("dirty"). This assumption was ensured in two way
mem: add dirty malloc element support
EAL malloc layer assumed all free elements content is filled with zeros ("clean"), as opposed to uninitialized ("dirty"). This assumption was ensured in two ways: 1. EAL memalloc layer always returned clean memory. 2. Freed memory was cleared before returning into the heap.
Clearing the memory can be as slow as around 14 GiB/s. To save doing so, memalloc layer is allowed to return dirty memory. Such segments being marked with RTE_MEMSEG_FLAG_DIRTY. The allocator tracks elements that contain dirty memory using the new flag in the element header. When clean memory is requested via rte_zmalloc*() and the suitable element is dirty, it is cleared on allocation. When memory is deallocated, the freed element is joined with adjacent free elements, and the dirty flag is updated:
a) If the joint element contains dirty parts, it is dirty:
dirty + freed + dirty = dirty => no need to clean freed + dirty = dirty the freed memory
Dirty parts may be large (e.g. initial allocation), so clearing them could create unpredictable slowdown.
b) If the only dirty part of the joint element is the freed memory, the joint element can be made clean:
clean + freed + clean = clean => freed memory clean + freed = clean must be cleared freed + clean = clean freed = clean
This logic naturally reproduces the old behavior and always applies in modes when EAL memalloc layer returns only clean segments.
As a result, memory is either cleared on free, as before, or it will be cleared on allocation if need be, but never twice.
Signed-off-by: Dmitry Kozlyuk <[email protected]> Reviewed-by: Anatoly Burakov <[email protected]>
show more ...
|
| 770d41bf | 29-Oct-2021 |
Ilyes Ben Hamouda <[email protected]> |
malloc: fix allocation with unknown socket ID
When using rte_malloc() from a thread which is not bound to a numa socket (the typical case is a control thread, but it can also happen on a dataplane t
malloc: fix allocation with unknown socket ID
When using rte_malloc() from a thread which is not bound to a numa socket (the typical case is a control thread, but it can also happen on a dataplane thread if its cpu affinity is on cores attached to several sockets), the used heap is the one from numa socket 0, which may not have available memory.
Fix this by selecting the first socket which has available memory.
Note: malloc_get_numa_socket() is only used from one .c file, so move it there, and remove the inline keyword.
Fixes: b94580d6887e ("malloc: avoid unknown socket id") Cc: [email protected]
Signed-off-by: Ilyes Ben Hamouda <[email protected]> Signed-off-by: Olivier Matz <[email protected]> Acked-by: David Marchand <[email protected]>
show more ...
|
| bb0bd346 | 03-Nov-2021 |
David Hunt <[email protected]> |
eal: suggest using --lcores option
If the user requests to use an lcore above 128 using -l, the eal will exit with "EAL: invalid core list syntax" and very little else useful information.
This patc
eal: suggest using --lcores option
If the user requests to use an lcore above 128 using -l, the eal will exit with "EAL: invalid core list syntax" and very little else useful information.
This patch adds some extra information suggesting to use --lcores so that physical cores above RTE_MAX_LCORE (default 128) can be used. This is achieved by using the --lcores option by mapping the logical cores in the application to physical cores.
For example, if "-l 12-16,130,132" is used, we see the following additional output on the command line:
EAL: lcore 132 >= RTE_MAX_LCORE (128) EAL: lcore 133 >= RTE_MAX_LCORE (128) EAL: To use high physical core ids, please use --lcores to map them to lcore ids below RTE_MAX_LCORE, EAL: e.g. --lcores 0@12,1@13,2@14,3@15,4@16,5@132,6@133
The same is added to -c option parsing.
For example, if "-c 0x300000000000000000000000000000000" is used, we see the following additional output on the command line:
EAL: lcore 128 >= RTE_MAX_LCORE (128) EAL: lcore 129 >= RTE_MAX_LCORE (128) EAL: To use high physical core ids, please use --lcores to map them to lcore ids below RTE_MAX_LCORE, EAL: e.g. --lcores 0@128,1@129
Signed-off-by: David Hunt <[email protected]> Acked-by: Bruce Richardson <[email protected]>
show more ...
|