Age | Commit message (Collapse) | Author |
|
This fixes a corruption in the radix trees representing the IPC spaces
when memory was tight.
* ipc/ipc_space.h: Use a general lock to protect IPC spaces.
|
|
* ipc/ipc_entry.c (ipc_entry_alloc): Assume the space is write-locked.
(ipc_entry_alloc_name): Likewise.
* ipc/ipc_object.c: Fix the locking around all call sites to the two
functions where the space was not locked before.
|
|
* ipc/ipc_table.c (ipc_table_alloc): Unconditionally use `kalloc'.
(ipc_table_free): Unconditionally use `kfree'.
|
|
* ipc/ipc_port.c (ipc_port_alloc_special): Use ip_alloc and ip_lock_init
macros instead of manually inlining them.
|
|
* ipc/notify.defs: Fix typo.
|
|
* Makefrag.am (gnumach.msgids): Add `notify.msgids' as prerequisite.
* Makerules.mig.am: Add rule to generate the list of message ids when
neither the client nor the server stubs are required.
* ipc/notify.defs: New file.
|
|
* ipc/ipc_table.c (ipc_table_entries): Remove.
(ipc_table_entries_size): Likewise.
(ipc_table_init): Remove initialization of `ipc_table_entries'.
(ipc_table_realloc): Remove function.
* ipc/ipc_table.h: Adjust comments.
(ipc_table_entries): Remove declaration.
(ipc_table_realloc): Likewise.
(it_entries_{alloc,reallocable,realloc,free}): Remove macros.
|
|
* 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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
* 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.
|
|
* 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.
|
|
Signed-off-by: Stefan Weil <sw@weilnetz.de>
|
|
* 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.
|
|
The previous limit was 256 bytes. That seems a little crummy by
todays standards, and we are frequently sending bigger packets
(e.g. every RPC containing a string_t on Hurd).
Use the page size for IKM_SAVED_KMSG_SIZE to make sure the page is
pinned to a single processor.
* ipc/ipc_kmsg.h (IKM_SAVED_KMSG_SIZE): Define to `PAGE_SIZE'.
|
|
Retire the compatibility RPC `old_mach_port_get_receive_status' that
works like `mach_port_get_receive_status' but returns an
`old_mach_port_status' object that lacks the `mps_seqno' field.
Do not remove the type yet, so we do not break anyones build. The RPC
stubs currently distributed with the glibc require it.
* include/mach/mach_port.defs (old_mach_port_get_receive_status): Drop RPC.
* include/mach/mach_types.defs (old_mach_port_status_t): Drop type.
* include/mach/port.h (old_mach_port_status_t): Add note to remove
this for the 1.6 release.
* ipc/mach_port.c (old_mach_port_get_receive_status): Drop function.
|
|
* ipc/ipc_port.h (ipc_port_flag_protected_payload,
ipc_port_flag_protected_payload_set,
ipc_port_flag_protected_payload_clear): Use static inline qualifier instead
of extern inline.
|
|
* ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): If a protected payload is
set for the destination port, provide it in msgh_protected_payload.
* ipc/mach_msg.c (mach_msg_trap): Likewise in the fast paths.
* doc/mach.texi (Message Receive): Document message semantics with
protected payloads.
|
|
* include/mach/mach_port.defs: Add mach_port_{set,clear}_protected_payload.
* ipc/mach_port.c: Implement mach_port_{set,clear}_protected_payload.
* doc/mach.texi (Receive Rights): Document
mach_port_{set,clear}_protected_payload.
|
|
Add a field ip_protected_payload and a flag ip_has_protected_payload
to struct ipc_port.
Clear the protected payload when a receive port is moved from one ipc
space to another. This is done to retain the old behavior of
mach_msg, so that a port name is sent in the msgh_local_port field.
If the new owner of that receive right wishes to use the protected
payload mechanism, it has to be explicitly set again.
* ipc/ipc_port.h (struct ipc_port): Add field ip_protected_payload.
(ipc_port_set_protected_payload): Add function declaration.
(ipc_port_clear_protected_payload): Likewise.
(ipc_port_flag_protected_payload): Add accessor for the protected
payload flag.
(ipc_port_flag_protected_payload_set): Likewise.
(ipc_port_flag_protected_payload_clear): Likewise.
* ipc/ipc_port.c (ipc_port_init): Initialize protected payload.
(ipc_port_print): Print protected_payload.
(ipc_port_set_protected_payload): New function.
(ipc_port_clear_protected_payload): Likewise.
(ipc_port_destroy): Clear the payload when moving a receive port.
* ipc/ipc_right.c (ipc_right_copyin): Likewise.
(ipc_right_copyout): Likewise.
* ipc/ipc_object.c (ipc_object_copyin_from_kernel): Likewise.
* ipc/ipc_object.h (IO_BITS_PROTECTED_PAYLOAD): New bitmask.
(IO_BITS_OTYPE): Adjust accordingly.
|
|
* ipc/ipc_table.h: Document that table sizes must be powers of two.
* ipc/ipc_hash.c (IH_LOCAL_HASH): Use fast modulo operation.
|
|
Convert from K&R style function definitions to ANSI style
function definitions.
* ddb/db_access.c: Convert function prototypes from K&R to ANSI.
* ddb/db_aout.c: Likewise.
* ddb/db_break.c: Likewise.
* ddb/db_command.c: Likewise.
* ddb/db_cond.c: Likewise.
* ddb/db_examine.c: Likewise.
* ddb/db_expr.c: Likewise.
* ddb/db_ext_symtab.c: Likewise.
* ddb/db_input.c: Likewise.
* ddb/db_lex.c: Likewise.
* ddb/db_macro.c: Likewise.
* ddb/db_mp.c: Likewise.
* ddb/db_output.c: Likewise.
* ddb/db_print.c: Likewise.
* ddb/db_run.c: Likewise.
* ddb/db_sym.c: Likewise.
* ddb/db_task_thread.c: Likewise.
* ddb/db_trap.c: Likewise.
* ddb/db_variables.c: Likewise.
* ddb/db_watch.c: Likewise.
* device/blkio.c: Likewise.
* device/chario.c: Likewise.
* device/dev_lookup.c: Likewise.
* device/dev_name.c: Likewise.
* device/dev_pager.c: Likewise.
* device/ds_routines.c: Likewise.
* device/net_io.c: Likewise.
* device/subrs.c: Likewise.
* i386/i386/db_interface.c: Likewise.
* i386/i386/fpu.c: Likewise.
* i386/i386/io_map.c: Likewise.
* i386/i386/loose_ends.c: Likewise.
* i386/i386/mp_desc.c: Likewise.
* i386/i386/pcb.c: Likewise.
* i386/i386/phys.c: Likewise.
* i386/i386/trap.c: Likewise.
* i386/i386/user_ldt.c: Likewise.
* i386/i386at/com.c: Likewise.
* i386/i386at/kd.c: Likewise.
* i386/i386at/kd_event.c: Likewise.
* i386/i386at/kd_mouse.c: Likewise.
* i386/i386at/kd_queue.c: Likewise.
* i386/i386at/lpr.c: Likewise.
* i386/i386at/model_dep.c: Likewise.
* i386/i386at/rtc.c: Likewise.
* i386/intel/pmap.c: Likewise.
* i386/intel/read_fault.c: Likewise.
* ipc/ipc_entry.c: Likewise.
* ipc/ipc_hash.c: Likewise.
* ipc/ipc_kmsg.c: Likewise.
* ipc/ipc_marequest.c: Likewise.
* ipc/ipc_mqueue.c: Likewise.
* ipc/ipc_notify.c: Likewise.
* ipc/ipc_port.c: Likewise.
* ipc/ipc_right.c: Likewise.
* ipc/mach_debug.c: Likewise.
* ipc/mach_msg.c: Likewise.
* ipc/mach_port.c: Likewise.
* ipc/mach_rpc.c: Likewise.
* kern/act.c: Likewise.
* kern/exception.c: Likewise.
* kern/ipc_mig.c: Likewise.
* kern/ipc_tt.c: Likewise.
* kern/lock_mon.c: Likewise.
* kern/mach_clock.c: Likewise.
* kern/machine.c: Likewise.
* kern/printf.c: Likewise.
* kern/priority.c: Likewise.
* kern/startup.c: Likewise.
* kern/syscall_emulation.c: Likewise.
* kern/syscall_subr.c: Likewise.
* kern/thread_swap.c: Likewise.
* kern/time_stamp.c: Likewise.
* kern/timer.c: Likewise.
* kern/xpr.c: Likewise.
* vm/memory_object.c: Likewise.
* vm/vm_debug.c: Likewise.
* vm/vm_external.c: Likewise.
* vm/vm_fault.c: Likewise.
* vm/vm_kern.c: Likewise.
* vm/vm_map.c: Likewise.
* vm/vm_pageout.c: Likewise.
* vm/vm_user.c: Likewise.
|
|
* ipc/mach_port.c (mach_port_destroy): Use the name of the task for
error messages.
(mach_port_deallocate): Likewise.
|
|
|
|
* i386/i386/ast_check.c (init_ast_check, cause_ast_check): Define return type.
* i386/i386/pic.c (intnull, prtnull): Define argument types.
* i386/i386at/com.c (compr_addr): Likewise.
(compr): Likewise.
(compr_addr): Fix printf format.
* i386/i386at/kd.c (kd_cmdreg_write, kd_kbd_magic): Define argument types.
* i386/i386at/kd_mouse.c (init_mouse_hw): Likewise.
* ipc/mach_port.c (sact_count): Define return type.
* ipc/mach_rpc.c (mach_port_rpc_sig): Define argument types.
* kern/act.c (dump_act): Define return type.
* kern/lock_mon.c (simple_lock, simple_lock_try, simple_unlock, lip, lock_info_sort, lock_info_clear, print_lock_info): Define return type.
(time_lock): Define return type and argument type.
* kern/timer.c (time_trap_uexit): Define argument type.
|
|
|
|
Member ip_kobject is of type vm_offset_t.
* ipc/mach_debug.c (mach_port_kernel_object) (ip_kobject): Remove unnecessary cast.
|
|
Return value from ip_kotype is an unsigned int.
* ipc/mach_debug.c (mach_port_kernel_object) (ip_kotype): Remove unnecessary cast.
|
|
Addresses were cast to (void *). Pointers uncasted.
* device/ds_routines.c (ds_read_done) (memset) (start_sent): Cast to (void *) instead to (char *). Argument is an address.
(ds_read_done) (memset) (end_data): Likewise.
* i386/i386/pcb.c (thread_getstatus) (memcpy) (pm): Don't cast. Argument is a pointer.
(thread_getstatus) (memcpy) (iopb): Likewise.
* i386/i386at/immc.c (immc_cnputc) (memmove): Cast first argument to (void *). Argument is an address.
(immc_cnputc) (memmove): Cast second argument to (void *). Argument is an address.
(immc_cnputc) (memset): Cast first argument to (void *). Argument is an address.
* i386/i386at/model_dep.c (i386at_init) (memcpy) (phystokv): Cast to (void *) instead to (char *). Argument is an address.
* i386/intel/pmap.c (pmap_init) (memset) (addr): Likewise.
* ipc/mach_debug.c (mach_port_space_info) (memset) (table_addr + size_used): Likewise.
(mach_port_space_info) (memset) (tree_addr + size_used): Likewise.
* kern/host.c (host_processor_sets) (memcpy) (newaddr): Likewise.
(host_processor_sets) (memcpy) (addr): Likewise.
* kern/xpr.c (xprbootstrap) (memset) (addr): Likewise.
* vm/vm_debug.c (mach_vm_object_pages) (memset) (addr + size_used): Likewise.
|
|
This is ipc/port.h. Not ipc/ipc_port.h.
* ipc/port.h: Update comment.
|
|
* ipc/mach_port.c (mach_port_deallocate_debug): Use boolean instead of an int.
|
|
* ipc/ipc_init.c (ipc_kernel_map_size): Qualify constant with const.
|
|
* ipc/ipc_port.c (indent): Trivial stylistic fix for consistency.
|
|
* device/cons.c [MACH_KMSG]: Likewise.
[CONSBUFSIZE > 0]: Likewise.
* i386/i386/trap.c [MACH_KDB]: Likewise.
[MACH_PV_PAGETABLES]: Likewise.
* i386/i386at/kd.c [ENABLE_IMMEDIATE_CONSOLE]: Likewise.
* ipc/ipc_kmsg_queue.h [_IPC_KMSG_QUEUE_H_]: Likewise.
* kern/act.c [ACTWATCH]: Likewise.
* kern/refcount.h [MACHINE_REFCOUNT]: Likewise.
* kern/task.c [FAST_TAS]: Likewise.
|
|
* ipc/mach_port.c (mach_port_get_receive_status): Remove forward declaration.
* ipc/mach_port.h (mach_port_get_receive_status): Add prototype.
|
|
* ipc/ipc_entry.c (db_ipc_object_by_name): Remove forward declaration.
* ipc/ipc_entry.h (db_ipc_object_by_name): Add prototype.
|
|
Struct ipc_kmsg_queue is not defined in kern/thread.h.
* ipc/ipc_kmsg.h: Update comment.
|
|
* ipc/ipc_mqueue.h: Include ipc/ipc_kmsg_queue.h.
* kern/ipc_kobject.h: Move includes into ifndef.
* kern/syscall_emulation.h: Include kern/task.h.
(eml_init, eml_task_reference, eml_task_deallocate): Add prototypes.
* kern/task.c: Include kern/syscall_emulation.h.
(eml_init, eml_task_reference, eml_task_deallocate): Remove forward declarations
|
|
* ipc/mach_msg.c: Include kern/exception.h.
(exception_raise_continue, exception_raise_continue_fast): Remove forward declarations.
* kern/exception.h: Include ipc/ipc_types.h.
Include ipc/ipc_kmsg.h.
|
|
* ipc/ipc_table.c (ipc_table_fill): Remove forward declaration.
* ipc/ipc_table.h (ipc_table_fill): Add prototype.
|
|
* ipc/ipc_kmsg.c (copyinmap, copyoutmap, ipc_msg_print): Remove forward declarations.
* ipc/ipc_kmsg.h (ipc_msg_print): Add prototype.
|
|
* ipc/mach_port.h (mach_port_destroy): Add prototype.
|
|
* ipc/ipc_print.h: Include ipc/ipc_pset.h for ipc_pset_t.
|
|
* ddb/db_write_cmd.h: Add copyright.
* ipc/ipc_print.h: Likewise.
* vm/vm_print.h: Likewise.
|
|
Finish up with the addition of ifndefs.
* device/buf.h: Add ifndef.
* device/dev_master.h: Likewise.
* include/device/tty_status.h: Likewise.
* include/mach/version.h: Likewise.
* ipc/ipc_machdep.h: Likewise.
|
|
* ipc/ipc_thread.h: Remove register qualifiers.
|
|
* ipc/mach_msg.c: Remove register qualifiers.
|