Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing cache sync: esp_mmu_paddr_find_caps returns wrong answer for pages in large memory blocks (IDFGH-14195) #14988

Open
3 tasks done
kasperl opened this issue Dec 6, 2024 · 2 comments
Assignees
Labels
Status: Selected for Development Issue is selected for development

Comments

@kasperl
Copy link

kasperl commented Dec 6, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

CC: @mythbuster5

I believe memory blocks in regions can span multiple MMU pages. However, the esp_mmu_paddr_find_caps function only checks the starting address and thus may return the wrong answer for pages that are contained in such large memory blocks. This in return leads to missing cache synchronization.

5bac46b#diff-faa20d683c326250f53c6865a91baa990ecdb2cd61c03dfc15a2558c24df289dR350

I believe this fixes the issue:

--- a/components/esp_mm/esp_mmu_map.c
+++ b/components/esp_mm/esp_mmu_map.c
@@ -347,7 +347,7 @@ IRAM_ATTR esp_err_t esp_mmu_paddr_find_caps(const esp_paddr_t paddr, mmu_mem_cap
             }
 
             //now we are only traversing the actual dynamically allocated blocks, dummy_head and dummy_tail are excluded already
-            if (mem_block->paddr_start == paddr) {
+            if (mem_block->paddr_start <= paddr && paddr < mem_block->paddr_end) {
                 found = true;
                 found_block = mem_block;
                 break;
@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 7, 2024
@github-actions github-actions bot changed the title Missing cache sync: esp_mmu_paddr_find_caps returns wrong answer for pages in large memory blocks Missing cache sync: esp_mmu_paddr_find_caps returns wrong answer for pages in large memory blocks (IDFGH-14195) Dec 7, 2024
@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels Dec 10, 2024
@kasperl
Copy link
Author

kasperl commented Jan 23, 2025

@Icarus113 Any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Selected for Development Issue is selected for development
Projects
None yet
Development

No branches or pull requests

4 participants