319 Star 2.1K Fork 1K

OpenHarmony / kernel_liteos_a

 / 详情

Synchronization Discipline for PTE Accesses

已完成
缺陷
创建于  
2021-01-29 15:46

It is not clear from the code and the documentation which synchronization discipline prevents concurrent accesses to PTE.

For example, OsUnmapL2PTE clears a page table. However, it seems the page table is not protected from parallel accesses. Let us consider the following cases:

Concurrent Access 1
LOS_MemAlloc->OsMemAllocWithCheck->OsMemPoolExpand->OsTryShrinkMemory->OsShrinkInactiveList->OsDeletePageCacheLru->OsPageCacheDel->OsUnmapAllLocked->OsUnmapPageLocked->LOS_ArchMmuUnmap->OsUnmapL2PTE to info->archMmu.

Concurrent Access 2
ShmatVmmAlloc->LOS_MMap->OsUserHeapFree->LOS_ArchMmuUnmap->OsUnmapL2PTE to vmSpace->archMmu.

May these accesses to page table happen concurrently?
May these PTE be the same?

评论 (1)

Pavel Andrianov 创建了缺陷
Denny 负责人设置为Harylee
Harylee 任务状态待办的 修改为修复中
Harylee 计划开始日期设置为2021-08-11
Harylee 计划截止日期设置为2021-08-21
Harylee 计划截止日期2021-08-21 修改为2022-01-31
Harylee 通过openharmony/kernel_liteos_a Pull Request !759任务状态修复中 修改为已完成
展开全部操作日志

fix: MMU竞态问题修复

背景:同一个进程的多个线程读写同一个PTE时,由于PTE无保护,存在竞态问题。
方案:新增spinlock保护PTE,包括大锁跟小锁。大锁:一个进程只有一个spinlock锁,多个线程
读写PTE时竞争一把锁,锁的内存占用小,但系统性能降低;小锁:每个页表持有一把spinlock,
由于锁是page结构体的一个字段,内存消耗较大,但是相对大锁性能较优。系统默认使用大锁,用
户可根据具体需要配置使用大锁还是小锁。

close #I2WARC:Synchronization Discipline for PTE Accesses

Signed-off-by: Haryslee lihao189@huawei.com
Change-Id: I5612eeac1f65507160035eae16af61f285182eda

-----来自 commit 748e0d8

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
C
1
https://gitee.com/openharmony/kernel_liteos_a.git
git@gitee.com:openharmony/kernel_liteos_a.git
openharmony
kernel_liteos_a
kernel_liteos_a

搜索帮助