aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ddb: Print scheduling information.Justus Winter2017-08-052-7/+41
| | | | | | | | | | * ddb/db_print.c (OPTION_SCHED): New macro. (db_print_thread): Display scheduling information if the flag is given. (db_print_task): Adapt. (db_show_all_threads): Parse new modifier. (db_show_one_thread): Likewise. * doc/mach.texi: Document the new flag.
* doc: Document 'show all tasks'.Justus Winter2017-08-051-0/+4
|
* kern: Fix reporting the minimum quantum used for scheduling.Justus Winter2017-08-051-2/+3
| | | | | * kern/host.c (host_info): Scale 'min_quantum' by 'tick', then convert to milliseconds.
* Steal '__divdi3'.Justus Winter2017-08-051-0/+1
| | | | * Makefile.am (clib_routines): Steal '__divdi3' from the gcc runtime.
* i386: Make function static.Justus Winter2017-08-052-7/+1
| | | | | * i386/intel/pmap.c (pmap_remove_range): Make function static. * i386/intel/pmap.h (pmap_remove_range): Remove declaration.
* Fix year computationSamuel Thibault2017-06-101-1/+3
| | | | * i386/i386at/rtc.c (readtodc): Do not spuriously add 70 to the year.
* Fix Epoch computationSamuel Thibault2017-06-101-2/+8
| | | | | | * i386/i386at/rtc.c (CENTURY_START): New macro. (readtodc): Use CENTURY_START instead of assuming it is equal to 1970, and set yr to an absolute date before calling yeartoday.
* Support GCC 7David Michael2017-05-072-1/+68
| | | | | * Makefile.am (clib_routines): Add __udivmoddi4. * linux/src/include/linux/compiler-gcc7.h: New file.
* Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumachSamuel Thibault2017-05-071-0/+6
|\
| * kern: Make kernel task available to bootscript.Justus Winter2017-03-181-0/+6
| | | | | | | | | | | | * kern/bootstrap.c (bootstrap_create): Insert the variable 'kernel-task' into the bootscript environment. Userspace can use this instead of guessing based on the order of the first tasks.
* | Rewrite gsync so that it works with remote tasks v2Agustina Arzille2017-03-042-138/+244
|/
* Implement basic sleeping locks for gnumachAgustina Arzille2017-03-046-2/+190
| | | | | | | | | | * kern/atomic.h: New file. * kern/kmutex.h: New file. * kern/kmutex.c: New file. * Makefrag.am (libkernel_a_SOURCES): Add atomic.h, kmutex.h, kmutex.c. * kern/sched_prim.h (thread_wakeup_prim): Make it return boolean_t. * kern/sched_prim.c (thread_wakeup_prim): Return TRUE if we woke a thread, and FALSE otherwise.
* Fix bissextile years computationSamuel Thibault2017-01-241-1/+18
| | | | | | | In practice, fixes 2100, 2200, 2300, 2500, 2600, 2700, etc. * i386/i386at/rtc.c (yeartoday): Make years divisible by 100 but not divisible by 400 non-bisextile.
* VM: really fix pageout of external objects backed by the default pagerRichard Braun2016-12-272-25/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Commit eb07428ffb0009085fcd01dd1b79d9953af8e0ad does fix pageout of external objects backed by the default pager, but the way it's done has a vicious side effect: because they're considered external, the pageout daemon can keep evicting them even though the external pagers haven't released them, unlike internal pages which must all be released before the pageout daemon can make progress. This can lead to a situation where too many pages become wired, the default pager cannot allocate memory to process new requests, and the pageout daemon cannot recycle any more page, causing a panic. This change makes the pageout daemon use the same strategy for both internal pages and external pages sent to the default pager: use the laundry bit and wait for all laundry pages to be released, thereby completely synchronizing the pageout daemon and the default pager. * vm/vm_page.c (vm_page_can_move): Allow external laundry pages to be moved. (vm_page_seg_evict): Don't alter the `external_laundry' bit, merely disable double paging for external pages sent to the default pager. * vm/vm_pageout.c: Include vm/memory_object.h. (vm_pageout_setup): Don't check whether the `external_laundry' bit is set, but handle external pages sent to the default pager the same as internal pages.
* Increase the size of the kernel mapRichard Braun2016-12-251-6/+5
| | | | | | | | Sometimes, in particular during IO spikes, the slab allocator needs more virtual memory than is currently available. The new size should also be fine for the Xen version. * i386/i386/vm_param.h (VM_KERNEL_MAP_SIZE): Increase value.
* doc: update documentation about wiringRichard Braun2016-12-241-0/+41
| | | | | * doc/mach.texi: Describe vm_wire_all, and add more information about vm_wire and vm_protect.
* VM: add the vm_wire_all callRichard Braun2016-12-247-6/+169
| | | | | | | | | | | | | | | | | This call maps the POSIX mlockall and munlockall calls. * Makefrag.am (include_mach_HEADERS): Add include/mach/vm_wire.h. * include/mach/gnumach.defs (vm_wire_t): New type. (vm_wire_all): New routine. * include/mach/mach_types.h: Include mach/vm_wire.h. * vm/vm_map.c: Likewise. (vm_map_enter): Automatically wire new entries if requested. (vm_map_copyout): Likewise. (vm_map_pageable_all): New function. vm/vm_map.h: Include mach/vm_wire.h. (struct vm_map): Update description of member `wiring_required'. (vm_map_pageable_all): New function. * vm/vm_user.c (vm_wire_all): New function.
* VM: rework map entry wiringRichard Braun2016-12-247-298/+311
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, user wiring is removed, simply because it has never been used. Second, make the VM system track wiring requests to better handle protection. This change makes it possible to wire entries with VM_PROT_NONE protection without actually reserving any page for them until protection changes, and even make those pages pageable if protection is downgraded to VM_PROT_NONE. * ddb/db_ext_symtab.c: Update call to vm_map_pageable. * i386/i386/user_ldt.c: Likewise. * ipc/mach_port.c: Likewise. * vm/vm_debug.c (mach_vm_region_info): Update values returned as appropriate. * vm/vm_map.c (vm_map_entry_copy): Update operation as appropriate. (vm_map_setup): Update member names as appropriate. (vm_map_find_entry): Update to account for map member variable changes. (vm_map_enter): Likewise. (vm_map_entry_inc_wired): New function. (vm_map_entry_reset_wired): Likewise. (vm_map_pageable_scan): Likewise. (vm_map_protect): Update wired access, call vm_map_pageable_scan. (vm_map_pageable_common): Rename to ... (vm_map_pageable): ... and rewrite to use vm_map_pageable_scan. (vm_map_entry_delete): Fix unwiring. (vm_map_copy_overwrite): Replace inline code with a call to vm_map_entry_reset_wired. (vm_map_copyin_page_list): Likewise. (vm_map_print): Likewise. Also print map size and wired size. (vm_map_copyout_page_list): Update to account for map member variable changes. * vm/vm_map.h (struct vm_map_entry): Remove `user_wired_count' member, add `wired_access' member. (struct vm_map): Rename `user_wired' member to `size_wired'. (vm_map_pageable_common): Remove function. (vm_map_pageable_user): Remove macro. (vm_map_pageable): Replace macro with function declaration. * vm/vm_user.c (vm_wire): Update call to vm_map_pageable.
* VM: fix pageout of external objects backed by the default pagerRichard Braun2016-12-242-9/+37
| | | | | | | | | | | Double paging on such objects causes deadlocks. * vm/vm_page.c: Include <vm/memory_object.h>. (vm_page_seg_evict): Rename laundry to double_paging to increase clarity. Set the `external_laundry' bit when evicting a page from an external object backed by the default pager. * vm/vm_pageout.c (vm_pageout_setup): Wire page if the `external_laundry' bit is set.
* VM: fix pageability checkRichard Braun2016-12-241-0/+1
| | | | | | | | Unlike laundry pages sent to the default pager, pages marked with the `external_laundry' bit remain in the page queues and must be filtered out by the pageability check. * vm/vm_page.c (vm_page_can_move): Check the `external_laundry' bit.
* VM: fix mapping removal on wired pagesRichard Braun2016-12-241-2/+4
| | | | | | | | | | Memory wiring is about to be reworked, at which point the VM system will properly track wired mappings. Removing them when changing protection makes sense, and is fine as long as the VM system rewires them when access is restored. * i386/intel/pmap.c (pmap_page_protect): Decrease wiring count instead of causing a panic when removing a wired mapping.
* VM: fix pageout timeoutRichard Braun2016-12-211-1/+1
| | | | | | | The interval parameter to the thread_set_timeout function is actually in ticks. * vm/vm_pageout.c (vm_pageout): Fix call to thread_set_timeout.
* GNU Mach 1.8Thomas Schwinge2016-12-182-6/+6
| | | | | * version.m4 (AC_PACKAGE_VERSION): Set to 1.8. * NEWS: Finalize for 1.8.
* VM: make vm_wire more POSIX-friendlyRichard Braun2016-12-112-14/+17
| | | | | | | | * 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.
* Update the NEWS fileJustus Winter2016-12-091-1/+24
|
* rbtree: minor changeRichard Braun2016-12-091-1/+1
| | | | * kern/rbtree.h (rbtree_for_each_remove): Remove trailing slash.
* VM: fix pageout throttling to external pagersRichard Braun0 min.4-26/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* VM: fix pageout on low memoryRichard Braun2016-11-301-37/+9
| | | | | | | | | | | | | | | 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.
* VM: fix eviction logic errorRichard Braun2016-11-301-1/+1
| | | | | * 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".
* VM: fix pageout stop conditionRichard Braun2016-11-301-0/+5
| | | | | | | | | | | | | | | | | | 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.
* gsync: Avoid NULL pointer dereferenceBrent Baccala2016-11-101-9/+12
| | | | | * kern/gsync.c (gsync_wait, gsync_wake, gsync_requeue): Return immediately if task argument is TASK_NULL
* Revert "i386: use ACPI to power off the machine"Justus Winter2016-11-0619-2198/+0
| | | | | | | | | 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.
* vm: Print names of maps in the debugger.Justus Winter2016-11-041-2/+2
| | | | * vm/vm_map.c (vm_map_print): Print name of the map.
* include: Fix new task notifications.Justus Winter2016-11-011-2/+5
| | | | | | | | 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.
* i386: Use discontiguous page directories when using PAE.Justus Winter2016-11-014-131/+205
| | | | | | | | | | | | | | | | | | | | | | 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.
* gsync: fix licenceSamuel Thibault2016-10-312-2/+2
| | | | | | | Agustina relicenced her work. * kern/gsync.c: Relicence to GPL 2+. * kern/gsync.h: Relicence to GPL 2+.
* gsync: Fix crash when task is not current taskSamuel Thibault2016-10-311-0/+9
| | | | | * kern/gsync.c (gsync_wait, gsync_wake, gsync_requeue): Return KERN_FAILURE when task != current_task().
* gsync: Fix assertion failure with MACH_LDEBUGSamuel Thibault2016-10-311-5/+5
| | | | | | | | | 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.
* Make multiboot cmdline and modules non-permanent reservationsSamuel Thibault2016-10-311-7/+8
| | | | | | * 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.
* Fix taking LDFLAGS into accountSamuel Thibault2016-10-241-1/+1
| | | | * Makefile.am (clib-routines.o): Add $(LDFLAGS) to link command.
* Fix taking LDFLAGS into accountSamuel Thibault2016-10-241-2/+2
| | | | * Makefile.am (gnumach_o_LINK, gnumach_LINK): Add $(LDFLAGS).
* Fix warningsSamuel Thibault2016-10-242-3/+3
| | | | | | * 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.
* i386: Allocate page directories using the slab allocator.Justus Winter2016-10-221-11/+28
| | | | | | | | * 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.
* Gracefully handle pmap allocation failures.Justus Winter2016-10-212-3/+17
| | | | | | * 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.Justus Winter2016-10-211-4/+8
| | | | | | | * 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.
* Make task notification ports mutable.Justus Winter2016-10-131-1/+21
| | | | | * include/mach/task_notify.defs (task_notify_port_t): New type. (mach_notify_new_task): Use the specialized type.
* linux: Remove incompatible local prototype.Justus Winter2016-10-121-4/+3
| | | | | * linux/dev/glue/kmem.c (vremap): Remove prototype, include the right header instead.
* Remove deprecated external memory management interface.Justus Winter2016-10-0314-411/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Fix format securityDavid Michael2016-10-021-2/+2
| | | | | | | * 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'.
* kern: Improve panic messages from the scheduler.Justus Winter2016-10-011-9/+14
| | | | | * kern/sched_prim.c (state_panic): Turn into macro, print symbolic values of thread state.