--- Gnu-Mach/ChangeLog 2020/09/02 04:47:10 1.1.1.7 +++ Gnu-Mach/ChangeLog 2020/09/02 04:53:51 1.1.1.10 @@ -1,3 +1,2671 @@ +2016-12-18 Thomas Schwinge + + GNU Mach 1.8 + * version.m4 (AC_PACKAGE_VERSION): Set to 1.8. + * NEWS: Finalize for 1.8. + +2016-12-11 Richard Braun + + VM: make vm_wire more POSIX-friendly + * doc/mach.texi: Update return codes. + * vm/vm_map.c (vm_map_pageable_common): Return KERN_NO_SPACE instead + of KERN_FAILURE if some of the specified address range does not + correspond to mapped pages. Skip unwired entries instead of failing + when unwiring. + +2016-12-09 Justus Winter + + Update the NEWS file + +2016-12-09 Richard Braun + + rbtree: minor change + * kern/rbtree.h (rbtree_for_each_remove): Remove trailing slash. + +2032-05-12 Richard Braun + + VM: fix pageout throttling to external pagers + Since the VM system has been tracking whether pages belong to internal + or external objects, pageout throttling to external pagers has simply + not been working. The reason is that, on pageout, requests for external + pages are correctly tracked, but on page release (which is used to + acknowledge the request), external pages are not marked external + any more. This is because the external bit tracks whether a page + belongs to an external object, and all pages, including external + ones, are moved to an internal object during pageout. + + To solve this issue, a new "external_laundry" bit is added. It has + the same purpose as the laundry bit, but for external pagers. + + * vm/vm_page.c (vm_page_seg_min_page_available): Function unused, remove. + (vm_page_seg_evict): Use vm_page_external_laundry_count instead of + vm_page_external_pagedout. Add an assertion about double paging. + (vm_page_check_usable): Use vm_page_external_laundry_count instead of + vm_page_external_pagedout. + (vm_page_evict): Likewise. + * vm/vm_page.h (struct vm_page): New `external_laundry' member. + (vm_page_external_pagedout): Rename to ... + (vm_page_external_laundry_count): ... this. + * vm/vm_pageout.c: Include kern/printf.h. + (DEBUG): New macro. + (VM_PAGEOUT_TIMEOUT): Likewise. + (vm_pageout_setup): Use vm_page_external_laundry_count instead of + vm_page_external_pagedout. Set `external_laundry' where appropriate. + (vm_pageout): Use VM_PAGEOUT_TIMEOUT with thread_set_timeout. + Add debugging code, commented out by default. + * vm/vm_resident.c (vm_page_external_pagedout): Rename to ... + (vm_page_external_laundry_count): ... this. + (vm_page_init_template): Set `external_laundry' member to FALSE. + (vm_page_release): Rename external parameter to external_laundry. + Slightly change pageout resuming. + (vm_page_free): Rename external variable to external_laundry. + +2016-11-30 Richard Braun + + VM: fix pageout on low memory + Instead of determining if memory is low, directly use the + vm_page_alloc_paused variable, which is true when memory has reached + a minimum threshold until it gets back above the high thresholds. + + This makes sure double paging is used when external pagers are unable + to allocate memory. + + * vm/vm_page.c (vm_page_seg_evict): Rename low_memory to alloc_paused. + (vm_page_evict_once): Remove low_memory and its computation. Blindly + pass the new alloc_paused argument instead. + (vm_page_evict): Pass the value of vm_page_alloc_paused to + vm_page_evict_once. + +2016-11-30 Richard Braun + + VM: fix eviction logic error + * vm/vm_page.c (vm_page_evict): Test both vm_page_external_pagedout + and vm_page_laundry_count in order to determine there was "no pageout". + +2016-11-30 Richard Braun + + VM: fix pageout stop condition + When checking whether to continue paging out or not, the pageout daemon + only considers the high free page threshold of a segment. But if e.g. + the default pager had to allocate reserved pages during a previous + pageout cycle, it could have exhausted a segment (this is currently + only seen with the DMA segment). In that case, the high threshold + cannot be reached because the segment has currently no pageable page. + + This change makes the pageout daemon identify this condition and + consider the segment as usable in order to make progress. The segment + will simply be ignored on the allocation path for unprivileged threads, + and if this happens with too many segments, the system will fail at + allocation time. + + * vm/vm_page.c (vm_page_seg_usable): Report usable if the segment has + no pageable page. + +2016-11-10 Brent Baccala + + gsync: Avoid NULL pointer dereference + * kern/gsync.c (gsync_wait, gsync_wake, gsync_requeue): + Return immediately if task argument is TASK_NULL + +2016-11-06 Justus Winter + + Revert "i386: use ACPI to power off the machine" + This reverts commit c031b41b783cc99c0bd5aac7d14c1d6e34520397. + + Adding the ACPI parser from GRUB was a mistake as its license + conflicts with the one used by the legacy Linux drivers. Furthermore, + adding support for ACPI to the kernel violates the minimality + principle. + +2016-11-04 Justus Winter + + vm: Print names of maps in the debugger. + * vm/vm_map.c (vm_map_print): Print name of the map. + +2016-11-01 Justus Winter + + include: Fix new task notifications. + Instead of copying the send right, move it. This fixes a send-right + leak. + + * include/mach/task_notify.defs (task_move_t): New type. + (mach_notify_new_task): Use the new type. + +2016-11-01 Justus Winter + + i386: Use discontiguous page directories when using PAE. + Previously, we used contiguous page directories four pages in length + when using PAE. To prevent physical memory fragmentation, we need to + use virtual memory for objects spanning multiple pages. Virtual + kernel memory, however, is a scarce commodity. + + * i386/intel/pmap.h (lin2pdenum): Never include the page directory pointer table index. + (lin2pdenum_cont): New macro which does include said index. + (struct pmap): Remove the directory base pointer when using PAE. + * i386/intel/pmap.c (pmap_pde): Fix lookup. + (pmap_pte): Fix check for uninitialized pmap. + (pmap_bootstrap): Do not store the page directory base if PAE. + (pmap_init): Reduce size of page directories to one page, use + direct-mapped memory. + (pmap_create): Allocate four page directories per pmap. + (pmap_destroy): Adapt to the discontinuous directories. + (pmap_collect): Likewise. + * i386/i386/xen.h (hyp_mmu_update_la): Adapt code manipulating the + kernels page directory. + * i386/i386at/model_dep.c (i386at_init): Likewise. + +2016-10-31 Samuel Thibault + + gsync: fix licence + Agustina relicenced her work. + + * kern/gsync.c: Relicence to GPL 2+. + * kern/gsync.h: Relicence to GPL 2+. + +2016-10-31 Samuel Thibault + + gsync: Fix crash when task is not current task + * kern/gsync.c (gsync_wait, gsync_wake, gsync_requeue): Return + KERN_FAILURE when task != current_task(). + +2016-10-31 Samuel Thibault + + gsync: Fix assertion failure with MACH_LDEBUG + 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-31 Samuel Thibault + + Make multiboot cmdline and modules non-permanent reservations + * i386/i386at/model_dep.c (register_boot_data): For multiboot cmdline, + module structure, module data and module strings, set + biosmem_register_boot_data temporary parameter to TRUE. + +2016-10-24 Samuel Thibault + + Fix taking LDFLAGS into account + * Makefile.am (clib-routines.o): Add $(LDFLAGS) to link command. + + Fix taking LDFLAGS into account + * Makefile.am (gnumach_o_LINK, gnumach_LINK): Add $(LDFLAGS). + + Fix warnings + * i386/i386/seg.h (fill_descriptor): Fix format for vm_offset_t. + * i386/i386/xen.h (hyp_free_mfn, hyp_free_page): Fix format for unsigned + long. + +2016-10-22 Justus Winter + + i386: Allocate page directories using the slab allocator. + * i386/intel/pmap.c (pd_cache): New variable. + (pdp_cache): Likewise. + (pmap_init): Initialize new caches. + (pmap_create): Use the caches. + (pmap_destroy): Free to the caches. + +2016-10-21 Justus Winter + + Gracefully handle pmap allocation failures. + * kern/task.c (task_create): Gracefully handle pmap allocation + failures. + * vm/vm_map.c (vm_map_fork): Likewise. + + vm: Print map names in case of failures. + * vm/vm_kern.c (kmem_alloc): Print map names in case of failures. + (kmem_alloc_wired): Likewise. + (kmem_alloc_aligned): Likewise. + (kmem_alloc_pageable): Likewise. + +2016-10-13 Justus Winter + + Make task notification ports mutable. + * include/mach/task_notify.defs (task_notify_port_t): New type. + (mach_notify_new_task): Use the specialized type. + +2016-10-12 Justus Winter + + linux: Remove incompatible local prototype. + * linux/dev/glue/kmem.c (vremap): Remove prototype, include the right + header instead. + +2016-10-03 Justus Winter + + Remove deprecated external memory management interface. + * NEWS: Update. + * device/dev_pager.c (device_pager_data_request): Prune unused branch. + (device_pager_data_request_done): Remove function. + (device_pager_data_write): Likewise. + (device_pager_data_write_done): Likewise. + (device_pager_copy): Use 'memory_object_ready'. + * device/dev_pager.h (device_pager_data_write_done): Remove prototype. + * device/device_pager.srv (memory_object_data_write): Remove macro. + * doc/mach.texi: Update documentation. + * include/mach/mach.defs (memory_object_data_provided): Drop RPC. + (memory_object_set_attributes): Likewise. + * include/mach/memory_object.defs: Update comments. + (memory_object_data_write): Drop RPC. + * include/mach/memory_object_default.defs: Update comments. + * include/mach_debug/vm_info.h (VOI_STATE_USE_OLD_PAGEOUT): Drop + macro. + * vm/memory_object.c (memory_object_data_provided): Remove function. + (memory_object_data_error): Simplify. + (memory_object_set_attributes_common): Make static, remove unused + parameters, simplify. + (memory_object_change_attributes): Update callsite. + (memory_object_set_attributes): Remove function. + (memory_object_ready): Update callsite. + * vm/vm_debug.c (mach_vm_object_info): Adapt to the changes. + * vm/vm_object.c (vm_object_bootstrap): Likewise. + * vm/vm_object.h (struct vm_object): Drop flag 'use_old_pageout'. + * vm/vm_pageout.c: Update comments. + (vm_pageout_page): Simplify. + +2016-10-02 David Michael + + Fix format security + * i386/i386at/biosmem.c (boot_panic): Use %s format instead of passing + the string directly to `panic'. + (biosmem_unregister_boot_data): Use %s format instead of passing + `biosmem_panic_inval_boot_data' directly to `panic'. + +2016-10-01 Justus Winter + + kern: Improve panic messages from the scheduler. + * kern/sched_prim.c (state_panic): Turn into macro, print symbolic + values of thread state. + + kern: Improve assertions and panics. + * 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-22 Samuel Thibault + + biosmem: show memory map at boot + * i386/i386at/biosmem.c (biosmem_type_desc, biosmem_map_show): Define + even if DEBUG is 0. But show biosmem heap addresses only if DEBUG is 1. + +2016-09-21 Richard Braun + + Enable high memory + * i386/i386at/biosmem.c (biosmem_setup): Load the HIGHMEM segment if + present. + (biosmem_free_usable): Report high memory as usable. + * vm/vm_page.c (vm_page_boot_table_size, vm_page_table_size, + vm_page_mem_size, vm_page_mem_free): Scan all segments. + * vm/vm_resident.c (vm_page_grab): Describe allocation strategy + with regard to the HIGHMEM segment. + +2016-09-21 Richard Braun + + Update device drivers for highmem support + Unconditionally use bounce buffers for now. + + * linux/dev/glue/net.c (device_write): Unconditionally use a + bounce buffer. + * xen/block.c (device_write): Likewise. + * xen/net.c: Include . + (device_write): Unconditionally use a bounce buffer. + +2016-09-21 Richard Braun + + Update Linux block layer glue code + The Linux block layer glue code needs to use page nodes with the + appropriate interface since their redefinition as struct list. + + * linux/dev/glue/block.c: Include . + (struct temp_data): Define member `pages' as a struct list. + (alloc_buffer): Update to use list_xxx functions. + (free_buffer, INIT_DATA, device_open, device_read): Likewise. + +2016-09-21 Richard Braun + + Rework pageout to handle multiple segments + 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 and . + (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 . + (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 . + (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-21 Richard Braun + + Redefine what an external page is + 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-21 Richard Braun + + Replace vm_offset_t with phys_addr_t where appropriate + * i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys, + copy_from_phys, kvtophys): Use the phys_addr_t type for physical + addresses. + * i386/intel/pmap.c (pmap_map, pmap_map_bd, pmap_destroy, + pmap_remove_range, pmap_page_protect, pmap_enter, pmap_extract, + pmap_collect, phys_attribute_clear, phys_attribute_test, + pmap_clear_modify, pmap_is_modified, pmap_clear_reference, + pmap_is_referenced): Likewise. + * i386/intel/pmap.h (pt_entry_t): Unconditionally define as a + phys_addr_t. + (pmap_zero_page, pmap_copy_page, kvtophys): Use the phys_addr_t + type for physical addresses. + * vm/pmap.h (pmap_enter, pmap_page_protect, pmap_clear_reference, + pmap_is_referenced, pmap_clear_modify, pmap_is_modified, + pmap_extract, pmap_map_bd): Likewise. + * vm/vm_page.h (vm_page_fictitious_addr): Declare as a phys_addr_t. + * vm/vm_resident.c (vm_page_fictitious_addr): Likewise. + (vm_page_grab_phys_addr): Change return type to phys_addr_t. + +2016-09-21 Richard Braun + + Remove phys_first_addr and phys_last_addr global variables + 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-20 Richard Braun + + VM: remove commented out code + The vm_page_direct_va, vm_page_direct_pa and vm_page_direct_ptr + functions were imported along with the new vm_page module, but + never actually used since the kernel already has phystokv and + kvtophys functions. + +2016-09-16 Richard Braun + + VM: improve pageout deadlock workaround + 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-11 Samuel Thibault + + Fix spurious warning + * i386/i386/db_trace.c (db_i386_stack_trace): Do not check for frame + validity if it is 0. + + Fix size of functions interrupt and syscall + * i386/i386/locore.S (syscall): Add END(syscall). + * i386/i386at/interrupt.S (interrupt): Add END(interrupt). + + Set function type on symbols created by ENTRY macro + * i386/include/mach/i386/asm.h (ENTRY, ENTRY2, ASENTRY, Entry): Use .type + @function on created entries. + + Close parenthesis + * i386/i386/db_trace.c (db_i386_stack_trace): When stopping on zero frame, + close parameters parenthesis. + + Fix exploring stack trace up to assembly + * i386/i386/db_trace.c (db_i386_stack_trace): Do not stop as soon as frame + is 0, lookup PC first, and stop only before accessing the frame content. + +2016-09-11 Justus Winter + + ipc: Fix crash in debug code. + * ipc/mach_debug.c (mach_port_kernel_object): Check that the receiver + is valid. + +2016-09-07 Richard Braun + + Remove map entry pageability property. + 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-09-06 Richard Braun + + Fix registration of strings from in boot data + * i386/i386at/model_dep.c (register_boot_data): Use phystokv on strings + when computing their length. + +2016-09-06 Richard Braun + + Make early physical page allocation truely reliable + Import upstream biosmem changes and adjust for local modifications. + + Specifically, this change makes the biosmem module reliably track all + boot data by storing their addresses in a sorted array. This allows + both the early page allocator and the biosmem_free_usable function + to accurately find any range of free pages. + + * i386/i386at/biosmem.c: Remove inclusion of . + (_start, _end): Remove variable declarations. + (BIOSMEM_MAX_BOOT_DATA): New macro. + (struct biosmem_boot_data): New type. + (biosmem_boot_data_array, biosmem_nr_boot_data): New variables. + (biosmem_heap_start, biosmem_heap_bottom, biosmem_heap_top, + biosmem_heap_end): Change type to phys_addr_t. + (biosmem_panic_inval_boot_data): New variable. + (biosmem_panic_too_many_boot_data): Likewise. + (biosmem_panic_toobig_msg): Variable renamed ... + (biosmem_panic_too_big_msg): ... to this. + (biosmem_register_boot_data): New function. + (biosmem_unregister_boot_data): Likewise. + (biosmem_map_adjust): Update reference to panic message. + (biosmem_map_find_avail): Add detailed description. + (biosmem_save_cmdline_sizes): Remove function. + (biosmem_find_heap_clip): Likewise. + (biosmem_find_heap): Likewise. + (biosmem_find_avail_clip, biosmem_find_avail): New functions. + (biosmem_setup_allocator): Receive const multiboot info, replace + calls to biosmem_find_heap with calls to biosmem_find_avail and + update accordingly. Register the heap as boot data. + (biosmem_xen_bootstrap): Register the Xen boot info and the heap as + boot data. + (biosmem_bootstrap): Receive const multiboot information. Remove call + to biosmem_save_cmdline_sizes. + (biosmem_bootalloc): Remove assertion on the VM system state. + (biosmem_type_desc, biosmem_map_show): Build only if DEBUG is true. + (biosmem_unregister_temporary_boot_data): New function. + (biosmem_free_usable_range): Change address range format. + (biosmem_free_usable_entry): Rewrite to use biosmem_find_avail + without abusing it. + (biosmem_free_usable): Call biosmem_unregister_temporary_boot_data, + update call to biosmem_free_usable_entry. + * i386/i386at/biosmem.h (biosmem_register_boot_data): New function. + (biosmem_bootalloc): Update description. + (biosmem_bootstrap): Update description and declaration. + (biosmem_free_usable): Likewise. + * i386/i386at/model_dep.c: Include . + (machine_init): Update call to biosmem_free_usable. + (register_boot_data): New function. + (i386at_init): Call register_boot_data where appropriate. + +2016-09-03 Richard Braun + + Fix early physical page allocation + Import upstream biosmem and vm_page changes, and adjust for local + modifications. + + Specifically, the biosmem module was mistakenly loading physical + segments that did not clip with the heap as completely available. + This change makes it load them as completely unavailable during + startup, and once the VM system is ready, additional pages are + loaded. + + * i386/i386at/biosmem.c (DEBUG): New macro. + (struct biosmem_segment): Remove members `avail_start' and `avail_end'. + (biosmem_heap_cur): Remove variable. + (biosmem_heap_bottom, biosmem_heap_top, biosmem_heap_topdown): New variables. + (biosmem_find_boot_data_update, biosmem_find_boot_data): Remove functions. + (biosmem_find_heap_clip, biosmem_find_heap): New functions. + (biosmem_setup_allocator): Rewritten to use the new biosmem_find_heap + function. + (biosmem_bootalloc): Support both bottom-up and top-down allocations. + (biosmem_directmap_size): Renamed to ... + (biosmem_directmap_end): ... this function. + (biosmem_load_segment): Fix segment loading. + (biosmem_setup): Restrict usable memory to the directmap segment. + (biosmem_free_usable_range): Add checks on input parameters. + (biosmem_free_usable_update_start, biosmem_free_usable_start, + biosmem_free_usable_reserved, biosmem_free_usable_end): Remove functions. + (biosmem_free_usable_entry): Rewritten to use the new biosmem_find_heap + function. + (biosmem_free_usable): Restrict usable memory to the directmap segment. + * i386/i386at/biosmem.h (biosmem_bootalloc): Update description. + (biosmem_directmap_size): Renamed to ... + (biosmem_directmap_end): ... this function. + (biosmem_free_usable): Update declaration. + * i386/i386at/model_dep.c (machine_init): Call biosmem_free_usable. + * vm/vm_page.c (DEBUG): New macro. + (struct vm_page_seg): New member `heap_present'. + (vm_page_load): Remove heap related parameters. + (vm_page_load_heap): New function. + * vm/vm_page.h (vm_page_load): Remove heap related parameters. Update + description. + (vm_page_load_heap): New function. + +2016-09-01 Richard Braun + + pmap: fix map window creation on xen + * i386/intel/pmap.c (pmap_get_mapwindow, pmap_put_mapwindow): Use + the appropriate xen hypercall if building for paravirtualized page + table management. + +2016-08-31 Samuel Thibault + + Avoid using non-ascii source encoding + * xen/console.c (hypcnintr): Replace latin1 £ character with the 0xA3 + number. + +2016-08-29 Richard Braun + + vm: fix boot on xen + * vm/vm_map.c (_vm_map_entry_create: Make sure there is a thread + before accessing VM privilege. + +2016-08-26 Samuel Thibault + + Revert "Fix documentation for vm_map" + This reverts commit 57694037a02dda29bd678dc3b8531bd437682ba7. + + We rather prefer the kernel just use whatever slot it sees fit. Userland has + already been fixed into not using the behavior anyway. + +2016-08-25 Samuel Thibault + + Add missing memory barriers in simple lock debugging + * kern/lock.c (_simple_lock, _simple_lock_try, simple_unlock): Add compiler + memory barrier to separate simple_locks_taken update from information + filling. + + Use invlpg for single-page pagetable changes + * i386/intel/pmap.c (INVALIDATE_TLB): When e-s is constant, equal to + PAGE_SIZE, use just one invlpg instruction to flush the TLB. + + Drop unused macro + * i386/intel/pmap.c (MAX_TBIS_SIZE): Drop unused macro. + +2016-08-16 Richard Braun + + Replace libc string functions with internal implementations + * Makefile.am (clib_routines): Remove memcmp, memcpy, memmove, + strchr, strstr and strsep. + * kern/strings.c (memset): Comment out. + (strchr, strsep, strstr): New functions. + + i386: import string functions from X15 and relicense to GPLv2+ + * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386/strings.c. + * i386/i386/strings.c: New file. + +2016-08-12 Richard Braun + + i386: request the boot loader to page-align modules + * i386/i386at/boothdr.S (MULTIBOOT_FLAGS): Set LSB bit. + +2016-08-07 Richard Braun + + VM: fix pageout-related deadlock + * vm/vm_map.c (_vm_map_entry_create): Temporarily set the current thread + as VM privileged. + +2016-08-06 Richard Braun + + Augment VM maps with task names + 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-29 Richard Braun + + Fix page fault in critical section in the slab allocator + * kern/slab.c (host_slab_info): Use wired kernel memory to build the + cache info. + + Fix locking error in the slab allocator + * 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-27 Richard Braun + + Fix locking error + * i386/i386/io_perm.c (no_senders): Remove bogus call to ip_lock. + +2016-06-17 Richard Braun + + Change page cache statistics + Instead of reporting statistics about unreferenced objects (the object + cache), report statistics about external objects (the page cache). + + * vm/vm_object.c (vm_object_cached_count): Remove variable. + (vm_object_cache_add): Remove object cache stats updates. + (vm_object_cache_remove): Likewise. + (vm_object_terminate): Update page cache stats. + * vm/vm_object.h (vm_object_cached_count): Remove variable. + (vm_object_cached_pages): Likewise. + (vm_object_cached_pages_lock_data): Likewise. + (vm_object_cached_pages_update): Remove macro. + (vm_object_external_count): New extern variable. + (vm_object_external_pages): Likewise. + * vm/vm_resident.c (vm_object_external_count): New variable. + (vm_object_external_pages): Likewise. + (vm_page_insert): Remove object cache stats updates and + update page cache stats. + (vm_page_replace): Likewise. + (vm_page_remove): Likewise. + * vm/vm_user.c (vm_cache_statistics): Report page cache stats instead + of object cache stats. + +2016-06-10 Samuel Thibault + + Allow setting x86 debug flags for the current thread + * kern/thread.c (thread_get_state): Allow call for the current thread, + without suspending it. + (thread_set_status): Likewise. + + Use int3 on x86_64 build too + * kern/debug.c (SoftDebugger) [__x86_64__]: Use int3 instruction to trigger + debugger. + +2016-06-09 Richard Braun + + Fix overflow checking on VM map copyin + * vm/vm_map (vm_map_copyin, vm_map_copyin_page_list): Check overflow + before page alignment of source data. + +2016-06-07 Richard Braun + + Fix deadlock + * vm/vm_map.c (vm_map_copyout_page_list): Fix call to + vm_map_find_entry_anywhere to avoid relocking VM map. + +2016-06-02 Richard Braun + + Fix some license headers. + 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-26 Samuel Thibault + + Fix buffer size passed to scsi_do_cmd + * linux/src/drivers/scsi/eata_dma_proc.c (eata_proc_info): Increase cmd size + to 12. + * linux/src/drivers/scsi/sd.c (do_sd_request, sd_init_done): Likewise. + * linux/src/drivers/scsi/sr.c (do_sr_request, sr_init_done): Likewise. + * linux/src/drivers/scsi/sr_ioctl.c (sr_ioctl): Likewise with sr_cmd. + + Cope with getc returning -1 + * i386/i386at/lpr.c (lprstart): Use int instead of char to store result of + getc, so as to return in case of getting -1. + + Fix potential divisal by zero + * kern/debug.c (panic, log): Pass 16 as default radix to _doprnt. + +2016-05-23 Samuel Thibault + + Fix getting ELF symbol bind and type + ddb/db_elf.c (elf_db_search_symbol): Use ELF32_ST_BIND and ELF32_ST_TYPE to + access symbol bind and type. + +2016-05-20 Richard Braun + + vm_map: back allocations with a red-black tree + This change augments VM maps with a gap tree, sorted by gap size, to + use for non-fixed allocations. + + * vm/vm_map.c: Include kern/list.h. + (vm_map_entry_gap_cmp_lookup, vm_map_entry_gap_cmp_insert, + vm_map_gap_valid, vm_map_gap_compute, vm_map_gap_insert_single, + vm_map_gap_remove_single, vm_map_gap_update, vm_map_gap_insert, + vm_map_gap_remove, vm_map_find_entry_anywhere): New functions. + (vm_map_setup): Initialize gap tree. + (_vm_map_entry_link): Call vm_map_gap_insert. + (_vm_map_entry_unlink): Call vm_map_gap_remove. + (vm_map_find_entry, vm_map_enter, vm_map_copyout, + vm_map_copyout_page_list, vm_map_copyin): Replace look up loop with + a call to vm_map_find_entry_anywhere. Call vm_map_gap_update and + initialize gap tree where relevant. + (vm_map_copy_insert): Turn macro into an inline function and rewrite. + (vm_map_simplify): Reorder call to vm_map_entry_unlink so that previous + entry is suitable for use with gap management functions. + * vm/vm_map.h: Include kern/list.h. + (struct vm_map_entry): New members `gap_node`, `gap_list`, + `gap_size` and `in_gap_tree`. + (struct vm_map_header): New member `gap_tree`. + +2016-05-20 Justus Winter + + xen: fix prototype + Amends a7f248bf. + + * xen/console.h (hypcnclose): Fix type of parameter. + +2016-05-18 Thomas Schwinge + + GNU Mach 1.7 + * version.m4 (AC_PACKAGE_VERSION): Set to 1.7. + * NEWS: Finalize for 1.7. + +2016-05-18 Samuel Thibault + + Fix gcc-6 warnings + * 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-05-17 Samuel Thibault + + Revert "Fix getting ELF symbol bind and type" + This reverts commit a8a52cafb5621b475737ffdc81f63703d5b37904. + + It seems to be breaking backtracing in ddb... + +2016-05-16 Richard Braun + + Fix pageout deadlock + The pageout daemon uses small, internal, temporary objects to transport + the data out to memory managers, which are expected to release the data + once written out to backing store. Releasing this data is done with a + vm_deallocate call. The problem with this is that vm_map is allowed to + merge these objects, in which case vm_deallocate will only remove a + reference instead of releasing the underlying pages, causing the pageout + daemon to deadlock. + + This change makes the pageout daemon mark these objects so that they + don't get merged. + + * vm/vm_object.c (vm_object_bootstrap): Update template. + (vm_object_coalesce): Don't coalesce if an object is used for pageout. + * vm/vm_object.h (struct vm_object): New `used_for_pageout` member. + * vm/vm_pageout.c (vm_pageout_page): Mark new objects for pageout. + +2016-05-15 Richard Braun + + Fix warning + ddb/db_output.c (db_printf): Return 0. + ddb/db_printf.h (db_printf): Change declaration to return an int. + +2016-04-21 Samuel Thibault + + Fix xen boot + * i386/i386/pcb.c (pcb_init): Make sure there is a thread before calling + current_task(). + +2016-04-20 Justus Winter + + Fix type of program counter argument + * i386/i386/hardclock.c (hardclock): Use '0' instead of 'NULL'. + * vm/vm_fault (vm_fault_cleanup): Likewise. + + xen: fix build + * i386/xen/xen.c (hypclock_machine_intr): Fix 'clock_interrupt' call. + * xen/time.c (clkstart): Likewise. + +2016-04-20 Samuel Thibault + + Add kernel profiling through sampling + * 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-17 Samuel Thibault + + Add memory barrier to spl* + * i386/i386/spl.S (mb): Define macro + (SETIPL, spl0, spl7): Call mb. + + Avoid using C99 for variable declaration for now + * kern/gsync.c (gsync_setup): Declare `i' variable out of for loop. + +2016-04-15 Samuel Thibault + + update NEWS file + +2016-04-15 Agustina Arzille + + Lightweight synchronization mechanism + * 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 + (setup_main): Call gsync_setup. + +2016-04-15 Justus Winter + + Update NEWS file + + Add --disable-assert flag to disable assertions + * configfrag.ac: Use 'AC_HEADER_ASSERT'. + + i386: Fix error handling + * i386/i386at/model_dep.c (i386at_init): Fix error handling. + +2016-04-05 Flavio Cruz + + Fix bootstraping issues with stdint.h. + * include/mach/std_types.h: Do not include stdint.h. + * kern/rdxtree.h: Replace sys/types.h with stdint.h. + +2016-04-04 Samuel Thibault + + Follow-up stdint use + 7bbfa39f59dcbc55b21d31abb9e2febef6a51ebb ('Use uint32_t instead of + unsigned32_t.') missed some Xen code + + * xen/net.c (recompute_checksum): Use stdint.h types. + * xen/time.c (hyp_get_stime): Likewise. + +2016-04-04 Flavio Cruz + + Use uint32_t instead of unsigned32_t. + Implement stdint.h and use it in gnumach. + + Remove old type definitions such as signed* and unsigned*. + + * Makefile.am: Add -ffreestanding. + * i386/i386/xen.h: Use uint64_t. + * i386/include/mach/i386/machine_types.defs: Use uint32_t and int32_t. + * i386/include/mach/i386/vm_types.h: Remove definitions of int*, uint*, + unsigned* and signed* types. + * i386/xen/xen.c: Use uint64_t. + * include/device/device_types.defs: Use uint32_t. + * include/mach/std_types.defs: Use POSIX types. + * include/mach/std_types.h: Include stdint.h. + * include/stdint.h: New file with POSIX types. + * include/sys/types.h: Include stdint.h. + * ipc/ipc_kmsg.c: Use uint64_t. + * kern/exception.c: Use uint32_t. + * linux/dev/include/linux/types.h: Remove POSIX types. + * xen/block.c: Use uint64_t. + * xen/net.c: Do not use removed unsigned*_t types. + * xen/ring.h: Use uint32_t instead. + * xen/store.c: Use uint32_t. + * xen/store.h: Use uint32_t. + * xen/time.c: Use POSIX types only. + * xen/time.h: Use uint64_t. + +2016-03-19 Samuel Thibault + + Make kernel mapping start address configurable + and move it to 16MiB by default to free 24bit DMA area + + * i386/configfrag.ac (--with-_START_MAP): Add option, default to 0x1000000. + * i386/Makefrag.am (_START_MAP): Set to $(_START_MAP). + (_START): Set to _START_MAP+0xC0000000. + +2016-03-19 Samuel Thibault + + Fix getting ELF symbol bind and type + ddb/db_elf.c (elf_db_search_symbol): Use ELF32_ST_BIND and ELF32_ST_TYPE to + access symbol bind and type. + +2016-03-13 Richard Braun + + Avoid panics on physical memory exhaustion + * vm/vm_resident (vm_page_grab_contig): Return NULL instead of calling + panic on memory exhaustion. + +2016-03-11 Samuel Thibault + + Ship missing files + Makefrag.am (libkernel_a_SOURCES): Add kern/log2.h. + (EXTRA_DIST): Add kern/exc.defs. + i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386at/elf.h. + +2016-03-11 Richard Braun + + Merge remote-tracking branch 'remotes/origin/rbraun/vm_cache_policy' + Finally ;-). + +2016-03-09 Richard Braun + + Fix stack allocation on Xen + Stack allocation on Xen can fail because of fragmentation. This change + makes stack allocation use the slab allocator. + + * kern/thread.c (thread_stack_cache): New global variable. + (stack_alloc): Use kmem_cache_alloc instead of vm_page_grab_contig. + (stack_collect): Use kmem_cache_free instead of vm_page_free_contig. + (kmem_cache_init): Initialize thread_stack_cache. + +2016-03-09 Richard Braun + + Relax slab allocation alignment constraint + * kern/slab.c (kmem_pagealloc_virtual): Pass alignment to function, + call kmem_alloc_aligned when greater than a page. + (kmem_pagealloc): Pass alignment to function. + (kmem_slab_create): Update call to kmem_pagealloc. + (kalloc): Likewise. + (kmem_cache_compute_properties): Fix handling of color with large slab + sizes. + (kmem_cache_init): Allow alignment greater than the page size. + +2016-03-06 Samuel Thibault + + Inherit fpu control word from parent to child + * i386/i386/thread.h (struct pcb): Add init_control field. + * i386/i386/fpu.h (fpinherit): New prototype. + * i386/i386/fpu.c (fpinit): Add thread parameter. When init_control field is + set, use that value instead of a hardcoded one. + (fpinherit): New function. + (fp_load): Pass thread parameter to fpinit(). + * kern/thread.c (thread_create): Pass parent task to pcb_init(). + * i386/i386/pcb.c (pcb_init): Add parent_task parameter, call fpinherit when + it is equal to current_task(). + +2016-02-28 Justus Winter + + ipc: add missing kernel object type + * ipc/ipc_object.c (ikot_print_array): Add entry for IKOT_PAGER_PROXY. + + doc: clarify memory object initialization + * doc/mach.texi: Mention another way how a memory manager can signal + that an object is ready. + + i386: add parts of cpu.h from x15 + * i386/Makefrag.am (libkernel_a_SOURCES): Add new file. + * i386/i386/cpu.h: New file. + +2016-02-26 Justus Winter + + include: avoid generating unused client stubs + * include/mach/mach.defs: Avoid generating unused client stubs, some + of which use an unreasonable amount of stack space and showed up in + compiler warnings. + +2016-02-26 Samuel Thibault + + Document thread_sleep about events woken from interrupt handlers + * kern/sched_prim.c (thread_sleep): Document case of events woken from + interrupt handlers. + + Document why code is not racy + * i386/i386at/kd_mouse.c (kd_mouse_read): Document why the + assert_wait/thread_block pair is not racy. + +2016-02-23 Justus Winter + + Include the exception protocol in 'gnumach.msgids' + * Makefrag.am: Include the exception protocol in 'gnumach.msgids'. + * kern/exc.defs: New file. + +2016-02-22 Richard Braun + + Remove kmem cache flags from the debugging interface + * include/mach_debug/slab_info.h (CACHE_FLAGS_NO_CPU_POOL, + CACHE_FLAGS_SLAB_EXTERNAL, CACHE_FLAGS_NO_RECLAIM, + CACHE_FLAGS_VERIFY, CACHE_FLAGS_DIRECT): Remove macros. + * kern/slab.c (host_slab_info): Pass raw cache flags to caller. + +2016-02-22 Richard Braun + + Fix slab allocator option handling + The slab allocator has grown to use multiple ways to allocate slabs + as well as track them, which got a little messy. One consequence is + the breaking of the KMEM_CF_VERIFY option. In order to make the code + less confusing, this change expresses all options as explicit cache + flags and clearly defines their relationships. + + The special kmem_slab and vm_map_entry caches are initialized + accordingly. + + * kern/slab.c (KMEM_CF_DIRECTMAP): Rename to ... + (KMEM_CF_PHYSMEM): ... this new macro. + (KMEM_CF_DIRECT): Restore macro. + (KMEM_CF_USE_TREE, KMEM_CF_USE_PAGE): New macros. + (KMEM_CF_VERIFY): Update value. + (kmem_pagealloc_directmap): Rename to... + (kmem_pagealloc_physmem): ... this new function. + (kmem_pagefree_directmap): Rename to ... + (kmem_pagefree_physmem): ... this new function. + (kmem_pagealloc, kmem_pagefree): Update macro names. + (kmem_slab_use_tree): Remove function. + (kmem_slab_create, kmem_slab_destroy): Update according to the new + cache flags. + (kmem_cache_compute_sizes): Rename to ... + (kmem_cache_compute_properties): ... this new function, and update + to properly set cache flags. + (kmem_cache_init): Update call to kmem_cache_compute_properties. + (kmem_cache_alloc_from_slab): Check KMEM_CF_USE_TREE instead of + calling the defunct kmem_slab_use_tree function. + (kmem_cache_free_to_slab): Update according to the new cache flags. + kmem_cache_free_verify): Add assertion. + (slab_init): Update initialization of kmem_slab_cache. + * kern/slab.h (KMEM_CACHE_DIRECTMAP): Rename to ... + (KMEM_CACHE_PHYSMEM): ... this new macro. + * vm/vm_map.c (vm_map_init): Update initialization of vm_map_entry_cache. + +2016-02-22 Richard Braun + + Optimize slab lookup on the free path + Caches that use external slab data but allocate slabs from the direct + physical mapping can look up slab data in constant time by associating + the slab data directly with the underlying page. + + * kern/slab.c (kmem_slab_use_tree): Take KMEM_CF_DIRECTMAP into account. + (kmem_slab_create): Set page private data if relevant. + (kmem_slab_destroy): Clear page private data if relevant. + (kmem_cache_free_to_slab): Use page private data if relevant. + * vm/vm_page.c (vm_page_init_pa): Set `priv' member to NULL. + * vm/vm_page.h (vm_page_set_priv, vm_page_get_priv): New functions. + +2016-02-22 Richard Braun + + Fix unused variable warnings + * kern/slab.c (slab_init): Remove unused variables. + +2016-02-20 Richard Braun + + Avoid slab allocation failures caused by memory fragmentation + Since the slab allocator has been changed to sit directly on top of the + physical allocator, failures caused by fragmentation have been observed, + as one could expect. This change makes the slab allocator revert to + kernel virtual memory when allocating larger-than-page slabs. This + solution is motivated in part to avoid the complexity of other solutions + such as page mobility, and also because a microkernel cannot be extended + to new arbitrary uncontrolled usage patterns such as a monolithic kernel + with loadable modules. As such, large objects are rare, and their use + infrequent, which is compatible with the use of kernel virtual memory. + + * kern/slab.c: Update module description. + (KMEM_CF_SLAB_EXTERNAL, KMEM_CF_VERIFY): Update values. + (KMEM_CF_DIRECT): Remove macro. + (KMEM_CF_DIRECTMAP): New macro. + (kmem_pagealloc_directmap, kmem_pagefree_directmap, + kmem_pagealloc_virtual, kmem_pagefree_virtual): New functions. + (kmem_pagealloc, kmem_pagefree, kmem_slab_create, kmem_slab_destroy, + kalloc, kfree): Update to use the new pagealloc functions. + (kmem_cache_compute_sizes): Update the algorithm used to determine slab + size and other cache properties. + (kmem_slab_use_tree, kmem_cache_free_to_slab, host_slab_info): Update to + correctly use the cache flags. + (slab_init): Add KMEM_CACHE_DIRECTMAP to the kmem_slab_cache init flags. + * kern/slab.h (KMEM_CACHE_VERIFY): Change value. + (KMEM_CACHE_DIRECTMAP): New macro. + * vm/vm_map.c (vm_map_init): Add KMEM_CACHE_DIRECTMAP to the + vm_map_entry_cache init flags. + +2016-02-16 Richard Braun + + Avoid panics on physical memory exhaustion + * vm/vm_resident (vm_page_grab): Return NULL instead of calling panic + on memory exhaustion. + +2016-02-14 Samuel Thibault + + Reduce VM_KERNEL_MAP_SIZE + Now that KMEM_MAP_SIZE (128MiB) has been removed. + + * i386/i386/vm_param.h (VM_KERNEL_MAP_SIZE): Decrease by 128MiB. + +2016-02-07 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: initialize external maps + * vm/vm_external.c (vm_external_create): Initialize allocated maps. + +2016-02-07 Richard Braun + + Fix page cache accounting + * vm/vm_object.c (vm_object_bootstrap): Set template object `cached' + member to FALSE. + (vm_object_cache_add, vm_object_cache_remove): New functions. + (vm_object_collect, vm_object_deallocate, vm_object_lookup, + vm_object_lookup_name, vm_object_destroy): Use new cache management functions. + (vm_object_terminate, vm_object_collapse): Make sure object isn't cached. + * vm/vm_object.h (struct vm_object): New `cached' member. + +2016-02-07 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: allocate a large map for all objects larger than SMALL_SIZE + * vm/vm_external.c (vm_external_create): Allocate a large map for all + objects larger than SMALL_SIZE. 'vm_external_state_{g,s}et' can deal + with offsets larger than 'LARGE_SIZE', so currently objects larger + than 'LARGE_SIZE' are missing out on the optimization. + + vm: remove unused field from struct vm_external + * vm/vm_external.h (struct vm_external): Remove unused field + 'existence_count'. + +2016-02-07 Richard Braun + + Remove kmem map + Now that the slab allocator doesn't use kernel virtual memory any more, + this map has become irrelevant. + + * kern/slab.c (KMEM_MAP_SIZE): Remove macro. + (kmem_map_store, kmem_map): Remove variables. + (slab_init): Remove call kmem_submap. + * kern/slab.h (kmem_map): Remove extern declaration. + +2016-02-06 Richard Braun + + Change computation of slab size + Allocating directly out of the physical memory allocator makes the slab + allocator vulnerable to failures due to fragmentation. This change makes + the slab allocator use the lowest possible size for its slabs to reduce + the chance of contiguous allocation failures. + + * kern/slab.c (KMEM_MIN_BUFS_PER_SLAB, KMEM_SLAB_SIZE_THRESHOLD): Remove + macros. + (kmem_cache_compute_sizes): Update the algorithm used to determine slab + size and other cache properties. + +2016-02-02 Richard Braun + + Fix various memory managment errors + A few errors were introduced in the latest changes. + + o Add VM_PAGE_WAIT calls around physical allocation attempts in case of + memory exhaustion. + o Fix stack release. + o Fix memory exhaustion report. + o Fix free page accounting. + + * kern/slab.c (kmem_pagealloc, kmem_pagefree): New functions + (kmem_slab_create, kmem_slab_destroy, kalloc, kfree): Use kmem_pagealloc + and kmem_pagefree instead of the raw page allocation functions. + (kmem_cache_compute_sizes): Don't store slab order. + * kern/slab.h (struct kmem_cache): Remove `slab_order' member. + * kern/thread.c (stack_alloc): Call VM_PAGE_WAIT in case of memory + exhaustion. + (stack_collect): Call vm_page_free_contig instead of kmem_free to + release pages. + * vm/vm_page.c (vm_page_seg_alloc): Fix memory exhaustion report. + (vm_page_setup): Don't update vm_page_free_count. + (vm_page_free_pa): Check page parameter. + (vm_page_mem_free): New function. + * vm/vm_page.h (vm_page_free_count): Remove extern declaration. + (vm_page_mem_free): New prototype. + * vm/vm_pageout.c: Update comments not to refer to vm_page_free_count. + (vm_pageout_scan, vm_pageout_continue, vm_pageout): Use vm_page_mem_free + instead of vm_page_free_count, update types accordingly. + * vm/vm_resident.c (vm_page_free_count, vm_page_free_count_minimum): + Remove variables. + (vm_page_free_avail): New variable. + (vm_page_bootstrap, vm_page_grab, vm_page_release, vm_page_grab_contig, + vm_page_free_contig, vm_page_wait): Use vm_page_mem_free instead of vm_page_free_count, + update types accordingly, don't set vm_page_free_count_minimum. + * vm/vm_user.c (vm_statistics): Likewise. + +2016-02-02 Richard Braun + + Fix unused variable warnings + * i386/i386at/biosmem.c (biosmem_bootstrap): Remove unused variables. + +2016-02-02 Richard Braun + + Stack the slab allocator directly on top of the physical allocator + In order to increase the amount of memory available for kernel objects, + without reducing the amount of memory available for user processes, + a new allocation strategy is introduced in this change. + + Instead of allocating kernel objects out of kernel virtual memory, + the slab allocator directly uses the direct mapping of physical + memory as its backend. This largely increases the kernel heap, and + removes the need for address translation updates. + + In order to allow this strategy, an assumption made by the interrupt + code had to be removed. In addition, kernel stacks are now also + allocated directly from the physical allocator. + + * i386/i386/db_trace.c: Include i386at/model_dep.h + (db_i386_reg_value): Update stack check. + * i386/i386/locore.S (trap_from_kernel, all_intrs, + int_from_intstack): Update interrupt handling. + * i386/i386at/model_dep.c: Include kern/macros.h. + (int_stack, int_stack_base): New variables. + (int_stack_high): Remove variable. + (i386at_init): Update interrupt stack initialization. + * i386/i386at/model_dep.h: Include i386/vm_param.h. + (int_stack_top, int_stack_base): New extern declarations. + (ON_INT_STACK): New macro. + * kern/slab.c: Include vm/vm_page.h + (KMEM_CF_NO_CPU_POOL, KMEM_CF_NO_RECLAIM): Remove macros. + (kmem_pagealloc, kmem_pagefree, kalloc_pagealloc, kalloc_pagefree): Remove + functions. + (kmem_slab_create): Allocate slab pages directly from the physical allocator. + (kmem_slab_destroy): Release slab pages directly to the physical allocator. + (kmem_cache_compute_sizes): Update the slab size computation algorithm to + return a power-of-two suitable for the physical allocator. + (kmem_cache_init): Remove custom allocation function pointers. + (kmem_cache_reap): Remove check on KMEM_CF_NO_RECLAIM. + (slab_init, kalloc_init): Update calls to kmem_cache_init. + (kalloc, kfree): Directly fall back on the physical allocator for big + allocation sizes. + (host_slab_info): Remove checks on defunct flags. + * kern/slab.h (kmem_slab_alloc_fn_t, kmem_slab_free_fn_t): Remove types. + (struct kmem_cache): Add `slab_order' member, remove `slab_alloc_fn' and + `slab_free_fn' members. + (KMEM_CACHE_NOCPUPOOL, KMEM_CACHE_NORECLAIM): Remove macros. + (kmem_cache_init): Update prototype, remove custom allocation functions. + * kern/thread.c (stack_alloc): Allocate stacks from the physical allocator. + * vm/vm_map.c (vm_map_kentry_cache, kentry_data, kentry_data_size): Remove + variables. + (kentry_pagealloc): Remove function. + (vm_map_init): Update calls to kmem_cache_init, remove initialization of + vm_map_kentry_cache. + (vm_map_create, _vm_map_entry_dispose, vm_map_copyout): Unconditionnally + use vm_map_entry_cache. + * vm/vm_map.h (kentry_data, kentry_data_size, kentry_count): Remove extern + declarations. + * vm/vm_page.h (VM_PT_STACK): New page type. + * device/dev_lookup.c (dev_lookup_init): Update calls to kmem_cache_init. + * device/dev_pager.c (dev_pager_hash_init, device_pager_init): Likewise. + * device/ds_routines.c (mach_device_init, mach_device_trap_init): Likewise. + * device/net_io.c (net_io_init): Likewise. + * i386/i386/fpu.c (fpu_module_init): Likewise. + * i386/i386/machine_task.c (machine_task_module_init): Likewise. + * i386/i386/pcb.c (pcb_module_init): Likewise. + * i386/intel/pmap.c (pmap_init): Likewise. + * ipc/ipc_init.c (ipc_bootstrap): Likewise. + * ipc/ipc_marequest.c (ipc_marequest_init): Likewise. + * kern/act.c (global_act_init): Likewise. + * kern/processor.c (pset_sys_init): Likewise. + * kern/rdxtree.c (rdxtree_cache_init): Likewise. + * kern/task.c (task_init): Likewise. + * vm/memory_object_proxy.c (memory_object_proxy_init): Likewise. + * vm/vm_external.c (vm_external_module_initialize): Likewise. + * vm/vm_fault.c (vm_fault_init): Likewise. + * vm/vm_object.c (vm_object_bootstrap): Likewise. + * vm/vm_resident.c (vm_page_module_init): Likewise. + (vm_page_bootstrap): Remove initialization of kentry_data. + +2016-01-30 Richard Braun + + Fix early page allocation on Xen + The Xen target was completely ignored when porting the biosmem and + vm_page physical memory allocators. Let's fix this. + + * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386at/biosmem.{c,h}. + * i386/i386/vm_page.h (VM_PAGE_MAX_SEGS, VM_PAGE_DIRECTMAP_LIMIT, + VM_PAGE_HIGHMEM_LIMIT): Define for Xen. + * i386/i386at/biosmem.c: Include mach/xen.h. + (biosmem_panic_setup_msg): Comment out for Xen since it's unused. + (biosmem_map_build, biosmem_map_build_simple, + biosmem_save_cmdline_sizes, biosmem_find_boot_data_update, + biosmem_find_boot_data, biosmem_setup_allocator): Likewise. + (biosmem_bootstrap_common): New function. + (biosmem_xen_bootstrap): Likewise, for Xen. + (biosmem_bootalloc): Perform bottom-up allocations for Xen. + * i386/i386at/biosmem.h (biosmem_xen_bootstrap): New prototype, for Xen. + * i386/i386at/model_dep.c (i386at_init): Call biosmem_xen_bootstrap instead + of biosmem_bootstrap on Xen. + * i386/include/mach/i386/vm_types.h (phys_addr_t): Define as an unsigned + 64-bits integer when PAE is enabled. + +2016-01-29 Samuel Thibault + + Disable probing legacy IDE when AHCI driver works + * linux/src/drivers/block/ide.c (default_io_base): Do not qualify const. + (ide_disable_base): New function. + * linux/dev/include/linux/blk.h (ide_disable_base): New declaration. + * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Call ide_disable_base + with each I/O BAR of the AHCI PCI card. + + Use PCI macros + * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Use + PCI_BASE_ADDRESS_SPACE_IO and PCI_BASE_ADDRESS_MEM_MASK macros instead of + hardcoded values. + + ahci: print PCI bus/dev/fun in hexadecimal + * linux/dev/drivers/block/ahci.c: Print PCI bus/dev/fun number in + hexadecimal + +2016-01-29 Samuel Thibault + + Fallback on direct PCI access when no BIOS32 is available + Some hardware start shippping with no BIOS32 at all, and we'll have to + implement ACPI to get the address of the mmconfig table. In the meanwhile, + we can hope that the direct probe works (it does on HP820 for instance). + + * linux/src/arch/i386/kernel/bios32.c (pcibios_init): Also try + check_direct_pci() when bios32 probing failed. + +2016-01-23 Richard Braun + + Merge branch 'rbraun/vm_page' + +2016-01-23 Richard Braun + + Use vm_page as the physical memory allocator + This change replaces the historical page allocator with a buddy allocator + implemented in vm/vm_page.c. This allocator allows easy contiguous allocations + and also manages memory inside segments. In a future change, these segments + will be used to service requests with special constraints, such as "usable + for 16-bits DMA" or "must be part of the direct physical mapping". + + * Makefrag.am (libkernel_a_SOURCES): Add vm/vm_page.c. + * i386/Makefrag.am (libkernel_a_SOURCES): Add i386/i386at/biosmem.{c,h}. + * i386/i386/vm_param.h: Include kern/macros.h. + (VM_PAGE_DMA_LIMIT, VM_PAGE_MAX_SEGS, VM_PAGE_DMA32_LIMIT, + VM_PAGE_DIRECTMAP_LIMIT, VM_PAGE_HIGHMEM_LIMIT, VM_PAGE_SEG_DMA, + VM_PAGE_SEG_DMA32, VM_PAGE_SEG_DIRECTMAP, VM_PAGE_SEG_HIGHMEM): New macros. + * i386/i386at/model_dep.c: Include i386at/biosmem.h. + (avail_next, avail_remaining): Remove variables. + (mem_size_init): Remove function. + (i386at_init): Initialize and use the biosmem module for early physical + memory management. + (pmap_free_pages): Return phys_last_addr instead of avail_remaining. + (init_alloc_aligned): Turn into a wrapper for biosmem_bootalloc. + (pmap_grab_page): Directly call init_alloc_aligned instead of pmap_next_page. + * i386/include/mach/i386/vm_types.h (phys_addr_t): New type. + * kern/bootstrap.c (free_bootstrap_pages): New function. + (bootstrap_create): Call free_bootstrap_pages instead of vm_page_create. + * kern/cpu_number.h (CPU_L1_SIZE): New macro. + * kern/slab.h: Include kern/cpu_number.h. + (CPU_L1_SIZE): Remove macro, moved to kern/cpu_number.h. + * kern/startup.c (setup_main): Change the value of machine_info.memory_size. + * linux/dev/glue/glue.h (alloc_contig_mem, free_contig_mem): Update prototypes. + * linux/dev/glue/kmem.c (linux_kmem_init): Don't use defunct page queue. + * linux/dev/init/main.c (linux_init): Don't free unused memory. + (alloc_contig_mem, free_contig_mem): Turn into wrappers for the vm_page + allocator. + * linux/pcmcia-cs/glue/ds.c (PAGE_SHIFT): Don't undefine. + * vm/pmap.h (pmap_startup, pmap_next_page): Remove prototypes. + * vm/vm_fault.c (vm_fault_page): Update calls to vm_page_convert. + * vm/vm_init.c (vm_mem_init): Call vm_page_info_all. + * vm/vm_object.c (vm_object_page_map): Update call to vm_page_init. + * vm/vm_page.h (vm_page_queue_free): Remove variable declaration. + (vm_page_create, vm_page_release_fictitious, vm_page_release): Remove + declarations. + (vm_page_convert, vm_page_init): Update prototypes. + (vm_page_grab_contig, vm_page_free_contig): New prototypes. + * vm/vm_resident.c (vm_page_template, vm_page_queue_free, + vm_page_big_pagenum): Remove variables. + (vm_page_bootstrap): Update and call vm_page_setup. + (pmap_steal_memory): Update and call vm_page_bootalloc. + (pmap_startup, vm_page_create, vm_page_grab_contiguous_pages): Remove functions. + (vm_page_init_template, vm_page_grab_contig, + vm_page_free_contig): New functions. + (vm_page_init): Update and call vm_page_init_template. + (vm_page_release_fictitious): Make static. + (vm_page_more_fictitious): Update call to vm_page_init. + (vm_page_convert): Rewrite to comply with vm_page. + (vm_page_grab): Update and call vm_page_alloc_pa. + (vm_page_release): Update and call vm_page_free_pa. + +2016-01-23 Richard Braun + + Import the vm_page module from X15 and relicense to GPLv2+ + * vm/vm_page.c: New File. + * vm/vm_page.h: Merge vm_page.h from X15. + (struct vm_page): New members: node, type, seg_index, order, + vm_page_header. Turn phys_addr into a phys_addr_t. + + Import the biosmem module from X15 and relicense to GPLv2+ + * i386/i386at/biosmem.c: New file. + * i386/i386at/biosmem.h: Likewise. + + Import the multiboot module from X15 and relicense to GPLv2+ + * i386/include/mach/i386/multiboot.h: Merge multiboot.h from X15. + + Import the elf module from X15 and relicense to GPLv2+ + * i386/i386at/elf.h: New file. + + Import the log2 module from X15 and relicense to GPLv2+ + * kern/log2.h: New file. + +2016-01-14 Samuel Thibault + + Fix build with gcc-6 + * linux/src/include/linux/compiler-gcc6.h: New file. + +2016-01-13 Samuel Thibault + + Increase kernel map size + To avoid running out of memory due to the increased consumption by radix + trees which replaced arrays. + + * kern/slab.c (KMEM_MAP_SIZE): Bump from 96MiB to 128MiB. + * i386/i386/vm_param.h (VM_KERNEL_MAP_SIZE): Add 32MiB accordingly. + +2016-01-02 Richard Braun + + Completely disable strict aliasing + * Makefile.am (AM_CFLAGS): Add -fno-strict-aliasing. + + Fix object page list type + * vm/vm_object.h (struct vm_object): Use queue_head_t instead of + queue_chain_t as the page list type. + +2016-01-02 Flavio Cruz + + replace extern with static in some linux code + * linux/dev/include/linux/fs.h: Replace extern with static. + * linux/dev/include/linux/locks.h: Likewise. + * linux/dev/include/linux/mm.h: Likewise. + * linux/src/drivers/net/e2100.c: Likewise + * linux/src/include/asm-i386/termios.h: Likewise. + * linux/src/include/linux/interrupt.h: Likewise. + * linux/src/include/net/route.h: Likewise. + * linux/src/include/net/sock.h: Likewise. + + fix t_addr assignment in lpropen + * i386/i386at/lpr.c (lpropen): Fix assignment to t_addr. + +2016-01-01 Flavio Cruz + + remove unnused disk code and headers + * i386/Makefrag.am: Remove disk.h. + * i386/i386at/disk.h: Remove unnused definitions. + * i386/include/mach/i386/disk.h: Remove. + * linux/dev/glue/block.c (device_get_status): Remove V_GETPARMS case. + + fix some compiler warnings in gnumach + * linux/dev/glue/block.c (out): Cast to device_t. + * linux/dev/init/main.c (alloc_contig_mem): Initialize addr and cast return value to void *. + * i386/i386/phys.c (pmap_copy_page): Initialize src_map. + * i386/intel/pmap.c: Include i386at/model_dep.h. + * kern/mach_clock.c (mapable_time_init): Cast to void *. + +2016-01-01 Richard Braun + + Slightly improve map debugging readability + * vm/vm_object.c (vm_object_print): Break line so all debugging output fits + in a page. + +2015-12-29 Richard Braun + + Improve map debugging readability + * vm/vm_map.c (vm_map_print): Reduce indentation, break lines earlier. + (vm_map_copy_print): Likewise. + * vm/vm_object.c (vm_object_print): Likewise. + + Improve VM map debugging + * vm/vm_map.c (vm_map_print): Update arguments to conform to ddb + protocol. + * vm/vm_print.h (vm_map_print): Likewise for prototype. + + Fix vm_map_copyout + * vm/vm_map.c (vm_map_copyout): Reinitialize copy map red-black tree. + +2015-12-11 Samuel Thibault + + Fix boot under kvm in linux 4.3 + * i386/i386/locore.S (discover_x86_cpu_type): Disable Cyrix CPU discovery. + +2015-11-29 Samuel Thibault + + Nicer out of memory condition reporting + * vm/vm_object.c (_vm_object_allocate): Return 0 immediately when + kmem_cache_alloc returned 0. + (vm_object_allocate): Panic when _vm_object_allocate returns 0. + +2015-11-27 Samuel Thibault + + Fix wired accounting + * vm/vm_map.c (vm_map_pageable_common): Put back wired_count decrementation + into user_wired_count test. + + Fix ahci unit MAX_PORTS check + * linux/dev/drivers/block/ahci.c (ahci_do_request): Fix checking unit + against MAX_PORTS. + + Fix bound + * i386/i386at/lpr.c (lprprobe): Fix checking unit against NLPR. + + Fix missing format in printk + * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Add missing format. + +2015-10-31 Thomas Schwinge + + GNU Mach 1.6 + * version.m4 (AC_PACKAGE_VERSION): Set to 1.6. + * NEWS: Finalize for 1.6. + +2015-10-31 Thomas Schwinge + + Rework *.msgids handling when neither client nor server stubs are required + Originally added in commit 255c47e669819f153c722c98a230f6fe4e6ece08, but "make + distcheck" didn't like that: + + [...] + ERROR: files left in build directory after distclean: + ./ipc/notify.msgids + Makefile:7489: recipe for target 'distcleancheck' failed + make[1]: *** [distcleancheck] Error 1 + make[1]: Leaving directory '[...]/gnumach/release.build/gnumach-1.5/_build/sub' + Makefile:7416: recipe for target 'distcheck' failed + make: *** [distcheck] Error 1 + + Instead of special-casing that, generalize the Makefile rules. + + * Makefrag.am (nodist_lib_dep_tr_for_defs_a_SOURCES): Add + ipc/notify.none.defs.c. + (nodist_libkernel_a_SOURCES): Add ipc/notify.none.msgids. + (gnumach.msgids): Remove ipc/notify.msgids prerequisite. + * Makerules.mig.am (%.msgids): Remove rule, and instead... + (%.none.defs.c, %.none.msgids): ... add these rules. + +2015-10-05 Justus Winter <4winter@informatik.uni-hamburg.de> + + Update NEWS file + +2015-10-05 Samuel Thibault + + Fix time going back in Xen case + when backward time correction happens to get bigger than the tick duration. + + * kern/mach_clock.c (clock_interrupt): When `tickdelta' is bigger than `usec', + truncate it to `usec-1'. + +2015-10-05 Joshua Branson + + Add generated mach documentation files to gitignore + * .gitignore: Add doc/mach.aux doc/mach.cp doc/mach.cps doc/mach.fn + doc/mach.fns doc/mach.ky doc/mach.log doc/mach.pdf doc/mach.pg doc/mach.toc + doc/mach.tp doc/mach.vr. + +2015-09-29 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern/slab: print total used and reclaimable memory + * kern/slab.c (_slab_info): Print total used and reclaimable memory. + + kern/slab: include flags in the slab information + * kern/slab.c (_slab_info): Include flags in the slab information. + + ddb: fix line formatting + * ddb/db_output.c (db_putchar): Fix off-by-one, allowing one more + character to be printed before the newline is inserted. + + ddb: add new command `show slabinfo' + * ddb/db_command.c (db_show_cmds): Add `slabinfo'. + * kern/slab.c (slab_info): Generalize so that it can be used with + different printf-like functions, and turn it into a static function. + (slab_info): New wrapper retaining the old behaviour. + (db_show_slab_info): New wrapper that uses `db_printf' instead. + * kern/slab.h (db_show_slab_info): New declaration. + +2015-09-27 Justus Winter <4winter@informatik.uni-hamburg.de> + + i386: trace syscalls of a single task + * i386/i386/debug_i386.c (syscall_trace_task): New variable. + (syscall_trace_print): If set, trace only syscalls from this task. + + i386: improve syscall tracing + * kern/syscall_sw.h (mach_trap_t): Turn unused field into `mach_trap_name'. + (MACH_TRAP, MACH_TRAP_STACK): Record name. + * i386/i386/debug_i386.c (syscall_trace_print): Use the name and + format the arguments to look like c. + + Fix build with -DDEBUG + * device/cirbuf.c: Add missing include. + * i386/i386/debug.h (dump_ss): Hide declaration from assembler. + * i386/i386/debug_i386.c: Fix include. + * kern/sched_prim.h: Add missing include, fix declaration. + + kern/bootstrap: drop into the debugger + * kern/bootstrap.c (boot_script_prompt_task_resume): Drop into the + debugger instead of merely waiting for return using `safe_gets', which + disables interrupts, making it impossible to break into the debugger + using the magic keys. + +2015-09-19 Flávio Cruz + + Add macros to convert between time_value_t and timespec + * include/mach/time_value.h (TIME_VALUE_TO_TIMESPEC, + TIMESPEC_TO_TIME_VALUE): New macros + +2015-09-07 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: use proper memory fences when handling the mapped time + * 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. + +2015-09-07 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: fix loop reading the time value + 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. + +2015-09-07 Rik van Riel + + commit fce798016c4bd2be89b86b0d343ab54505409412 + [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. + +2015-08-31 Samuel Thibault + + Reserve 64k at beginning of memory, not just 4k + 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. + +2015-08-30 James Clarke + + Fix printk not handling ANSI escape codes + * 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. + +2015-08-28 Flávio Cruz + + Make sure the reply port's reference is released when the thread needs to be 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. + +2015-08-28 Flávio Cruz + + Add a thread_no_continuation definition + 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. + +2015-08-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern/bootstrap: tune locking + * kern/bootstrap.c (boot_script_exec_cmd): Avoid holding the lock + across the call to `thread_create'. + + i386: enable assertions + * i386/intel/pmap.c (pmap_page_protect): Enable assertions. + (phys_attribute_clear, phys_attribute_test): Likewise. + + kern: really zero-out unused simple lock info entries + * kern/lock.c (simple_unlock): Really zero-out unused simple lock info + entries. + +2015-08-18 Justus Winter <4winter@informatik.uni-hamburg.de> + + i386: fix panic message + * i386/intel/pmap.c (pmap_page_protect): Fix function name in panic + message. + + vm: collapse unreachable branch into assertion + * vm/vm_object.c (vm_object_collapse): Collapse unreachable branch + into assertion. + +2015-08-17 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: keep track of the writer when debugging locks + * 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. + +2015-08-17 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: improve simple lock debugging + 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. + +2015-08-17 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: disable the simple lock checks while debugging + * 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. + +2015-08-15 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: fix compiler warning + * vm/vm_user.c (vm_wire): Drop unused but set variable `host'. + + vm: enable extra assertions + * vm/vm_fault.c (vm_fault_page): Enable extra assertions. + + Avoid re-defining macros + * kern/macros.h: Avoid re-defining macros. + * linux/src/include/linux/compiler-gcc.h: Likewise. + * linux/src/include/linux/compiler.h: Likewise. + +2015-07-25 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: add boot-time clock, use it for time stamps + 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. + +2015-07-25 Justus Winter <4winter@informatik.uni-hamburg.de> + + include: provide time-value substraction + * 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. + + kern/lock: make sure the macros are only used on simple locks + * 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. + + Disable the kernel tracing system XPR + * configfrag.ac (XPR_DEBUG): Disable tracing system. + + ipc/space: inline reference counting + * ipc/ipc_space.h (is_{reference,release}): Use the macro variant. + + Make sure the field offsets are updated + * Makerules.am: Make sure the field offsets are updated. + +2015-07-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern/bootstrap: deallocate thread + 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. + +2015-07-19 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern/bootstrap: deallocate task + * kern/bootstrap.c (boot_script_free_task): Deallocate task. + +2015-07-18 Justus Winter <4winter@informatik.uni-hamburg.de> + + linux/net: fix build with -O0 + * linux/src/drivers/net/pci-scan.c: Avoid #erroring out. + +2015-07-18 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern/printf: do not serialize printf and co + 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'. + +2015-07-18 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern/lock: use compiler built-in functions to get return address + * 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: fix locking + * kern/bootstrap.c (boot_script_exec_cmd): Add missing unlock. + (user_bootstrap): Likewise. + + kern/slab: fix locking + * kern/slab.c (host_slab_info): Fix locking. + +2015-07-15 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: use a general lock to protect IPC spaces + 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. + +2015-07-15 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: fix the locking of the IPC entry allocation functions + * 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. + + i386: fix typo + * i386/intel/pmap.c: Fix typo. + +2015-07-12 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: avoid kmem_alloc + * ipc/ipc_table.c (ipc_table_alloc): Unconditionally use `kalloc'. + (ipc_table_free): Unconditionally use `kfree'. + +2015-07-12 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: really fix traversing the list of inactive pages + Previously, the pageout code traversed the list of pages in an object + instead of the list of inactive pages. + + * vm/vm_pageout.c (vm_pageout_scan): Fix traversing the list of + inactive pages. + +2015-07-11 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: make sure the queue macros are only used on queues + 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. + +2015-07-11 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: fix traversing the list of inactive pages + Previously, the pageout code traversed the hash table chain instead of + the list of inactive pages. The code merely compiled by accident, + because the `struct page' also has a field called `next' for the hash + table chain. + + * vm/vm_pageout.c (vm_pageout_scan): Fix traversing the list of + inactive pages. + +2015-07-10 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: drop debugging remnants + * vm/vm_object.c (vm_object_terminate): Drop debugging remnants. + + kern: make printf handle long long integers + * Makefile.am (clib_routines): Steal `__umoddi3'. + * kern/printf.c (MAXBUF): Increase size. + (printnum, _doprnt): Handle long long integers. + * kern/printf.h (printnum): Adjust declaration. + +2015-07-09 Justus Winter <4winter@informatik.uni-hamburg.de> + + vm: fix panic message + * vm/vm_kern.c (kmem_init): Fix panic message. + + i386: fix line wrapping in the immediate console + * i386/i386at/immc.c (immc_cnputc): Fix line wrapping. + + kern: remove superfluous file + * kern/server_loop.ch: Remove superfluous file. + + kern: improve error handling + * kern/bootstrap.c (boot_script_exec_cmd): Improve error handling. + +2015-07-09 Samuel Thibault + + Allow non-privileged tasks to wire 64KiB task memory + * doc/mach.texi (vm_wire): Document that the host port does not have to be + privileged. + * include/mach/mach_hosts.defs (vm_wire): Use mach_port_t instead of + host_priv_t. + * vm/vm_map.h (vm_map): Add user_wired field. + * vm/vm_map.c (vm_map_setup): Initialize user_wired field to 0. + (vm_map_pageable_common, vm_map_entry_delete, vm_map_copy_overwrite, + vm_map_copyout_page_list, vm_map_copyin_page_list): When switching + user_wired_count field of entry between 0 and non-0, accumulate the + corresponding size into the user_wired field of map. + * vm/vm_user.c (vm_wire): Turn host parameter into port parameter, and + inline a version of convert_port_to_host_priv which records whether the host + port is privileged or not. When it is not privileged, check whether + the additional amount to user_wired will overcome 64KiB. + +2015-07-07 Samuel Thibault + + Fix build with -O0 + * linux/src/include/linux/string.h (strcpy, strncpy, strcat, strncat, + strchr, strrchr, strlen, strnlen, strcmp, strncmp, memmove, + memscan): Comment out extern declarations. + * linux/dev/include/asm-i386/string.h (strcpy, strncpy, strcat, strncat, + strcmp, strncmp, strchr, strrchr, strlen, __memcpy, __constant_memcpy, + memmove, memchr, __memset_generic, __constant_c_memset, strnlen, + __constant_c_and_count_memset, memscan): Turn extern inline into static + inline. + * linux/dev/include/linux/fs.h (mark_buffer_uptodate): Likewise. + * linux/src/include/asm-i386/bitops.h (set_bit, clear_bit, change_bit, + test_and_set_bit, test_and_clear_bit, test_and_change_bit, test_bit, + find_first_zero_bit, find_next_zero_bit, ffz, ffs): Likewise. + * linux/src/include/asm-i386/io.h (virt_to_phys, phys_to_virt, __out##s, + __in##s, ins##s, outs##s): Likewise. + * linux/src/include/asm-i386/semaphore.h (down, down_interruptible, up): + Likewise. + * linux/src/include/asm-i386/segment.h [!__OPTIMIZE]: Emit an ud2 instruction + instead of an undefined reference. + +2015-07-05 Samuel Thibault + + Add missing distributed file + * Makefrag.am (EXTRA_DIST): Add ipc/notify.defs. + +2015-06-30 Justus Winter <4winter@informatik.uni-hamburg.de> + + Fix re-configuring out-of-tree builds + Previously, running `../configure ...' to reconfigure an out-of-tree + build would link `machine' to `i386/i386' instead of `../i386/i386' + (i.e. point to the build directory instead to the source) if + `i386/i386' also exists in the build directory because of a previous + build. + + * configfrag.ac: Prefix machine link target with `$srcdir'. + +2015-06-30 Samuel Thibault + + Fix restoring interrupts on timeout + * linux/dev/drivers/block/ahci.c (ahci_identify): Restore flags before + returning on timeout. + +2015-06-29 Samuel Thibault + + Print about powered-down AHCI ports + * linux/dev/drivers/block/ahci.c (ahci_probe_dev): Print messages when + device is present but powered down. + +2015-06-28 Justus Winter <4winter@informatik.uni-hamburg.de> + + ddb: automatically display stack traces + * ddb/db_trap.c (db_task_trap): Automatically display stack traces if + an unexpected trap occurs. + +2015-06-28 Justus Winter <4winter@informatik.uni-hamburg.de> + + i386: improve the immediate console + Improve the immediate console to the point that it can be enabled and + display e.g. assertion failures from very early on (i.e. from + `c_boot_entry'). + + * device/cons.h (romgetc, romputc): New declarations. + * i386/configfrag.ac: Add configuration variable. + * i386/i386at/conf.c (dev_name_list): Add entry. + * i386/i386at/cons_conf.c (constab): Add entry. + * i386/i386at/immc.c: Add missing includes. + (immc_cnprobe, immc_cninit, immc_cngetc, immc_romputc): New functions. + (immc_cnputc): Fix signature, use virtual addresses. + * i386/i386at/immc.h: New file. + * i386/i386at/kd.c: Use `#if ENABLE_IMMEDIATE_CONSOLE'. + * i386/i386at/kd.h (kd_setpos): Add missing declaration. + * i386/i386at/model_dep.c (c_boot_entry): Install immediate console as + early boot console. + +2015-06-26 Justus Winter <4winter@informatik.uni-hamburg.de> + + i386: add comment + * i386/i386at/model_dep.c (rebootflag): Explain flag. + +2015-06-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: fix 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. + +2015-06-09 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: add function attributes to the printf-functions + * kern/printf.h (sprintf, snprintf, vsnprintf, printf): Add the + `printf' function attribute that allows the compiler to check the + format strings and arguments. + +2015-06-05 Flávio Cruz + + Fix typo + * vm/vm_kern.c (kmem_alloc_aligned): Fix typo. + + Use custom port macros. + * ipc/ipc_port.c (ipc_port_alloc_special): Use ip_alloc and ip_lock_init + macros instead of manually inlining them. + +2015-05-31 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: fix typo + * ipc/notify.defs: Fix typo. + + Include the notify protocol in `gnumach.msgids' + * 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. + +2015-05-29 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: fix argument handling + 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. + +2015-05-23 Justus Winter <4winter@informatik.uni-hamburg.de> + + Restrict `-fno-strict-aliasing' to the Linux drivers + * Makefile.am: Move `-fno-strict-aliasing'... + * linux/Makefrag.am: ... here. + + i386: avoid breaking the strict-aliasing rules + * i386/i386/pcb.c (switch_ktss): Cleanly convert the value. + + kern: avoid breaking the strict-aliasing rules + * kern/exception.c (exception_parse_reply): Use `BAD_TYPECHECK'. + + vm: drop unused `kmem_realloc' + * vm/vm_kern.c (kmem_realloc): Remove function. + (kmem_alloc_wired): Adopt comment. + * vm/vm_kern.h (kmem_realloc): Remove declaration. + +2015-05-23 Samuel Thibault + + Add stdint integer types in Linux glue + * linux/dev/include/linux/types.h (int8_t, uint8_t, int16_t, uint16_t, + int32_t, uint32_t, int64_t, uint64_t): New types. + +2015-05-22 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: drop remnants of the IPC tables + * 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: drop size parameter from `ipc_space_create' + * 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-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: inline key ipc entry lookup functions + 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-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: replace the IPC table with a radix tree + 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-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: replace reverse hash table with a radix tree + 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-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + ipc: undo manual inlining of `ipc_entry_X' functions + 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-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: add radix tree library + 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-20 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: gracefully handle resource shortage + * 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. + + vm: gracefully handle resource shortage + * vm/vm_object.c (vm_object_copy_call): Gracefully handle resource + shortage by doing the allocation earlier and aborting the function if + unsuccessful. + + kern: gracefully handle resource shortage + * kern/task.c (task_create): Gracefully handle resource shortage. + +2015-05-19 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: import `macros.h' from x15 + 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-17 Justus Winter <4winter@informatik.uni-hamburg.de> + + i386: avoid compiler warning + * 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-14 Justus Winter <4winter@informatik.uni-hamburg.de> + + i386: use macro to compute address of saved registers + * i386/i386/pcb.c (stack_attach): Use `USER_REGS'. + (stack_handoff): Likewise. + +2015-05-02 Samuel Thibault + + Fix semaphore failure path special calling convention + * 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-02 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: fix comment + * kern/rbtree.h: Fix comment. + +2015-05-02 Samuel Thibault + + Fix warning + * i386/i386at/rtc.c (rtcget, rtcput): Make functions take an rtc_st + structure which it casts to char * itself. + + Fix warnings + * 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*. + + Fix block_io_mmap prototype + * device/blkio.c (block_io_mmap): Fix prototype of dummy function. + * device/blkio.h (block_io_mmap): Likewise. + +2015-05-01 Samuel Thibault + + Use gnu89 inline style + * Makefile.am (AM_CFLAGS): Add -fgnu89-inline option. + +2015-05-01 Samuel Thibault + + Replace clobbers with earlyclobbers + 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-30 Samuel Thibault + + Fix build with gcc-5 + * linux/src/include/linux/compiler-gcc5.h: New file. + +2015-04-24 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: avoid hardcoding the lowest priority + 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-23 Justus Winter <4winter@informatik.uni-hamburg.de> + + kern: disable stack allocation counters by default + 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-23 Samuel Thibault + + Avoid accessing ip_protected_payload without the lock. + * 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. + + Prepend 0x to hexadecimal offset + * i386/i386/db_trace.c (db_i386_stack_trace): Prepend 0x to hexadecimal offset. + 2015-04-10 Thomas Schwinge GNU Mach 1.5. @@ -3313,6 +5981,31 @@ Increase kernel map entry pool size * vm/vm_map.h (KENTRY_DATA_SIZE): Set to 256 pages. +2013-10-09 Richard Braun + + VM cache policy change + This patch lets the kernel unconditionnally cache non empty unreferenced + objects instead of using a fixed arbitrary limit. As the pageout daemon + evicts pages, it collects cached objects that have become empty. The + effective result is a graceful adjustment of the number of objects + related to memory management (virtual memory objects, their associated + ports, and potentially objects maintained in the external memory + managers). Physical memory can now be almost entirely filled up with + cached pages. In addition, these cached pages are not automatically + deactivated as objects can quickly be referenced again. + + There are problems with this patch however. The first is that, on + machines with a large amount of physical memory (above 1 GiB but it also + depends on usage patterns), scalability issues are exposed. For example, + file systems which don't throttle their writeback requests can create + thread storms, strongly reducing system responsiveness. Other issues + such as linear scans of memory objects also add visible CPU overhead. + + The second is that, as most memory is used, it increases the chances of + swapping deadlocks. Applications that map large objects and quickly + cause lots of page faults can still easily bring the system to its + knees. + 2013-09-28 Samuel Thibault Add files missing in distrib tarball