summaryrefslogtreecommitdiff
path: root/kern
AgeCommit message (Collapse)Author
2020-01-01Cope with machine_info.memory_size overflowSamuel Thibault
* kern/startup.c (setup_main): When memory size overflows machine_info.memory_size, set to maximum size.
2019-11-01sched: cause ast on master processor tooSamuel Thibault
Nowadays' processors are way fast enough to handle everything fine. * kern/sched_prim.c (thread_setrun): Do not check against target processor being master.
2019-10-27patch: add last_processor to thread info structuresAlmudena Garcia
* include/mach/thread_info.h (thread info structures): Add new member "last_processor" in thread_sched_info. * kern/thread.c (thread management): Fill new member "last_processor" in thread_info() function.
2019-08-11Fix formatSamuel Thibault
* kern/task.c (task_create_kernel): Fix passing string size.
2019-08-11Fix uninitialized valueSamuel Thibault
* kern/gsync.c (temp_mapping): Initialize start address to VM_MIN_KERNEL_ADDRESS.
2018-11-19Fix interactivity of inactive threadsSamuel Thibault
A new thread will mosty probably start working, assume it will take its share of CPU, to avoid having to find it out slowly. Decaying will however fix that quickly if it actually does not work. This fixes stalling issues when a program keeps creating threads. * kern/thread.c (thread_create): Set new_thread's cpu_usage and sched_usage to a fair share of the current load.
2018-11-19Fix task and thread collection frequencySamuel Thibault
sched_tick is incremented only once per second, not once per tick. * kern/task.c (consider_task_collect): Divide task_collect_max_rate by (hz / 1) to get a number of scheduler ticks. * kern/thread.c (consider_thread_collect): Divide thread_collect_max_rate by (hz / 1) to get a number of scheduler ticks.
2018-11-19Drop SIMPLE_CLOCK supportSamuel Thibault
This wasn't building and is not useful with nowaday's hardware. * configfrag.ac (SIMPLE_CLOCK): Do not define. * kern/sched.h [SIMPLE_CLOCK] (sched_usec): Remove variable declaration. * kern/sched_prim.c [SIMPLE_CLOCK] (sched_usec): Remove variable. [SIMPLE_CLOCK] (sched_init): Do not initialize sched_usec variable. [SIMPLE_CLOCK] (recompute_priorities): Do not tinker sched_usec variable. * kern/thread.c [SIMPLE_CLOCK] (thread_info): Do not ajust for clock drift.
2018-11-19Make scheduling more reactiveSamuel Thibault
Give smaller quantums to processes, to get more frequent context switches. This fixes some reactivity for concurrent processes. * kern/sched.h (MIN_QUANTUM): Define to hz / 33. * kern/sched_prim.c (sched_init): Use MIN_QUANTUM instead of hz / 10.
2018-11-04Fix using all dynamic prioritiesSamuel Thibault
6a2342010811 ("Increase number of priorities") increased NRQS but didn't increase PRI_SHIFT to extend the use of the additional queues by the scheduler. This does it. While at it, extend to NRQS to 64, the double of the original 32, to keep all values coherent. * i386/i386/sched_param.h (PRI_SHIFT): Set from 18 to 17. * kern/sched.h (PRI_SHIFT): Set from 18 to 17. (NRQS): Set to 64.
2018-06-27Add cause_ast_check prototypeSamuel Thibault
As reported by Almudena Garcia <liberamenso10000@gmail.com> * kern/ast.h [NCPUS > 1] (cause_ast_check): Add prototype.
2018-06-27Define CPU_L1_SIZE even when NCPUS != 1Samuel Thibault
As reported by Almudena Garcia <liberamenso10000@gmail.com> * kern/cpu_number.h [NCPUS != 1] (CPU_L1_SIZE): Define macro.
2018-06-17Add missing prototypeSamuel Thibault
* kern/machine.h (action_thread): Add prototype.
2018-01-28Fix warningSamuel Thibault
* kern/sched_prim.c (assert_wait): Fix panic format.
2018-01-28Fix warningSamuel Thibault
* kern/ast.c (ast_check): Fix panic format.
2017-10-27Fix commit 10ebf9565f69760e46a8f271e22c5367d54e10ff.Justus Winter
* kern/task.c (task_ledger_acquire): Remove function that I added by accident. (task_ledger_release): Likewise.
2017-10-26kern: Fix new task notifications.Justus Winter
* kern/task.c (task_create_kernel): Handle NULL parent tasks.
2017-10-26kern: Fix crash.Justus Winter
Check receiver in task_create. Fixes a crash when sending that message to a non-task port. * kern/bootstrap.c (boot_script_task_create): Use the new function. * kern/task.c (task_create): Rename to task_create_internal, create a new function in its place that checks the receiver first. * kern/task.h (task_create_internal): New prototype.
2017-10-23Drop the register qualifier.Justus Winter
* i386/intel/pmap.c: Drop the register qualifier. * ipc/ipc_kmsg.h: Likewise. * kern/bootstrap.c: Likewise. * kern/profile.c: Likewise. * kern/thread.c: Likewise. * vm/vm_object.c: Likewise.
2017-08-05kern: Fix reporting the minimum quantum used for scheduling.Justus Winter
* kern/host.c (host_info): Scale 'min_quantum' by 'tick', then convert to milliseconds.
2017-05-07Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumachSamuel Thibault
2017-03-18kern: Make kernel task available to bootscript.Justus Winter
* kern/bootstrap.c (bootstrap_create): Insert the variable 'kernel-task' into the bootscript environment. Userspace can use this instead of guessing based on the order of the first tasks.
2017-03-04Rewrite gsync so that it works with remote tasks v2Agustina Arzille
2017-03-04Implement basic sleeping locks for gnumachAgustina Arzille
* kern/atomic.h: New file. * kern/kmutex.h: New file. * kern/kmutex.c: New file. * Makefrag.am (libkernel_a_SOURCES): Add atomic.h, kmutex.h, kmutex.c. * kern/sched_prim.h (thread_wakeup_prim): Make it return boolean_t. * kern/sched_prim.c (thread_wakeup_prim): Return TRUE if we woke a thread, and FALSE otherwise.
2016-12-09rbtree: minor changeRichard Braun
* kern/rbtree.h (rbtree_for_each_remove): Remove trailing slash.
2016-11-10gsync: Avoid NULL pointer dereferenceBrent Baccala
* kern/gsync.c (gsync_wait, gsync_wake, gsync_requeue): Return immediately if task argument is TASK_NULL
2016-10-31gsync: fix licenceSamuel Thibault
Agustina relicenced her work. * kern/gsync.c: Relicence to GPL 2+. * kern/gsync.h: Relicence to GPL 2+.
2016-10-31gsync: Fix crash when task is not current taskSamuel Thibault
* kern/gsync.c (gsync_wait, gsync_wake, gsync_requeue): Return KERN_FAILURE when task != current_task().
2016-10-31gsync: Fix assertion failure with MACH_LDEBUGSamuel Thibault
vm_map_lock_read calls check_simple_locks(), so we need to lock hbp after taking the vm_map read lock. * kern/gsync.c (gsync_wait): Call vm_map_lock_read before locking &hbp->lock. (gsync_wake): Likewise.
2016-10-21Gracefully handle pmap allocation failures.Justus Winter
* kern/task.c (task_create): Gracefully handle pmap allocation failures. * vm/vm_map.c (vm_map_fork): Likewise.
2016-10-01kern: Improve panic messages from the scheduler.Justus Winter
* kern/sched_prim.c (state_panic): Turn into macro, print symbolic values of thread state.
2016-10-01kern: Improve assertions and panics.Justus Winter
* kern/assert.h (Assert): Add function argument. (assert): Supply function argument. * kern/debug.c (Assert): Add function argument. Unify message format. (panic): Rename to 'Panic', add location information. * kern/debug.h (panic): Rename, and add a macro version that supplies the location. * linux/dev/include/linux/kernel.h: Use the new panic macro.
2016-09-21Rework pageout to handle multiple segmentsRichard Braun
As we're about to use a new HIGHMEM segment, potentially much larger than the existing DMA and DIRECTMAP ones, it's now compulsory to make the pageout daemon aware of those segments. And while we're at it, let's fix some of the defects that have been plaguing pageout forever, such as throttling, and pageout of internal versus external pages (this commit notably introduces a hardcoded policy in which as many external pages are selected before considering internal pages). * kern/slab.c (kmem_pagefree_physmem): Update call to vm_page_release. * vm/vm_page.c: Include <kern/counters.h> and <vm/vm_pageout.h>. (VM_PAGE_SEG_THRESHOLD_MIN_NUM, VM_PAGE_SEG_THRESHOLD_MIN_DENOM, VM_PAGE_SEG_THRESHOLD_MIN, VM_PAGE_SEG_THRESHOLD_LOW_NUM, VM_PAGE_SEG_THRESHOLD_LOW_DENOM, VM_PAGE_SEG_THRESHOLD_LOW, VM_PAGE_SEG_THRESHOLD_HIGH_NUM, VM_PAGE_SEG_THRESHOLD_HIGH_DENOM, VM_PAGE_SEG_THRESHOLD_HIGH, VM_PAGE_SEG_MIN_PAGES, VM_PAGE_HIGH_ACTIVE_PAGE_NUM, VM_PAGE_HIGH_ACTIVE_PAGE_DENOM): New macros. (struct vm_page_queue): New type. (struct vm_page_seg): Add new members `min_free_pages', `low_free_pages', `high_free_pages', `active_pages', `nr_active_pages', `high_active_pages', `inactive_pages', `nr_inactive_pages'. (vm_page_alloc_paused): New variable. (vm_page_pageable, vm_page_can_move, vm_page_remove_mappings): New functions. (vm_page_seg_alloc_from_buddy): Pause allocations and start the pageout daemon as appropriate. (vm_page_queue_init, vm_page_queue_push, vm_page_queue_remove, vm_page_queue_first, vm_page_seg_get, vm_page_seg_index, vm_page_seg_compute_pageout_thresholds): New functions. (vm_page_seg_init): Initialize the new segment members. (vm_page_seg_add_active_page, vm_page_seg_remove_active_page, vm_page_seg_add_inactive_page, vm_page_seg_remove_inactive_page, vm_page_seg_pull_active_page, vm_page_seg_pull_inactive_page, vm_page_seg_pull_cache_page): New functions. (vm_page_seg_min_page_available, vm_page_seg_page_available, vm_page_seg_usable, vm_page_seg_double_lock, vm_page_seg_double_unlock, vm_page_seg_balance_page, vm_page_seg_balance, vm_page_seg_evict, vm_page_seg_compute_high_active_page, vm_page_seg_refill_inactive, vm_page_lookup_seg, vm_page_check): New functions. (vm_page_alloc_pa): Handle allocation failure from VM privileged thread. (vm_page_info_all): Display additional segment properties. (vm_page_wire, vm_page_unwire, vm_page_deactivate, vm_page_activate, vm_page_wait): Move from vm/vm_resident.c and rewrite to use segments. (vm_page_queues_remove, vm_page_check_usable, vm_page_may_balance, vm_page_balance_once, vm_page_balance, vm_page_evict_once): New functions. (VM_PAGE_MAX_LAUNDRY, VM_PAGE_MAX_EVICTIONS): New macros. (vm_page_evict, vm_page_refill_inactive): New functions. * vm/vm_page.h: Include <kern/list.h>. (struct vm_page): Remove member `pageq', reuse the `node' member instead, move the `listq' and `next' members above `vm_page_header'. (VM_PAGE_CHECK): Define as an alias to vm_page_check. (vm_page_check): New function declaration. (vm_page_queue_fictitious, vm_page_queue_active, vm_page_queue_inactive, vm_page_free_target, vm_page_free_min, vm_page_inactive_target, vm_page_free_reserved, vm_page_free_wanted): Remove extern declarations. (vm_page_external_pagedout): New extern declaration. (vm_page_release): Update declaration. (VM_PAGE_QUEUES_REMOVE): Define as an alias to vm_page_queues_remove. (VM_PT_PMAP, VM_PT_KMEM, VM_PT_STACK): Remove macros. (VM_PT_KERNEL): Update value. (vm_page_queues_remove, vm_page_balance, vm_page_evict, vm_page_refill_inactive): New function declarations. * vm/vm_pageout.c (VM_PAGEOUT_BURST_MAX, VM_PAGEOUT_BURST_MIN, VM_PAGEOUT_BURST_WAIT, VM_PAGEOUT_EMPTY_WAIT, VM_PAGEOUT_PAUSE_MAX, VM_PAGE_INACTIVE_TARGET, VM_PAGE_FREE_TARGET, VM_PAGE_FREE_MIN, VM_PAGE_FREE_RESERVED, VM_PAGEOUT_RESERVED_INTERNAL, VM_PAGEOUT_RESERVED_REALLY): Remove macros. (vm_pageout_reserved_internal, vm_pageout_reserved_really, vm_pageout_burst_max, vm_pageout_burst_min, vm_pageout_burst_wait, vm_pageout_empty_wait, vm_pageout_pause_count, vm_pageout_pause_max, vm_pageout_active, vm_pageout_inactive, vm_pageout_inactive_nolock, vm_pageout_inactive_busy, vm_pageout_inactive_absent, vm_pageout_inactive_used, vm_pageout_inactive_clean, vm_pageout_inactive_dirty, vm_pageout_inactive_double, vm_pageout_inactive_cleaned_external): Remove variables. (vm_pageout_requested, vm_pageout_continue): New variables. (vm_pageout_setup): Wait for page allocation to succeed instead of falling back to flush, update double paging protocol with caller, add pageout throttling setup. (vm_pageout_scan): Rewrite to use the new vm_page balancing, eviction and inactive queue refill functions. (vm_pageout_scan_continue, vm_pageout_continue): Remove functions. (vm_pageout): Rewrite. (vm_pageout_start, vm_pageout_resume): New functions. * vm/vm_pageout.h (vm_pageout_continue, vm_pageout_scan_continue): Remove function declarations. (vm_pageout_start, vm_pageout_resume): New function declarations. * vm/vm_resident.c: Include <kern/list.h>. (vm_page_queue_fictitious): Define as a struct list. (vm_page_free_wanted, vm_page_external_count, vm_page_free_avail, vm_page_queue_active, vm_page_queue_inactive, vm_page_free_target, vm_page_free_min, vm_page_inactive_target, vm_page_free_reserved): Remove variables. (vm_page_external_pagedout): New variable. (vm_page_bootstrap): Don't initialize removed variable, update initialization of vm_page_queue_fictitious. (vm_page_replace): Call VM_PAGE_QUEUES_REMOVE where appropriate. (vm_page_remove): Likewise. (vm_page_grab_fictitious): Update to use list_xxx functions. (vm_page_release_fictitious): Likewise. (vm_page_grab): Remove pageout related code. (vm_page_release): Add `laundry' and `external' parameters for pageout throttling. (vm_page_grab_contig): Remove pageout related code. (vm_page_free_contig): Likewise. (vm_page_free): Remove pageout related code, update call to vm_page_release. (vm_page_wait, vm_page_wire, vm_page_unwire, vm_page_deactivate, vm_page_activate): Move to vm/vm_page.c.
2016-09-21Redefine what an external page isRichard Braun
Instead of a "page considered external", which apparently takes into account whether a page is dirty or not, redefine this property to reliably mean "is in an external object". This commit mostly deals with the impact of this change on the page allocation interface. * i386/intel/pmap.c (pmap_page_table_page_alloc): Update call to vm_page_grab. * kern/slab.c (kmem_pagealloc_physmem): Use vm_page_grab instead of vm_page_grab_contig. (kmem_pagefree_physmem): Use vm_page_release instead of vm_page_free_contig. * linux/dev/glue/block.c (alloc_buffer, device_read): Update call to vm_page_grab. * vm/vm_fault.c (vm_fault_page): Update calls to vm_page_grab and vm_page_convert. * vm/vm_map.c (vm_map_copy_steal_pages): Update call to vm_page_grab. * vm/vm_page.h (struct vm_page): Remove `extcounted' member. (vm_page_external_limit, vm_page_external_count): Remove extern declarations. (vm_page_convert, vm_page_grab): Update declarations. (vm_page_release, vm_page_grab_phys_addr): New function declarations. * vm/vm_pageout.c (VM_PAGE_EXTERNAL_LIMIT): Remove macro. (VM_PAGE_EXTERNAL_TARGET): Likewise. (vm_page_external_target): Remove variable. (vm_pageout_scan): Remove specific handling of external pages. (vm_pageout): Don't set vm_page_external_limit and vm_page_external_target. * vm/vm_resident.c (vm_page_external_limit): Remove variable. (vm_page_insert, vm_page_replace, vm_page_remove): Update external page tracking. (vm_page_convert): RemoveĀ `external' parameter. (vm_page_grab): Likewise. Remove specific handling of external pages. (vm_page_grab_phys_addr): Update call to vm_page_grab. (vm_page_release): Remove `external' parameter and remove specific handling of external pages. (vm_page_wait): Remove specific handling of external pages. (vm_page_alloc): Update call to vm_page_grab. (vm_page_free): Update call to vm_page_release. * xen/block.c (device_read): Update call to vm_page_grab. * xen/net.c (device_write): Likewise.
2016-09-21Remove phys_first_addr and phys_last_addr global variablesRichard Braun
The old assumption that all physical memory is directly mapped in kernel space is about to go away. Those variables are directly linked to that assumption. * i386/i386/model_dep.h (phys_first_addr): Remove extern declaration. (phys_last_addr): Likewise. * i386/i386/phys.c (pmap_zero_page): Use VM_PAGE_DIRECTMAP_LIMIT instead of phys_last_addr. (pmap_copy_page, copy_to_phys, copy_from_phys): Likewise. * i386/i386/trap.c (user_trap): Remove check against phys_last_addr. * i386/i386at/biosmem.c (biosmem_bootstrap_common): Don't set phys_last_addr. * i386/i386at/mem.c (memmmap): Use vm_page_lookup_pa to determine if a physical address references physical memory. * i386/i386at/model_dep.c (phys_first_addr): Remove variable. (phys_last_addr): Likewise. (pmap_free_pages, pmap_valid_page): Remove functions. * i386/intel/pmap.c: Include i386at/biosmem.h. (pa_index): Turn into an alias for vm_page_table_index. (pmap_bootstrap): Replace uses of phys_first_addr and phys_last_addr as appropriate. (pmap_virtual_space): Use vm_page_table_size instead of phys_first_addr and phys_last_addr to obtain the number of physical pages. (pmap_verify_free): Remove function. (valid_page): Turn this macro into an inline function and rewrite using vm_page_lookup_pa. (pmap_page_table_page_alloc): Build the pmap VM object using vm_page_table_size to determine its size. (pmap_remove_range, pmap_page_protect, phys_attribute_clear, phys_attribute_test): Turn page indexes into unsigned long integers. (pmap_enter): Likewise. In addition, use either vm_page_lookup_pa or biosmem_directmap_end to determine if a physical address references physical memory. * i386/xen/xen.c (hyp_p2m_init): Use vm_page_table_size instead of phys_last_addr to obtain the number of physical pages. * kern/startup.c (phys_first_addr): Remove extern declaration. (phys_last_addr): Likewise. * linux/dev/init/main.c (linux_init): Use vm_page_seg_end with the appropriate segment selector instead of phys_last_addr to determine where high memory starts. * vm/pmap.h: Update requirements description. (pmap_free_pages, pmap_valid_page): Remove declarations. * vm/vm_page.c (vm_page_seg_end, vm_page_boot_table_size, vm_page_table_size, vm_page_table_index): New functions. * vm/vm_page.h (vm_page_seg_end, vm_page_table_size, vm_page_table_index): New function declarations. * vm/vm_resident.c (vm_page_bucket_count, vm_page_hash_mask): Define as unsigned long integers. (vm_page_bootstrap): Compute VP table size based on the page table size instead of the value returned by pmap_free_pages.
2016-09-16VM: improve pageout deadlock workaroundRichard Braun
Commit 5dd4f67522ad0d49a2cecdb9b109251f546d4dd1 makes VM map entry allocation done with VM privilege, so that a VM map isn't held locked while physical allocations are paused, which may block the default pager during page eviction, causing a system-wide deadlock. First, it turns out that map entries aren't the only buffers allocated, and second, their number can't be easily determined, which makes a preallocation strategy very hard to implement. This change generalizes the strategy of VM privilege increase when a VM map is locked. * device/ds_routines.c (io_done_thread): Use integer values instead of booleans when setting VM privilege. * kern/thread.c (thread_init, thread_wire): Likewise. * vm/vm_pageout.c (vm_pageout): Likewise. * kern/thread.h (struct thread): Turn member `vm_privilege' into an unsigned integer. * vm/vm_map.c (vm_map_lock): New function, where VM privilege is temporarily increased. (vm_map_unlock): New function, where VM privilege is decreased. (_vm_map_entry_create): Remove VM privilege workaround from this function. * vm/vm_map.h (vm_map_lock, vm_map_unlock): Turn into functions.
2016-09-07Remove map entry pageability property.Richard Braun
Since the replacement of the zone allocator, kernel objects have been wired in memory. Besides, as of 5e9f6f (Stack the slab allocator directly on top of the physical allocator), there is a single cache used to allocate map entries. Those changes make the pageability attribute of VM maps irrelevant. * device/ds_routines.c (mach_device_init): Update call to kmem_submap. * ipc/ipc_init.c (ipc_init): Likewise. * kern/task.c (task_create): Update call to vm_map_create. * vm/vm_kern.c (kmem_submap): Remove `pageable' argument. Update call to vm_map_setup. (kmem_init): Update call to vm_map_setup. * vm/vm_kern.h (kmem_submap): Update declaration. * vm/vm_map.c (vm_map_setup): Remove `pageable' argument. Don't set `entries_pageable' member. (vm_map_create): Likewise. (vm_map_copyout): Don't bother creating copies of page entries with the right pageability. (vm_map_copyin): Don't set `entries_pageable' member. (vm_map_fork): Update call to vm_map_create. * vm/vm_map.h (struct vm_map_header): Remove `entries_pageable' member. (vm_map_setup, vm_map_create): Remove `pageable' argument.
2016-08-25Add missing memory barriers in simple lock debuggingSamuel Thibault
* kern/lock.c (_simple_lock, _simple_lock_try, simple_unlock): Add compiler memory barrier to separate simple_locks_taken update from information filling.
2016-08-16Replace libc string functions with internal implementationsRichard Braun
* Makefile.am (clib_routines): Remove memcmp, memcpy, memmove, strchr, strstr and strsep. * kern/strings.c (memset): Comment out. (strchr, strsep, strstr): New functions.
2016-08-06Augment VM maps with task namesRichard Braun
This change improves the clarity of "no more room for ..." VM map allocation errors. * kern/task.c (task_init): Call vm_map_set_name for the kernel map. (task_create): Call vm_map_set_name where appropriate. * vm/vm_map.c (vm_map_setup): Set map name to NULL. (vm_map_find_entry_anywhere): Update error message to include map name. * vm/vm_map.h (struct vm_map): New `name' member. (vm_map_set_name): New inline function.
2016-06-29Fix page fault in critical section in the slab allocatorRichard Braun
* kern/slab.c (host_slab_info): Use wired kernel memory to build the cache info.
2016-06-29Fix locking error in the slab allocatorRichard Braun
* kern/slab.c (kmem_slab_create): Set `slab->cache` member. (kmem_cache_reap): Return dead slabs instead of destroying in place. (slab_collect): Destroy slabs outside of critical section. * kern/slab.h (struct kmem_slab): New `cache` member.
2016-06-10Allow setting x86 debug flags for the current threadSamuel Thibault
* kern/thread.c (thread_get_state): Allow call for the current thread, without suspending it. (thread_set_status): Likewise.
2016-06-10Use int3 on x86_64 build tooSamuel Thibault
* kern/debug.c (SoftDebugger) [__x86_64__]: Use int3 instruction to trigger debugger.
2016-06-02Fix some license headers.Richard Braun
As the original author of the files imported, I explicitely dual license them to something compatible with GPLv2. kern/macros.h: Switch license from GPLv3 to BSD 2-clause. kern/rdxtree_i.h: Likewise.
2016-05-26Fix potential divisal by zeroSamuel Thibault
* kern/debug.c (panic, log): Pass 16 as default radix to _doprnt.
2016-05-18Fix gcc-6 warningsSamuel Thibault
* ddb/db_elf.c (elf_db_sym_init): Turn `i' into unsigned. * device/ds_routines.c (ds_device_open, device_writev_trap): Likewise. * i386/i386/user_ldt.c (i386_set_ldt): Likewise for `i', `min_selector', and `first_desc'. (i386_get_ldt): Likewise for `ldt_count'. (user_ldt_free): Likewise for `i'. * i386/i386/xen.h (hyp_set_ldt): Turn `count' into unsigned long. * i386/intel/pmap.c (pmap_bootstrap): Turn `i', `j' and 'n' into unsigned. (pmap_clear_bootstrap_pagetable): Likewise for `i' and `j'. * ipc/ipc_kmsg.c (ipc_msg_print): Turn `i' and `numwords' into unsigned. * kern/boot_script.c (boot_script_parse_line): Likewise for `i'. * kern/bootstrap.c (bootstrap_create): Likewise for `n' and `i'. * kern/host.c (host_processors): Likewise for `i'. * kern/ipc_tt.c (mach_ports_register): Likewise. * kern/mach_clock.c (tickadj, bigadj): turn into unsigned. * kern/processor.c (processor_set_things): Turn `i' into unsigned. * kern/task.c (task_threads): Likewise. * kern/thread.c (consider_thread_collect, stack_init): Likewise. * kern/strings.c (memset): Turn `i' into size_t. * vm/memory_object.c (memory_object_lock_request): Turn `i' into unsigned. * xen/block.c (hyp_block_init): Use %u format for evt. (device_open): Drop unused err variable. (device_write): Turn `copy_npages', `i', `nbpages', and `j' into unsigned. * xen/console.c (hypcnread, hypcnwrite, hypcnclose): Turn dev to dev_t. (hypcnclose): Return void. * xen/console.h (hypcnread, hypcnwrite, hypcnclose): Fix prototypes accordingly. * xen/evt.c (form_int_mask): Turn `i' into int. * xen/net.c (hyp_net_init): Use %u format for evt. (device_open): Remove unused `err' variable.
2016-04-20Add kernel profiling through samplingSamuel Thibault
* NEWS: Advertise feature. * configfrac.ac (--enable-kernsample): Add option. * kern/pc_sample.h (take_pc_sample): Add usermode and pc parameter. (take_pc_sample_macro): Take usermode and pc parameters, pass as such to take_pc_sample. * kern/pc_sample.c (take_pc_sample): Use pc parameter when usermode is 1. * kern/mach_clock.c (clock_interrupt): Add pc parameter. Pass usermode and pc to take_pc_sample_macro call. * i386/i386/hardclock.c (hardclock): Pass regs->eip to clock_interrupt call on normal interrupts, NULL on interrupt interrupt. * vm/vm_fault.c (vm_fault_cleanup): Set usermode to 1 and pc to NULL in take_pc_sample_macro call.
2016-04-17Avoid using C99 for variable declaration for nowSamuel Thibault
* kern/gsync.c (gsync_setup): Declare `i' variable out of for loop.
2016-04-15Lightweight synchronization mechanismAgustina Arzille
* Makefrag.am (libkernel_a_SOURCES): Add kern/gsync.c and kern/gsync.h. * include/mach/gnumach.defs (gsync_wait, gsync_wake, gsync_requeue): New routines. * include/mach/kern_return.h (KERN_TIMEDOUT, KERN_INTERRUPTED): New error codes. * kern/gsync.c: New file. * kern/gsync.h: New file. * kern/startup.c: Include <kern/gsync.h> (setup_main): Call gsync_setup.