summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-05-22ipc: drop size parameter from `ipc_space_create'Justus Winter
* ipc/ipc_space.c (ipc_space_create): Drop size parameter. * ipc/ipc_space.h (ipc_space_create): Adopt declaration, fix comment. * kern/ipc_tt.c (ipc_task_init): Adopt accordingly.
2015-05-20ipc: inline key ipc entry lookup functionsJustus Winter
Declare functions looking up IPC entries that were previously inlined manually with `static inline' so that they will be inlined into the fast paths by the compiler. * ipc/ipc_entry.c (ipc_entry_lookup, ipc_entry_get, ipc_entry_dealloc): Move functions... * ipc/ipc_space.h: ... here, and declare them as `static inline'. * ipc/ipc_entry.h: Drop associated declarations.
2015-05-20ipc: replace the IPC table with a radix treeJustus Winter
Currently, the port names are mapped to an IPC object (e.g. a port) using a table. This, however, requires large chunks of continuous memory, and leads to scalability problems as virtual kernel memory is a scarce resource. To avoid excessive overhead, non-contiguous port names are spilled into a splay tree. Replace the IPC table with a radix tree. As the radix tree is able to store non-contiguous names with reasonable overhead, we can drop the splay tree as well. * ipc/ipc_entry.c (ipc_entry_tree_collision): Remove function. (ipc_entry_cache): New variable. (ipc_entry_lookup): Replace with a radix tree lookup. (ipc_entry_get): The free list handling is changed a little. Adopt accordingly. (ipc_entry_free_name): New function. (ipc_entry_alloc): Adopt accordingly. (ipc_entry_alloc_name): Likewise. (ipc_entry_dealloc): Likewise. (ipc_entry_grow_table): Remove function. * ipc/ipc_entry.h (struct ipc_entry): Update comment, add field for name and free list, remove unused fields. (ipc_entry_cache, ie_alloc, ie_free): New declarations. (struct ipc_tree_entry): Remove. Also remove any related declarations. (ipc_entry_grow_table): Remove declaration. * ipc/ipc_init.c (ipc_bootstrap): Adopt initialization. * ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): Use `ipc_entry_alloc' instead of re-coding it. Adopt free list handling. (ipc_kmsg_copyout_object): Adopt free list handling, store the name. * ipc/ipc_object.c (ipc_object_copyout): Likewise. (ipc_object_copyout_multiname): Likewise. * ipc/ipc_space.c (ipc_space_create): Initialize radix tree and free list. Drop table and splay tree initialization. (ipc_space_destroy): Free ipc entries and radix tree, remove table and splay tree cleanup. * ipc/ipc_space.h (struct ipc_space): Add radix tree, free list, and size. Remove all fields related to the table and splay tree. * ddb/db_print.c (db_port_iterate): Adopt iteration. (db_lookup_port): Adopt lookup. * include/mach_debug/ipc_info.h: Remove unused parts of the debug interface. * include/mach_debug/mach_debug.defs: Likewise. * include/mach_debug/mach_debug_types.defs: Likewise. * ipc/mach_debug.c: Likewise. * ipc/ipc_right.c (ipc_right_reverse): Adopt lookup, store name. (ipc_right_check): Adopt removal. (ipc_right_destroy): Likewise. (ipc_right_dealloc): Likewise. (ipc_right_delta): Likewise. (ipc_right_copyin): Adopt insertion, adopt removal. (ipc_right_copyin_two): Adopt removal. (ipc_right_copyout): Adopt insertion, adopt removal. (ipc_right_rename): Likewise, also update comment. * ipc/mach_port.c (mach_port_names): Adopt iteration. (mach_port_get_set_status): Likewise. * ipc/port.h: Update comment. * ipc/ipc_hash.c: Delete file. * ipc/ipc_hash.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * Makefrag.am (libkernel_a_SOURCES): Remove these files.
2015-05-20ipc: replace reverse hash table with a radix treeJustus Winter
Currently, there is a hash table mapping (space, object) tuples to `ipc_entry' objects. This hash table is intertwined with the IPC tables. There is one hash table per IPC space, but it is only for the entries in the IPC table. This hash table is called `local' in the source. All IPC entries being spilled into the splay tree are instead mapped by a global hash table. Replace the local (i.e. per IPC space) reverse hash table with a radix tree. * ipc/ipc_entry.c (ipc_entry_grow_table): Adjust accordingly. * ipc/ipc_entry.h (struct ipc_entry): Adjust comment. * ipc/ipc_hash.c: Adjust comment explaining the local lookup table. (IPC_LOCAL_HASH_INVARIANT): New macro. (ipc_hash_local_lookup): Use the new `ipc_reverse_lookup' function. (ipc_hash_local_insert): Use the new `ipc_reverse_insert' function. (ipc_hash_local_delete): Use the new `ipc_reverse_remove' function. * ipc/ipc_space.c (ipc_space_create): Initialize radix tree. (ipc_space_destroy): Free radix tree. * ipc/ipc_space.h (struct ipc_space): Add radix tree. (ipc_reverse_insert): New function. (ipc_reverse_remove): Likewise. (ipc_reverse_remove_all): Likewise. (ipc_reverse_lookup): Likewise. * ipc/ipc_right.c (ipc_right_clean): Update comment.
2015-05-20ipc: undo manual inlining of `ipc_entry_X' functionsJustus Winter
Today we can rely on the compiler to inline functions. Undoing this manual optimization is a first step to replace the IPC tables. * ipc/mach_msg.c (mach_msg_trap): Undo the manual inlining of `ipc_entry_lookup', `ipc_entry_dealloc', and `ipc_entry_get'. * ipc/ipc_kmsg.c (ipc_kmsg_copyin_header, ipc_kmsg_copyout_header): Likewise. * kern/exception.c (exception_raise): Likewise. * kern/ipc_mig.c (fast_send_right_lookup): Likewise.
2015-05-20kern: add radix tree libraryJustus Winter
Import a radix tree library from Richard Braun's librbraun. * Makefile.am (clib_routines): Steal `__ffsdi2'. * Makefrag.am (libkernel_a_SOURCES): Add new files. * kern/rdxtree.c: New file. * kern/rdxtree.h: Likewise. * kern/rdxtree_i.h: Likewise. * kern/startup.c (setup_main): Initialize radix tree library.
2015-05-20kern: gracefully handle resource shortageJustus Winter
* kern/thread.c (stack_alloc): Report resource shortage. * kern/sched_prim.h (stack_alloc): Adjust declaration accordingly. * kern/thread_swap.c (thread_doswapin): Report resource shortage. (swapin_thread_continue): If the swap-in fails, put the thread back on the queue and go back to sleep. * kern/thread_swap.h (thread_doswapin): Adjust declaration accordingly.
2015-05-20vm: gracefully handle resource shortageJustus Winter
* vm/vm_object.c (vm_object_copy_call): Gracefully handle resource shortage by doing the allocation earlier and aborting the function if unsuccessful.
2015-05-20kern: gracefully handle resource shortageJustus Winter
* kern/task.c (task_create): Gracefully handle resource shortage.
2015-05-19kern: import `macros.h' from x15Justus Winter
Import the macro definitions from the x15 kernel project, and replace all similar definitions littered all over the place with it. Importing this file will make importing code from the x15 kernel easier. We are already using the red-black tree implementation and the slab allocator from it, and we will import even more code in the near future. * kern/list.h: Do not define `structof', include `macros.h' instead. * kern/rbtree.h: Likewise. * kern/slab.c: Do not define `ARRAY_SIZE', include `macros.h' instead. * i386/grub/misc.h: Likewise. * i386/i386/xen.h: Do not define `barrier', include `macros.h' instead. * kern/macro_help.h: Delete file. Replaced by `macros.h'. * kern/macros.h: New file. * Makefrag.am (libkernel_a_SOURCES): Add new file, remove old file. * device/dev_master.h: Adopt accordingly. * device/io_req.h: Likewise. * device/net_io.h: Likewise. * i386/intel/read_fault.c: Likewise. * ipc/ipc_kmsg.h: Likewise. * ipc/ipc_mqueue.h: Likewise. * ipc/ipc_object.h: Likewise. * ipc/ipc_port.h: Likewise. * ipc/ipc_space.h: Likewise. * ipc/ipc_splay.c: Likewise. * ipc/ipc_splay.h: Likewise. * kern/assert.h: Likewise. * kern/ast.h: Likewise. * kern/pc_sample.h: Likewise. * kern/refcount.h: Likewise. * kern/sched.h: Likewise. * kern/sched_prim.c: Likewise. * kern/timer.c: Likewise. * kern/timer.h: Likewise. * vm/vm_fault.c: Likewise. * vm/vm_map.h: Likewise. * vm/vm_object.h: Likewise. * vm/vm_page.h: Likewise.
2015-05-17i386: avoid compiler warningJustus Winter
* i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys, copy_from_phys): Avoid compiler warning about `map' being used uninitialized.
2015-05-14i386: use macro to compute address of saved registersJustus Winter
* i386/i386/pcb.c (stack_attach): Use `USER_REGS'. (stack_handoff): Likewise.
2015-05-02Fix semaphore failure path special calling conventionSamuel Thibault
* linux/src/include/asm-i386/semaphore.h (down): Pass semaphore address to down_failed through ecx. (down_interruptible): Likewise to down_failed_interruptible. (up): Likewise to up_wakeup.
2015-05-02kern: fix commentJustus Winter
* kern/rbtree.h: Fix comment.
2015-05-02Fix warningSamuel Thibault
* i386/i386at/rtc.c (rtcget, rtcput): Make functions take an rtc_st structure which it casts to char * itself.
2015-05-02Fix warningsSamuel Thibault
* device/ds_routines.c (device_open, ds_open_done, device_close, device_write, device_write_inband, ds_write_done, device_read, device_read_inband, ds_read_done, device_set_status, mach_device_get_status, device_set_filter, device_map, ds_no_senders): Convert from K&R declaration, fix type of `device' into void*.
2015-05-02Fix block_io_mmap prototypeSamuel Thibault
* device/blkio.c (block_io_mmap): Fix prototype of dummy function. * device/blkio.h (block_io_mmap): Likewise.
2015-05-01Use gnu89 inline styleSamuel Thibault
* Makefile.am (AM_CFLAGS): Add -fgnu89-inline option.
2015-05-01Replace clobbers with earlyclobbersSamuel Thibault
Newer gccs consider the former "impossible" * linux/src/include/asm-i386/bitops.h (find_first_zero_bit): Replace clobbers with earlyclobbers. * linux/src/include/asm-i386/semaphore.h (down, down_interruptible, up): Likewise.
2015-04-30Fix build with gcc-5Samuel Thibault
* linux/src/include/linux/compiler-gcc5.h: New file.
2015-04-24kern: avoid hardcoding the lowest priorityJustus Winter
The number of priorities has been changed from 32 to 50 in 6a234201081156e6d5742e7eeabb68418b518fad. * kern/syscall_subr.c (thread_depress_priority): Avoid hardcoding the lowest priority.
2015-04-23kern: disable stack allocation counters by defaultJustus Winter
Disable the stack allocation counters by default. Casual checking revealed that the hits-to-miss ratio is excellent. * kern/thread.c (stack_alloc_{hits,misses,max}): Move variables... * kern/counters.c: ... here, and add the usual counter prefix. * kern/counters.h: New declarations.
2015-04-23Avoid accessing ip_protected_payload without the lock.Samuel Thibault
* ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): Avoid accessing dest->ip_protected_payload without the lock. * ipc/mach_msg.c (ipc/mach_msg.c): Avoid accessing dest_port->ip_protected_payload without the lock.
2015-04-23Prepend 0x to hexadecimal offsetSamuel Thibault
* i386/i386/db_trace.c (db_i386_stack_trace): Prepend 0x to hexadecimal offset.
2015-04-10GNU Mach 1.5.Thomas Schwinge
* version.m4 (AC_PACKAGE_VERSION): Set to 1.5. * NEWS: Finalize for 1.5.
2015-03-19Give the Debian package name for the non-multilib libc.aSamuel Thibault
* Makefile.am (clib-routines.o): Mention the Debian libc6-dev:i386 package.
2015-03-08Remove spl debugging in Xen caseSamuel Thibault
xen cli/sti doesn't use IF * i386/i386/spl.S [MACH_XEN]: Disable IF check.
2015-03-05Show odd number of portsSamuel Thibault
* linux/dev/drivers/block/ahci.c (ahci_probe_dev): Show odd number of ports.
2015-02-26Use printf_once instead of recoding itSamuel Thibault
* i386/i386at/kd_event.c: Call printf_once instead of recoding it. * i386/i386at/kd_mouse.c: Likewise.
2015-02-26Limit printing "queue full" messagesSamuel Thibault
* i386/i386at/kd_event.c (kbd_enqueue): Print "queue full" warning only once. * i386/i386at/kd_mouse.c (mouse_enqueue): Likewise.
2015-02-25kern: inherit the name of the parent taskJustus Winter
* kern/task.c (task_create): Inherit the name of the parent task.
2015-02-20i386: specialize `copyinmsg' and `copyoutmsg'Justus Winter
Previously, `copyinmsg' was the same function as `copyin'. The former is for messages, and the size of messages is a multiple of four. Likewise for `copyoutmsg'. Provide a specialized version of both functions. This shaves off a couple of instructions and improves our IPC performance. * i386/i386/locore.S (copyinmsg): New function. (copyoutmsg): New function.
2015-02-20i386: drop needless instruction from `copyout'Justus Winter
* i386/i386/locore.S (copyout): Do not needlessly copy length to %eax first.
2015-02-20kern: improve assertJustus Winter
Use the ternary operator to implement `assert' like it is done in the glibc. The glibcs changelog does not mention the rationale behind this change, but doing the same seems to improve our IPC performance. * kern/assert.h (assert): Define macro using the ternary operator.
2015-02-20linux: fix compiler warningJustus Winter
If the loop above completes at least one iteration, `i' will be larger than zero. * linux/dev/glue/block.c (rdwr_full): Add assertion to appease the compiler.
2015-02-20kern: reduce the size of `struct thread'Justus Winter
Reduce the size of `struct thread' by twelve bytes making it fit into exactly five cache lines (on 32-bit platforms). * kern/thread.h (struct thread): Group the state and all flags in a bitfield. (TH_EV_WAKE_ACTIVE, TH_EV_STATE): Provide macros that generate keys for synchronization primitives like `thread_wakeup'. * kern/thread.c (thread_halt, thread_dowait, thread_suspend): Use the new keys instead of addresses of fields for the synchronisation. * kern/ipc_sched.c (thread_handoff): Likewise. * kern/sched_prim.c (thread_invoke, thread_dispatch): Likewise.
2015-02-18kern: avoid #if 0ing out thread_collect_scanJustus Winter
Currently, `thread_collect_scan' does nothing because `pcb_collect' is a nop. Its body is exempt from compilation by means of the preprocessor. This is unfortunate as it increases the risk of bitrot, and we still need to pay the price of rate-limiting thread_collect_scan. * kern/thread.c (thread_collect_scan): Drop #if 0 around the body. * vm/vm_pageout.c (vm_pageout_scan): Do not call `consider_thread_collect' and document why.
2015-02-18vm: fix typoJustus Winter
* vm/vm_resident.c: Fix typo.
2015-01-22ipc: warn about more port management bugsJustus Winter
* ipc/mach_port.c (mach_port_destroy): Simplify expression. Reword warning. (mach_port_deallocate): Likewise. (mach_port_mod_refs): Also warn about errors when using this function.
2015-01-02vm: Fix typo in comment (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02kern: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02ipc: Fix typo in comment (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02include: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02i386: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02device: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02Makefile.am: Fix typos and grammar in commentStefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02ddb: Fix typos in comments (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-01-02Handle kernel traps happening before starting userlandSamuel Thibault
* i386/i386/trap.c (kernel_trap): When current_thread is null, assume that we are in kernel land.
2014-12-16kern: gracefully handle bogus sample pc sequence numberJustus Winter
If a sequence number larger than the sample control sequence number is supplied, `nsamples' becomes negative. Handle this gracefully. * kern/pc_sample.c (get_sampled_pcs): Handle bogus sequence number.
2014-12-16ipc: guard test code with `MACH_IPC_TEST'Justus Winter
* ipc/ipc_kmsg.h (ikm_mark_bogus): New macro. (ipc_kmsg_rmqueue_first_macro): Use `ikm_mark_bogus'. * ipc/ipc_kmsg.c (ipc_kmsg_rmqueue): Likewise.