Age | Commit message (Collapse) | Author |
|
|
|
|
|
* linux/dev/glue/kmem.c (linux_kmem_init): Drop sanity check.
* linux/dev/init/main.c (alloc_contig_mem, free_contig_mem):
Use the buddy allocator.
|
|
|
|
The main impact of the direct physical mapping on the kmem module is the
slab size computation. The page allocator requires the allocation size
to be a power-of-two above the page size since it uses the buddy memory
allocation algorithm.
Custom slab allocation functions are no longer needed since the only
user was the kentry area, which has been removed recently.
The KMEM_CACHE_NOCPUPOOL flag is also no longer needed since CPU pools,
which are allocated from a kmem cache, can now always be allocated out
of the direct physical mapping.
|
|
|
|
As it's done for other modules, this separation makes the public interface
easy to identify.
|
|
Instead of using a red-black tree, rely on the VM system to store kmem
specific private data.
|
|
Don't encourage anyone to use non reclaimable pools of resources, it's
a Bad Thing To Do.
|
|
|
|
* kern/counters.c: Remove relevant counters.
* kern/counters.h: Likewise.
* kern/thread.c (stack_free_{list,count,limit}): Drop variables.
(stack_next): Remove macro.
(stack_alloc_try): Allocate stack using the slab allocator.
(stack_alloc): Merely call `stack_alloc_try'.
(stack_free): Adopt accordingly.
|
|
* kern/slab.c (kmem_cache_init): Relax alignment restriction.
* kern/thread.c (stack_cache): New variable.
(stack_alloc): Use the slab allocator.
(stack_collect): Adjust accordingly.
(thread_init): Initialize `stack_cache'.
|
|
|
|
Conflicts:
vm/vm_page.h
|
|
During the message transport, the sender acquires a lock that is
released by the sender. By making this explicit, we can provide
stronger guarantees about the locking.
* ipc/ipc_mqueue.c (ipc_mqueue_receive): Steal lock.
* ipc/ipc_object.h (io_lock_steal): New macro.
* ipc/ipc_port.h (ip_lock_steal): Likewise.
* ipc/mach_msg.c (mach_msg_trap): Steal lock in the inlined version of
`ipc_mqueue_receive'.
* kern/lock.c (lock_done): Assert that the current thread holds the lock.
* kern/lock.h (lock_write_steal): New macro.
|
|
* ipc/ipc_mqueue.h (struct ipc_mqueue): Use a general lock. Adapt macros.
|
|
* ipc/ipc_port.c (ipc_port_multiple_lock_data): Use a general lock.
* ipc/ipc_port.h (ipc_port_multiple_lock_data): Likewise.
(ipc_port_multiple_{lock_init,lock,unlock}): Adapt accordingly.
|
|
|
|
* ipc/ipc_thread.h (ith_{lock_init,lock,unlock}): Use a general lock.
* kern/task.h (struct task): Use a general lock for `itk_lock_data'.
(itk_{lock_init,lock,unlock}): Use a general lock.
* kern/thread.h (struct thread): Use a general lock for `ith_lock_data'.
|
|
* vm/vm_object.h (struct vm_object): Use a general lock, adapt macros.
|
|
* kern/lock.h (lock_taken): New macro.
|
|
* vm/vm_object.c: Use a general lock to protect the object cache.
|
|
* vm/memory_object.c: Use a general lock to protect the default memory
manager.
|
|
* device/if_hdr.h (struct ifnet): Turn the port list locks into
general locks.
(port_list_{lock_init,lock,unlock): New macros.
* device/net_io.c (net_filter, net_set_filter): Use new macros.
* device/subrs.c (if_init_queues): Likewise.
|
|
* device/dev_hdr.h (struct mach_device): Turn lock into a general lock.
(device_lock_init): New macro.
(device_lock, device_unlock): Adapt accordingly.
* device/dev_lookup.c (device_lookup): Use `device_lock_init'.
* device/ds_routines.c (device_open): Adapt accordingly.
|
|
|
|
|
|
* kern/sched_prim.c (thread_sleep_lock): New function.
* kern/sched_prim.h (thread_sleep_lock): New delcaration.
|
|
* ipc/ipc_port.h (struct ipc_port): Document locking exception.
* ipc/ipc_port.c (ipc_port_destroy): Avoid accessing `port's fields
without the lock.
(ipc_port_alloc_special): Lock `port'.
* ipc/mach_msg.c (mach_msg_trap): Avoid using
`ipc_port_flag_protected_payload' on unlocked port.
* ipc/ipc_kmsg.c (ipc_kmsg_copyout_header): Likewise.
|
|
Avoid accessing fields of `vm_object' objects without having it
locked. These problems have been found using a code transformation
done by Coccinelle that instrumented all accesses with a runtime
check, and manual inspection.
* vm/memory_object.c (memory_object_data_supply): Avoid accessing
fields without the lock.
* vm/vm_fault.c (vm_fault_page): Likewise.
* vm/vm_map.c (vm_map_submap): Properly lock `object'.
(vm_map_copy_overwrite): Avoid accessing fields without the lock.
(vm_map_copyin): Lock `src_object'.
* vm/vm_object.c (_vm_object_setup): Likewise.
(vm_object_allocate): Likewise.
(vm_object_terminate): Avoid accessing fields without the lock.
(vm_object_copy_slowly): Lock `new_object'.
(vm_object_copy_delayed): Lock `src_object' earlier, lock `new_copy'.
(vm_object_shadow): Lock `result'.
(vm_object_enter): Properly lock `object'. Avoid accessing fields
without the lock.
* vm/vm_pageout.c (vm_pageout_setup): Properly lock `old_object'.
|
|
* include/mach/time_value.h (struct mapped_time_value): Adjust comment.
* kern/mach_clock.c (mtime): Likewise. Also make it volatile.
(update_mapped_time): Use full hardware barriers.
(read_mapped_time): New macro with proper fences.
(record_time_stamp, host_get_time): Use the new macro.
|
|
Previously, recent versions of gcc would hoist the loads out of the
loop reading the time value.
* kern/macros.h (access_once): New macro.
* kern/mach_clock.c (host_get_time): Use the new macro to prevent the
loads from being hoisted out of the loop.
|
|
[PATCH] advansys.c buffer overflow
The Stanford checker found an error in advansys.c, the driver
is accessing field 6 in an array[6]. Since this is the only
place where this field is accessed it should be safe to simply
remove this line.
|
|
Linux does this to be extra careful with some BIOSes which apparently
spuriously write between 4k and 64k.
* i386/i386at/model_dep.c (RESERVED_BIOS): New macro.
(avail_next, mem_size_init, init_alloc_aligned): Use RESERVED_BIOS instead
of hardcoded 0x1000.
|
|
* i386/i386at/kd.c (kdstart): Moved escape sequence handling to new
kd_putc_esc function.
(kd_putc_esc): New function with logic from kdstart.
(kdcnputc): Call kd_putc_esc rather than kd_putc to allow for ANSI
escape codes.
* i386/i386at/kd.h (kd_putc_esc): New function.
|
|
halted.
* kern/thread.h (thread_halt_self): Add continuation_t parameter.
* kern/thread.c (thread_halt_self): Pass continuation_t parameter to
thread_block instead of thread_exception_return.
* kern/ast.c (ast_taken): Pass thread_exception_return to thread_halt_self.
* kern/profile.c (profile_thread): Likewise.
* kern/exception.c (exception_no_server): Likewise.
(thread_release_and_exception_return): New function.
(exception_raise_continue_slow): Pass thread_release_and_exception_return to
thread_halt_self.
|
|
to replace the use of the NULL pointer.
* kern/sched_prim.h (thread_no_continuation): New macro.
* kern/machine.c (processor_assign, processor_doaction): Use
thread_no_continuation instead of 0.
* kern/profile.c (send_last_sample_buf): Likewise
* kern/sched_prim.c (thread_sleep, thread_invoke, thread_dispatch):
Likewise.
* kern/task.c (task_terminate, task_assign): Likewise.
* kern/thread.c (thread_suspend): Likewise.
* kern/thread.h (struct thread): Change type of swap_func field to
continuation_t.
|
|
* kern/bootstrap.c (boot_script_exec_cmd): Avoid holding the lock
across the call to `thread_create'.
|
|
* i386/intel/pmap.c (pmap_page_protect): Enable assertions.
(phys_attribute_clear, phys_attribute_test): Likewise.
|
|
* kern/lock.c (simple_unlock): Really zero-out unused simple lock info
entries.
|
|
* i386/intel/pmap.c (pmap_page_protect): Fix function name in panic
message.
|
|
* vm/vm_object.c (vm_object_collapse): Collapse unreachable branch
into assertion.
|
|
* 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.
|
|
* vm/vm_user.c (vm_wire): Drop unused but set variable `host'.
|
|
* vm/vm_fault.c (vm_fault_page): Enable extra assertions.
|
|
* 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.
|
|
* include/mach/time_value.h (time_value_assert): New macro to assert
that the given value is well-formed.
(time_value_add_usec): Use the new macro.
(time_value_sub_usec): New macro.
(time_value_add): Use `time_value_add_usec'.
(time_value_sub_usec): New macro.
|