mirror of
https://github.com/drasko/codezero.git
synced 2026-04-05 11:39:04 +02:00
Mixed changes
- Adding prefaulting of fs0 to avoid page fault deadlocks. - Fixed a bug that a vmo page_cache equivalence would simply drop a link to an original vmo, even if the vmo could have more pages outside the page cache, or if the vmo was not a shadow vmo. - Fixed a bug with page allocator where recursion would corrupt global variables. - Now going to fix or re-write a simpler page allocator that works.
This commit is contained in:
@@ -258,6 +258,28 @@ int mm0_task_init(struct vm_file *f, unsigned long task_start,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prefaults all mapped regions of a task. The reason we have this is
|
||||
* some servers are in the page fault handling path (e.g. fs0), and we
|
||||
* don't want them to fault and cause deadlocks and circular deps.
|
||||
*
|
||||
* Normally fs0 faults dont cause dependencies because its faults
|
||||
* are handled by the boot pager, which is part of mm0. BUT: It may
|
||||
* cause deadlocks because fs0 may fault while serving a request
|
||||
* from mm0.(Which is expected to also handle the fault).
|
||||
*/
|
||||
int task_prefault_regions(struct tcb *task, struct vm_file *f)
|
||||
{
|
||||
struct vm_area *vma;
|
||||
|
||||
list_for_each_entry(vma, &task->vm_area_list, list) {
|
||||
for (int pfn = vma->pfn_start; pfn < vma->pfn_end; pfn++)
|
||||
BUG_ON(prefault_page(task, __pfn_to_addr(pfn),
|
||||
VM_READ | VM_WRITE) < 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main entry point for the creation, initialisation and
|
||||
* execution of a new task.
|
||||
@@ -278,6 +300,10 @@ int task_exec(struct vm_file *f, unsigned long task_region_start,
|
||||
if ((err = task_mmap_regions(task, f)) < 0)
|
||||
return err;
|
||||
|
||||
if (ids->tid == VFS_TID)
|
||||
if ((err = task_prefault_regions(task, f)) < 0)
|
||||
return err;
|
||||
|
||||
if ((err = task_setup_registers(task, 0, 0, 0)) < 0)
|
||||
return err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user