diff options
| author | Shell <[email protected]> | 2024-11-28 17:53:33 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2025-03-10 22:45:27 +0800 |
| commit | c188ef2b4dccd1c16e5dfd31af33ef695c73dcd4 (patch) | |
| tree | ac050591b83c517ed2707d5e6816f59d535f53fb /libcpu | |
| parent | f51fd19d0a4e0d4381700891645813af6b556386 (diff) | |
feat: mm: added affinity pages allocator
This patch introduces a tagged pages allocator to address the existing problems
of page aliasing on specific platforms and the requirement of page coloring.
It implements an affinity-id aware page manager by separating the runtime page
list into two types: a normal single linked-list and a multi-dimensional affinity-list.
Changes:
- Introduced tagged pages allocator and managing algorithm for affinity pages list
- Modified components to support affinity-id list management
- Updated page allocation and freeing functions to handle tagged pages
- Added configuration options for page affinity block size and debugging
- Modified mmap and elf loading to respect affinity settings
- Enhanced page list management to support multi-dimensional affinity-list
Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'libcpu')
| -rw-r--r-- | libcpu/aarch64/common/mmu.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libcpu/aarch64/common/mmu.c b/libcpu/aarch64/common/mmu.c index 96722b09de..0f6b453e2e 100644 --- a/libcpu/aarch64/common/mmu.c +++ b/libcpu/aarch64/common/mmu.c @@ -296,6 +296,17 @@ void *rt_hw_mmu_map(rt_aspace_t aspace, void *v_addr, void *p_addr, size_t size, mapper = _kernel_map_2M; } + /* check aliasing */ + #ifdef RT_DEBUGGING_ALIASING + #define _ALIAS_OFFSET(addr) ((long)(addr) & (RT_PAGE_AFFINITY_BLOCK_SIZE - 1)) + if (rt_page_is_member((rt_base_t)p_addr) && _ALIAS_OFFSET(v_addr) != _ALIAS_OFFSET(p_addr)) + { + LOG_W("Possibly aliasing on va(0x%lx) to pa(0x%lx)", v_addr, p_addr); + rt_backtrace(); + RT_ASSERT(0); + } + #endif /* RT_DEBUGGING_ALIASING */ + MM_PGTBL_LOCK(aspace); ret = mapper(aspace->page_table, v_addr, p_addr, attr); MM_PGTBL_UNLOCK(aspace); |
