dongjiuzhu1
cd97134c7c
mm/mempool: update nexpand/ninitial/ninterrupt to xxxsize
...
Let's specify size instead of number, so that we can unify the size of
expansion memory in the multiple mempool.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-15 20:05:55 +08:00
dongjiuzhu1
adaca6a5ce
mm/mempool: using inline list instead of queue to avoid kasan report
...
the crash backtrace:
kasan_report (addr=0xf3d02fd4, size=4, is_write=false) at
kasan/kasan.c:106
0x5658518d in __asan_loadN_noabort (addr=0xf3d02fd4, size=4) at
kasan/kasan.c:300
0x565851ee in __asan_load4_noabort (addr=0xf3d02fd4) at
kasan/kasan.c:334
0x56580b02 in sq_remfirst (queue=0xf3d02b08) at
queue/sq_remfirst.c:45
0x565e0e0b in mempool_alloc (pool=0xf3d02aec) at
mempool/mempool.c:161
0x566033d2 in mempool_multiple_alloc (mpool=0xf3d02a30, size=16) at
mempool/mempool_multiple.c:147
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-15 20:05:55 +08:00
Xiang Xiao
a6428f4c27
mm: Integrate TLSF manager
...
can be enabled by CONFIG_MM_TLSF_MANAGER=y
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-15 03:43:37 +08:00
Jukka Laitinen
a2a10c87e3
mm/shm: Switch to use process' common virtual memory region allocator
...
- Also remove the nuttx private shm.h file nuttx/mm/shm.h, which became redundant
- Also remove the gran allocator initialization/release in binfmt since common
vpage allocator is initialized in group_create/group_leave
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 02:20:13 +08:00
Jukka Laitinen
2236facca9
mm/map: Add a common virtual memory region allocator
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 02:20:13 +08:00
Jukka Laitinen
70de321de3
arch/Kconfig: remove virtual memory allocator dependency from MM_SHM
...
The dependency should be vice versa; the MM_SHM should depend on the
existence of the virtual memory range allocator.
Create a new CONFIG flag CONFIG_ARCH_VMA_MAPPING, which will define that
there is a virtual memory range allocator. Make MM_SHM select that flag
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 02:20:13 +08:00
Jukka Laitinen
3ea7a6fb77
mm/shm: Clean up the System-V shm driver
...
Move shmdt functionality into shm_unmap, and use shm_unmap as the common
detach function.
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 23:24:50 +08:00
Jukka Laitinen
5150979488
mm/shm: Remove gs_vaddr from task group and use dynamic vm_map instead
...
Replace static gs_vaddr with a new dynamic mapping list. Collecting all
this kind of virtual memory mappings into a single structure makes
things more consistent.
This still leaves the task group specific granule alloocator, gs_handle,
in the task group
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
Jukka Laitinen
7f8bec7070
Add mm/mm_map virtual memory mapping list
...
The task_group specific list can be used to store information about
mmappings.
For a driver or filesystem performing mmap can also enable munmap by
adding an item to this list using mm_map_add(). The item is then
returned in the corresponding munmap call.
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
Xiang Xiao
6214f3cde7
mm/heap: Fix the minor style issue
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-08 01:25:18 +02:00
Xiang Xiao
54de894e52
mm/heap: Skip memset backtrace buffer
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-08 01:25:18 +02:00
Xiang Xiao
70ecb4ef26
mm/heap: Changee mmchunk_handler_t to mm_node_handler_t
...
to unify the term usage(chunk v.s. node and mm v.s. mm_)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-08 01:25:18 +02:00
YAMAMOTO Takashi
bf7db14feb
Suppress -Wsign-compare warning on a few places
2022-12-26 18:23:41 +08:00
anjiahao
f403118647
mm:fix typos
...
./mm_heap/mm.h:86:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
86 | FAR strcut tcb_s *tcb; \
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-22 20:19:05 +08:00
chao an
e6b37f2b2d
mm/iob: revert "modify iob to support header padding and alignment features"
...
we don't need to implement l2 isolation through io_head, iob offload will use io_offset
-------------------------------------------------------------
Layout of different NICs implementation:
iob_data (aligned by CONFIG_IOB_ALIGNMENT)
|
| io_offset(CONFIG_NET_LL_GUARDSIZE)
| |
-------------------------------------------------
Ethernet | Reserved | ETH_HDRLEN | io_len |
---------------------------------|---------------
8021Q | Reserved | ETH_8021Q_HDRLEN | io_len |
---------------------------------|---------------
ipforward | Reserved | io_len |
-------------------------------------------------
--------------------------------------------------------------------
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-21 01:43:02 +08:00
chao an
6e380c0978
mm/iob: add a helper function to get iob count in chain
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-21 01:40:24 +08:00
anjiahao
70791af8e2
procmeminfo:support memdump can show specific task
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-19 20:43:33 +08:00
chao an
4f239e145e
Revert "mm/iob/contig: enhance iob contig to support iob chain"
...
This reverts commit 56a4e90dc4
.
2022-12-19 01:32:05 +08:00
chao an
56a4e90dc4
mm/iob/contig: enhance iob contig to support iob chain
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-18 21:15:47 +08:00
chao an
881c9d9fac
mm/iob: add support of partial bytes clone
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-14 21:37:20 +08:00
chao an
d6d56c3372
mm/iob: add support of nonblock iob_clone
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-14 21:37:20 +08:00
chao an
e2b00a9fcc
mm/iob: reserved bytes should be updated after each iteration
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-07 21:24:25 +08:00
Xiang Xiao
800fac05d9
mm: Change the default of MM_UBSAN_TRAP_ON_ERROR to n
...
let's give more information by default
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-06 19:01:25 +08:00
chao an
415fa25eb7
mm/ubsan: fix build warning
...
ubsan/ubsan.c: In function ‘get_signed_val’:
ubsan/ubsan.c:162:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
162 | uint64_t ret = (uint64_t)val & mask;
|
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-05 14:06:27 +08:00
chao an
34d2cde8a8
net/l2/l3/l4: add support of iob offload
...
1. Add new config CONFIG_NET_LL_GUARDSIZE to isolation of l2 stack,
which will benefit l3(IP) layer for multi-MAC(l2) implementation,
especially in some NICs such as celluler net driver.
new configuration options: CONFIG_NET_LL_GUARDSIZE
CONFIG_NET_LL_GUARDSIZE will reserved l2 buffer header size of
network buffer to isolate the L2/L3 (MAC/IP) data on network layer,
which will be beneficial to L3 network layer protocol transparent
transmission and forwarding
------------------------------------------------------------
Layout of frist iob entry:
iob_data (aligned by CONFIG_IOB_ALIGNMENT)
|
| io_offset(CONFIG_NET_LL_GUARDSIZE)
| |
-------------------------------------------------
iob | Reserved | io_len |
-------------------------------------------------
-------------------------------------------------------------
Layout of different NICs implementation:
iob_data (aligned by CONFIG_IOB_ALIGNMENT)
|
| io_offset(CONFIG_NET_LL_GUARDSIZE)
| |
-------------------------------------------------
Ethernet | Reserved | ETH_HDRLEN | io_len |
---------------------------------|---------------
8021Q | Reserved | ETH_8021Q_HDRLEN | io_len |
---------------------------------|---------------
ipforward | Reserved | io_len |
-------------------------------------------------
--------------------------------------------------------------------
2. Support iob offload to l2 driver to avoid unnecessary memory copy
Support send/receive iob vectors directly between the NICs and l3/l4
stack to avoid unnecessary memory copies, especially on hardware that
supports Scatter/gather, which can greatly improve performance.
new interface to support iob offload:
------------------------------------------
| IOB version | original |
|----------------------------------------|
| devif_iob_poll() | devif_poll() |
| ... | ... |
------------------------------------------
--------------------------------------------------------------------
1> NIC hardware support Scatter/gather transfer
TX:
tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
/ \
/ \
devif_poll_[l3|l4]_connections() devif_iob_send() (nocopy:udp/icmp/...)
/ \ (copy:tcp)
/ \
devif_iob_poll("NIC"_txpoll) callback() // "NIC"_txpoll
|
dev->d_iob: |
--------------- ---------------
io_data iob1 | | | iob3 | | |
\ --------------- ---------------
--------------- | --------------- |
iob0 | | | | iob2 | | | |
--------------- | --------------- |
\ | / /
\ | / /
----------------------------------------------
NICs io vector | | | | | | | | | |
----------------------------------------------
RX:
[tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
|
|
[tcp|udp|icmp|...]_ipv[4|6]_in()/...
|
|
pkt/ipv[4/6]_input()/...
|
|
NICs io vector receive(iov_base to each iobs)
--------------------------------------------------------------------
2> CONFIG_IOB_BUFSIZE is greater than MTU:
TX:
"(CONFIG_IOB_BUFSIZE) > (MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE + CONFIG_NET_LL_GUARDSIZE)"
tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
/ \
/ \
devif_poll_[l3|l4]_connections() devif_iob_send() (nocopy:udp/icmp/...)
/ \ (copy:tcp)
/ \
devif_iob_poll("NIC"_txpoll) callback() // "NIC"_txpoll
|
"NIC"_send()
(dev->d_iob->io_data[CONFIG_NET_LL_GUARDSIZE - NET_LL_HDRLEN(dev)])
RX:
[tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
|
|
[tcp|udp|icmp|...]_ipv[4|6]_in()/...
|
|
pkt/ipv[4/6]_input()/...
|
|
NICs io vector receive(iov_base to io_data)
--------------------------------------------------------------------
3> Compatible with all old flat buffer NICs
TX:
tcp_poll()/udp_poll()/pkt_poll()/...(l3|l4)
/ \
/ \
devif_poll_[l3|l4]_connections() devif_iob_send() (nocopy:udp/icmp/...)
/ \ (copy:tcp)
/ \
devif_iob_poll(devif_poll_callback()) devif_poll_callback() /* new interface, gather iobs to flat buffer */
/ \
/ \
devif_poll("NIC"_txpoll) "NIC"_send()(dev->d_buf)
RX:
[tcp|udp|icmp|...]ipv[4|6]_data_handler()(iob_concat/append to readahead)
|
|
[tcp|udp|icmp|...]_ipv[4|6]_in()/...
|
|
netdev_input() /* new interface, Scatter/gather flat/iob buffer */
|
|
pkt/ipv[4|6]_input()/...
|
|
NICs io vector receive(Orignal flat buffer)
3. Iperf passthrough on NuttX simulator:
-------------------------------------------------
| Protocol | Server | Client | |
|-----------------------------------------------|
| TCP | 813 | 834 | Mbits/sec |
| TCP(Offload) | 1720 | 1100 | Mbits/sec |
| UDP | 22 | 757 | Mbits/sec |
| UDP(Offload) | 25 | 1250 | Mbits/sec |
-------------------------------------------------
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-03 11:47:04 +08:00
zouboan
eaea38e0f2
libc and mm/Makefile:Fix an error caused by backslash in Windows native build
...
libc and mm/Makefile:Fix an error caused by backslash in Windows native build
2022-12-01 01:47:46 +08:00
chao an
cdaa2ba8d4
mm/iob: new function iob_update_pktlen() to update packet length of the iob
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 13:16:23 +08:00
chao an
b452e2fddf
mm/iob: new function iob_reserve() to adjust headroom offset
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 13:16:23 +08:00
Ville Juven
39a567db20
mm/circbuf.c: Fix incorrect usage of void* arithmetics
2022-11-23 23:22:06 +08:00
wangbowen6
f7dec2c250
mm_size2ndx: using flsl to calculate the ndx
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-23 13:19:41 +08:00
Ville Juven
48b9a8d6f4
mm/shm: Move the vma allocators to separate functions
...
This will allow changing the underlying backend, i.e. granule allocator,
to something more efficient, if this is needed later.
Also, it gives easier access to the common SHM book keeping.
2022-11-22 08:54:34 +01:00
Ville Juven
458ff380e5
mm/gran: Allow run-time execution of gran_reserve
...
User can ask for specific granules to be allocated.
This is useful for one thing only: when mmap() is called for a specific
vaddr. The parameter itself is non-sensical, this is just to satisfy
the POSIX standard.
2022-11-22 08:54:34 +01:00
qinwei1
8021dfece6
sched/task/task_getpid: getpid should return process id not thread id
...
Summary:
implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id
Refer to:
https://github.com/apache/incubator-nuttx/issues/2499
https://github.com/apache/incubator-nuttx/pull/2518
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2022-11-17 17:58:08 +08:00
Ville Juven
192a639f8f
mm/shm: Fix several build errors with shm due to missing headers
2022-11-17 09:16:54 +08:00
Xiang Xiao
33dabe3c38
sim: Always enable full UBSan feature to catch more error
...
since the resource is plenty on simulator
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
d6b5a345a4
mm: Let MM_SMALL and MM_REGIONS depend on MM_DEFAULT_MANAGER
...
since these options are coupled with the default heap implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
38d1244751
mm/mempool: Remove MM_MEMPOOL option from Kconfig
...
since the linker can remove the unused object file from the final image
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
a446b5816f
mm/circbuf: Remove MM_CIRCBUF option from Kconfig
...
since the linker can remove the unused object file from the final image
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
Xiang Xiao
7dcf35cf64
mm: Remove the unused macro MM_IS_ALLOCATED
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 14:57:48 +09:00
Xiang Xiao
85b4177913
mm: Remove mm_ prefix from mm_[add|free]_delaylist
...
follow the convention of other static mm functions
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-07 10:01:52 +01:00
Xiang Xiao
b567e09c3c
mm: Restore the return type of mm_lock from bool to int
...
Fix the issue reported here better:
https://github.com/apache/incubator-nuttx/pull/6995
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-07 10:01:52 +01:00
Xiang Xiao
4cc13c19c6
Revert "mm: Check the function result with suitable macro."
...
This reverts commit 460d94729a
.
2022-11-07 10:01:52 +01:00
yinshengkai
85f727f232
tools: replace INCDIR to Makefile variable
...
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables
In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
yinshengkai
95d9abcf58
tools: replace DEFINE script to Makefile variable
...
In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables
In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
ligd
8be4bca3eb
kasan: fix kasan race-condition
...
Change-Id: I1c729b8a85422a1f4326785e5d52cb0fc60d4822
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-03 08:58:16 +08:00
wangbowen6
fccda0c08b
mm_heap: add debug assert to check the alignment problem
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
2022-11-01 19:21:01 +08:00
Xiang Xiao
e08c296a8e
Change the type of tg_joinlock, mm_lock and md_lock from sem_t to mutex_t
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 10:35:53 +01:00
yinshengkai
65dc1fe0fc
mm: add kmm/umm_memdump
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-10-29 11:35:27 +08:00
dongjiuzhu1
579e47347e
mm/mm_heap: define MM_MASK_BIT as significant bits mask
...
using MM_MASK_BIT to expand different bits of preceding field to store the
block status.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-29 00:12:02 +08:00
dongjiuzhu1
5982cafbe0
mm/mm_heap: using LOG2_CEIL to generate MM_MIN_SHIFT at compile time
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-29 00:12:02 +08:00