Age | Commit message (Collapse) | Author |
|
* configfrag.ac (MACH_LDEBUG): Adjust comment, we use it to sanity
check all locks now.
* kern/lock.c (lock_write): Keep track of the writer thread.
(lock_done): Clear writer.
(lock_read_to_write): Keep track of the writer thread.
(lock_write_to_read): Assert that the current thread holds the lock.
Clear writer.
(lock_try_write): Keep track of the writer thread.
(lock_try_read_to_write): Likewise.
(lock_set_recursive): Assert that the current thread holds the lock.
* kern/lock.h (struct lock): New field `writer'.
(have_read_lock, have_write_lock, have_lock): New macros that can be
used to assert that the current thread holds the given lock. If
MACH_LDEBUG is not set, they evaluate to true.
|
|
Do not bother saving the return address when acquire a simple lock.
Save the location as provided by the compiler as string instead. Also
save the lock parameter.
* kern/lock.c (struct simple_locks_info): Drop `ra', add `expr', `loc'.
(simple_lock): Rename to `_simple_lock', add expression and location
parameters and save them.
(simple_lock_try): Likewise.
(simple_unlock): Zero-out the now unused slot in the list of taken locks.
(db_show_all_slocks): Use the new information.
* kern/lock.h (simple_lock, simple_lock_try): Provide macro versions
passing the location and expression as string.
|
|
* kern/lock.c (do_check_simple_locks): New variable.
(check_simple_locks): Make check conditional.
(check_simple_locks_{en,dis}able): New functions.
* kern/lock.h (check_simple_locks_{en,dis}able): New declarations.
* ddb/db_trap.c (db_task_trap): Disable simple lock checks.
|
|
* kern/macros.h: Avoid re-defining macros.
* linux/src/include/linux/compiler-gcc.h: Likewise.
* linux/src/include/linux/compiler.h: Likewise.
|
|
The kernel keeps track of task and thread creation times by saving a
time stamp. Previously, the real-time clock was used for this. When
the real-time clock is changed, however, the reference frame for the
time stamps is lost. This surfaced in Hurd systems reporting
spuriously long uptimes.
Fix this by creating a boot-time clock and use it as reference frame
for the time stamps.
* kern/mach_clock.c (clock_boottime_offset): Create clock by keeping
track of the offset from the real-time.
(clock_boottime_update): New function.
(record_time_stamp): Use the boot-time clock for time stamps.
(read_time_stamp): New function to convert it back to real-time.
(host_set_time): Call `clock_boottime_update'.
* kern/mach_clock.h (record_time_stamp): Amend comment.
(read_time_stamp): New declaration.
* kern/task.c (task_info): Use `read_time_stamp'.
* kern/thread.c (thread_info): Likewise.
|
|
* kern/lock.h (struct slock, simple_lock_data_empty): Add field
`is_a_simple_lock'.
(simple_lock_assert): New macro that tests for `is_a_simple_lock'.
Use this macro to assert that the arguments to various other macros
are indeed simple locks.
|
|
Previously, killing the thread would fail because of the extra
reference, making task_terminate loop forever.
* kern/bootstrap.c (boot_script_exec_command): Deallocate thread.
|
|
* kern/bootstrap.c (boot_script_free_task): Deallocate task.
|
|
A lot of code assumes that printf is re-entrant, e.g. the pagination
code in the debugger, or any use of assert inside the console driver.
* kern/printf.c: Drop the lock serializing calls to `_doprnt'.
(printf_init): Remove function.
* kern/printf.h (printf_init): Remove declaration.
* kern/startup.c (setup_main): Remove call to `printf_init'.
|
|
* kern/lock.c (struct simple_locks_info): Fix type of `ra'.
(simple_lock, simple_lock_try): Use compiler built-in functions to get
return address.
|
|
* kern/bootstrap.c (boot_script_exec_cmd): Add missing unlock.
(user_bootstrap): Likewise.
|
|
* kern/slab.c (host_slab_info): Fix locking.
|
|
This turns mistakes as the one corrected in e59f05e9 into compile-time
errors.
* kern/queue.h: Add a new macro, queue_assert, and use it to assert
that all arguments given to the queue macros have the correct type.
* device/net_io.c (ENQUEUE_DEAD): Adapt to the fact that
`queue_next(q)' is no longer an lvalue.
|
|
* Makefile.am (clib_routines): Steal `__umoddi3'.
* kern/printf.c (MAXBUF): Increase size.
(printnum, _doprnt): Handle long long integers.
* kern/printf.h (printnum): Adjust declaration.
|
|
* kern/server_loop.ch: Remove superfluous file.
|
|
* kern/bootstrap.c (boot_script_exec_cmd): Improve error handling.
|
|
This avoids calling `thread_deallocate' with an uninitialized value,
as found by the Clang Static Analyzer.
* kern/thread.c (kernel_thread): Fix error handling.
|
|
* kern/printf.h (sprintf, snprintf, vsnprintf, printf): Add the
`printf' function attribute that allows the compiler to check the
format strings and arguments.
|
|
Previously, the processor argument was not checked. If called with a
non-processor argument (like a task), `processor' is set to NULL,
triggering a page fault. Likewise for the other functions.
* kern/processor.c (processor_get_assignment): Fix argument handling.
* kern/task.c (task_get_assignment): Likewise.
* kern/thread.c (thread_get_assignment): Likewise.
|
|
* kern/exception.c (exception_parse_reply): Use `BAD_TYPECHECK'.
|
|
* 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.
|
|
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 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.
|
|
* 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.
|
|
* kern/task.c (task_create): Gracefully handle resource shortage.
|
|
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.
|
|
* kern/rbtree.h: Fix comment.
|
|
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.
|
|
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.
|
|
* kern/task.c (task_create): Inherit the name of the parent task.
|
|
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.
|
|
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.
|
|
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.
|
|
Signed-off-by: Stefan Weil <sw@weilnetz.de>
|
|
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.
|
|
These notifications are sent to the port registered via
`register_new_task_notification' and provide a robust parental
relation between tasks to a userspace server.
* Makefrag.am: Add task_notify.defs.
* include/mach/gnumach.defs: Add register_new_task_notification.
* include/mach/task_notify.defs: New file.
* kern/task.c (new_task_notification): New variable.
(task_create): Send new task notifications.
(register_new_task_notification): Add server function.
* kern/task_notify.cli: New file.
|
|
This was due to task_terminate not actually properly suspending threads
before disable the task port, which was thus preventing pthread_create
from being able to create a stack. Thanks Gabriele Giacone for finding
out a reproducer of this.
* kern/task.h (task_hold_locked): New declaration.
* kern/task.c (task_hold): Move the locked part of the code into...
(task_hold_locked): ... new function.
(task_terminate): Call task_hold_locked just before deactivating the
task. Call ipc_task_disable after waiting for threads to actually
suspend with task_dowait.
|
|
Make all five non-conditional counters conditional ones. Casual
checking revealed that the hits-to-miss ratio is excellent.
* kern/counters.c: Make all counters conditional.
* kern/counters.h: Likewise.
* kern/ipc_sched.c: Likewise.
* kern/sched_prim.c: Likewise.
|
|
* kern/slab.c (kmem_cache_compute_sizes): Initialize optimal_size and
assert that a size is selected.
|
|
* kern/sched_prim.c (recompute_priorities): Fix type.
* kern/sched_prim.h (recompute_priorities): Likewise.
|
|
Previously, it was impossible to hand e.g. the master device port to
more than one bootstrap task. Fix this by creating the send right as
it is inserted into the target task.
* kern/bootstrap.c (bootstrap_create): Do not create the send rights
here...
(boot_script_insert_right): ... but here.
|
|
* kern/taks.c (task_init): Set the name of the kernel task to 'gnumach'.
|
|
* i386/include/mach/i386/cthreads.h: Rewrite old-style #endif FOO
directives.
* include/device/tape_status.h: Likewise.
* include/mach/alert.h: Likewise.
* include/mach/boot.h: Likewise.
* include/mach/default_pager_types.defs: Likewise.
* include/mach/default_pager_types.h: Likewise.
* include/mach/multiboot.h: Likewise.
* include/mach/notify.defs: Likewise.
* include/mach_debug/pc_info.h: Likewise.
* kern/act.h: Likewise.
* kern/refcount.h: Likewise.
* kern/shuttle.h: Likewise.
|
|
GNU MIG recently gained support for emitting x_server_routine
declarations in the generated server header file. Using this
declaration, the x_server_routine functions can be inlined into the
ipc_kobject_server function.
* kern/ipc_kobject.c: Include the MIG-generated server headers for the
machine-dependent interfaces.
(ipc_kobject_server): Drop the simple declaration of
MACHINE_SERVER_ROUTINE.
* i386/i386/machine_routines.h (MACHINE_SERVER_HEADER): New
definition.
|
|
* kern/bootstrap.c (boot_script_task_create): Set the name of newly
created tasks.
|
|
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.
|
|
* device/conf.h: Include <sys/types.h>, <mach/port.h>, <mach/vm_prot.h>.
Predefine struct io_req, io_req_t and io_return_t.
(dev_ops): Add explicit prototypes for d_open, d_close, d_read, d_write,
d_getstat, d_setstat, d_mmap, d_port_death.
(nulldev_open, nulldev_close, nulldev_read, nulldev_write,
nulldev_getstat, nulldev_setstat, nulldev_portdeath): Add prototypes.
(nomap): Fix prototype.
* device/dev_name.c (nulldev_open, nulldev_close, nulldev_read,
nulldev_write, nulldev_getstat, nulldev_setstat, nulldev_portdeath): New
functions.
(nomap): Fix prototype.
* device/ds_routines.c (dev_close): Pass 0 as flag parameter.
* device/kmsg.c (kmsgclose): Drop return value.
* device/kmsg.h (kmsgclose): Fix prototype.
* i386/i386at/com.c (comopen): Fix prototype.
(comclose): Fix prototype, drop return value.
(comread, comwrite): Fix prototype.
* i386/i386at/com.h (comopen, comclose, comread, comwrite): Fix
prototype.
* i386/i386at/conf.c (dev_ops): Use nulldev_open, nulldev_close,
nulldev_read, nulldev_write, nulldev_getstat, nulldev_setstat,
nulldev_portdeath where appropriate.
* i386/i386at/kd.c (kdclose, kdread, kdwrite, kdmmap): Fix prototype.
* i386/i386at/kd.h (kdclose, kdread, kdwrite, kdmmap): Likewise.
* i386/i386at/kd_event.c (kbdopen): Likewise.
* i386/i386at/kd_event.h (kbdopen): Likewise.
* i386/i386at/kd_mouse.c (mouseopen): Likewise.
* i386/i386at/kd_mouse.h (mouseopen): Likewise.
* i386/i386at/lpr.c (lpropen, lprclose, lprread, lprwrite): Likewise.
* i386/i386at/lpr.h (lpropen, lprclose, lprread, lprwrite): Likewise.
* i386/i386at/mem.c (memmmap): Likewise.
* i386/i386at/mem.h (memmmap): Likewise.
* i386/i386at/model_dep.c (timemmap): Likewise.
* i386/i386at/model_dep.h (timemmap): Likewise.
* kern/mach_clock.c (timeopen, timeclose): Likewise.
* kern/mach_clock.h: Include <sys/types.h>, predefine struct io_req and
io_req_t.
(timeopen, timeclose): Fix prototype.
|
|
Previously, bootstrap_create would print the multiboot modules with
padding applied to the end of the line. As multiboot modules as used
by the Hurd span more than one line. This makes the list of modules
hard to read and it looks unclean, more like an accident.
Furthermore, it is not clear what the intend of this was, as the
padding is applied at the end of the line, with no further information
printed thereafter.
* kern/bootstrap.c (bootstrap_create): Remove variable maxlen and len,
update printfs.
|
|
Previously, the function mig_strncpy would always zero-terminate the
destination string. Make mig_strncpy behave like mig_strncpy and
strncpy in the glibc. Also fix the implementation of mig_strncpy to
return the length of the written string to align the implementation
with the declaration in include/mach/mig_support.h.
* kern/ipc_mig.c (mig_strncpy): Do not zero-terminate the destination
string. Return length of destination string.
|
|
* kern/slab.c (KMEM_MAP_SIZE): Decrease from 128MiB to 96MiB.
|