Note: Weenix
17 Feb 2014###Processes and Threads
####Thoughts
- How different functions interact with each other is really hard to figure out. - First time working on such a large code base.
- Thread should always be in some queue, or it will never be run again.
- In our model, do_exit and kthread_exit are the same because we only have one thread each process. Things will change if we have multi-threaded processes.
- proc_kill and proc_kill_all are only for sys_halt. So maybe we don’t care about the return value?
####Keep in mind
- the thread kthread_destroy destroys should not wait in any queue.
- when cleanup, just destroy the struct is not enough, need to delete itself from the list.
- don’t forget to use the p_wait queue.(in do_waitpid and exit)
- test all the features that you had, don’t presume that you are doing it right.
-
idleproc-> first process
initproc-> second process
####Questions
- Why the data structure for kernel stack and context in thread are different?
- retval == NULL?
- do_exit works now because there is only one thread, what if MTP
-
why can I make myself runnable and switch to other process, the kt_wchan is not NULL and should fail the KASSERT
When curthr acquire the mutex, it’s waitq will contain nothing! It’s acturally on the state of KT_RUN. Only when it’s waiting for a mutex will it be on some waitq.
- exit a thread(use return or use kthread_exit)?
- return value minus?
- examine in sched_switch if nextthread == currentthread?
###Drivers
####Keep in mind
####Questions
-
Why is it that if I delete something, the last char kept showing up
Delt with using a different dbgq.
-
How to handle the case about ckdtail and rhead.
off by 1 issue
- Why we only need to lock the rlock in n_tty_read?
-
How to deal with full buffer?
discard the newly inputted character
-
How to acknowledge interrupt?
dma_reset(see dma.h)
###VFS
####Keep in mind
- the difference between file_t and fs_t
- a lot things missing for do_open
- vput when error in namev
- the pairing between *get/ *ref and *put
- vnode->lookup: error -ENOENT
- namev:lookup error -ENOTDIR
####Questions
- what does it mean if f_pos == -1
- figure facq and vn_ops->acquire
- what about vfs_is_in_use
- readdir
- how to initialize p_cwd in proc_t
- deal with const char **
- how to kmalloc in namev
- any other elegant way to examine if it’s directory
- dir_namev algorithm
- About returning EPERM: vfs_test:292
- vnode->mknod only get the file for special devices, When and how to initialize the corresponding vnode?
###S5FS
####Keep in mind
-
pin and unpin page frames when there’s a chance to block
Even if the blocking operation is not operating on the same page frame
Guard around blocking operations
- mark page frame busy when in the middle of a state transitions
- watch out for the return value from
pframe_get_resident
- pframe_migrate: read it later
- dirty the page when the content is modified
- the block acquired from s5_alloc_block is uninitialized
- watch out for vn_len, it can change when write to the file
- every time you modify an inode, even it’s just modifying the linkcount, dirty it!
- there’s no bug with linkcount!!!
- always check that the size of dir is a multiple of dirent size
- I add a panic in s5fs_mkdir when there’s no space, it should be removed once I’m sure there is no bugs
- pinned page is allocated
- off_t is signed int
- the contents of block corresponding to s5_alloc_block are undefined
- block number cannot be 0, but inode number can be 0- it’s the root directory
####TODO
- s5_link: linkcount on inode_child
- watch out for linkcount: it should always be greater than 1
- Add lock mechanisms in s5fs.c
- add more KASSERT for s5fs_mkdir(check the linkcount)
- check around s5_seek_to_block(it takes in an offset not blocknum and check the offset is not exceeding the file size)
- the block acquired during seek_to_block of inode is memseted, what about file data block
- check all funcions that are calling s5_write_file
- lock the vnode if it will block
- assert at the end of mkdir
- decrement linkcount at s5_remove_dirent
####Questions
- pframe_alloc: what if the pframe is already resident
- what’s the semantics of pframe_fill
- what is the layout of vnode, s5fs, mmobj, pframe
- when should I dirty a page frame?
- should I pin the pframe in pframe_get when the pf is busy
- am I doing the right thing when get NULL from pframe_alloc call pageout deamon
- there’s a potential in pframe_get that it falls into infinite loop of calling pageout deamon
- why pin inodep then dirty_super in s5_alloc_inode
- what to do in s5_seek_to_block when indirectblock is 0
- check seekptr valid- should I do it in s5_seek_to_block?
- how to dirty the page frame that particular inode is residing in
- nice extension for s5_remove_dirent?
- can we always assume that vnode->vn_len == inode->s5_size
- about linkcount, 0 or 1
- the order of pin, unpin, dirty
###VM
####Questions
- any other things for vmmap_destroy?
- vmmap_find_range: page starts at 0?
- why it’s in page resolution instead of byte
- why unexpected kernel page fault is bad in Weenix
- how to differenciate anonymous object and shadow object
-
when to pframe_pin the pages for anon obj(I guess it should be during mmap)
during mmap(the first time we get the pages for the anonymous object)
- what’s different between shadow_put and anon_put
- the realation and operation with mmo_vmas
###TODO
-
Review the refcount with anon
no problem with refcount
-
still pretty shaky about mmo_vmas field, try figure it out
now have a better understanding
-
ref the mmobj when initialize the vmarea
done during vmmap_clone
- watch out for mmo_shadowed field for shadow object
- Review vmmap_read and vmmap_write, sys_read and sys_write
###Ask
- the infinite loop
- kthread stack
####If I have time
- S5_NAME_LEN off by one
- s5fs shutdown and restart bug
- eatmem fail in Dynamic
Your Comments
comments powered by Disqus