mirror of
https://github.com/drasko/codezero.git
synced 2026-02-12 01:43:16 +01:00
Mixed changes
- Added automatic utcb map/prefaulting of forked tasks for fs0 so that it does not need to explicitly request those tasks from mm0. Eliminating fs0 requests to mm0 reduce deadlock possibilities. - Replaced kmalloc with a public malloc implementation because of a bug in kmalloc. - Fixed a kfree bug. default_release_pages was trying to free page_array pages.
This commit is contained in:
@@ -512,6 +512,27 @@ void init_pm(struct initdata *initdata)
|
||||
start_boot_tasks(initdata);
|
||||
}
|
||||
|
||||
/* Maps and prefaults the utcb of a task into another task */
|
||||
void task_map_prefault_utcb(struct tcb *mapper, struct tcb *owner)
|
||||
{
|
||||
BUG_ON(!owner->utcb);
|
||||
|
||||
/*
|
||||
* First internally map the tcb as a shm area. We use
|
||||
* such posix semantics on purpose to have a unified
|
||||
* way of doing similar operations.
|
||||
*/
|
||||
BUG_ON(IS_ERR(shmat_shmget_internal(mapper,
|
||||
(key_t)owner->utcb,
|
||||
owner->utcb)));
|
||||
|
||||
/* Prefault the owner's utcb to mapper's address space */
|
||||
for (int i = 0; i < __pfn(DEFAULT_UTCB_SIZE); i++)
|
||||
prefault_page(mapper, (unsigned long)owner->utcb +
|
||||
__pfn_to_addr(i), VM_READ | VM_WRITE);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* During its initialisation FS0 wants to learn how many boot tasks
|
||||
* are running, and their tids, which includes itself. This function
|
||||
@@ -535,7 +556,7 @@ int send_task_data(l4id_t requester)
|
||||
BUG_ON(!vfs->utcb);
|
||||
|
||||
/* Attach mm0 to vfs's utcb segment just like a normal task */
|
||||
BUG_ON(IS_ERR(shmat_shmget_internal((key_t)vfs->utcb, vfs->utcb)));
|
||||
BUG_ON(IS_ERR(shmat_shmget_internal(self, (key_t)vfs->utcb, vfs->utcb)));
|
||||
|
||||
/* Prefault those pages to self. */
|
||||
for (int i = 0; i < __pfn(DEFAULT_UTCB_SIZE); i++)
|
||||
|
||||
Reference in New Issue
Block a user