aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix locking error in the slab allocatorRichard Braun2016-06-292-19/+21
| | | | | | | * 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.
* Fix locking errorRichard Braun2016-06-271-1/+0
| | | | * i386/i386/io_perm.c (no_senders): Remove bogus call to ip_lock.
* Change page cache statisticsRichard Braun2016-06-174-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Allow setting x86 debug flags for the current threadSamuel Thibault2016-06-101-0/+12
| | | | | | * 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 tooSamuel Thibault2016-06-101-1/+1
| | | | | * kern/debug.c (SoftDebugger) [__x86_64__]: Use int3 instruction to trigger debugger.
* Fix overflow checking on VM map copyinRichard Braun2016-06-091-6/+22
| | | | | * vm/vm_map (vm_map_copyin, vm_map_copyin_page_list): Check overflow before page alignment of source data.
* Fix deadlockRichard Braun2016-06-071-1/+1
| | | | | * vm/vm_map.c (vm_map_copyout_page_list): Fix call to vm_map_find_entry_anywhere to avoid relocking VM map.
* Fix some license headers.Richard Braun2016-06-022-24/+43
| | | | | | | | 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.
* Fix buffer size passed to scsi_do_cmdSamuel Thibault2016-05-264-6/+6
| | | | | | | | * 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 -1Samuel Thibault2016-05-261-1/+5
| | | | | * 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 zeroSamuel Thibault2016-05-261-2/+2
| | | | * kern/debug.c (panic, log): Pass 16 as default radix to _doprnt.
* Fix getting ELF symbol bind and typeSamuel Thibault2016-05-231-5/+5
| | | | | ddb/db_elf.c (elf_db_search_symbol): Use ELF32_ST_BIND and ELF32_ST_TYPE to access symbol bind and type.
* vm_map: back allocations with a red-black treeRichard Braun2016-05-202-223/+306
| | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* xen: fix prototypeJustus Winter2016-05-201-1/+1
| | | | | | Amends a7f248bf. * xen/console.h (hypcnclose): Fix type of parameter.
* GNU Mach 1.7Thomas Schwinge2016-05-182-7/+7
| | | | | * version.m4 (AC_PACKAGE_VERSION): Set to 1.7. * NEWS: Finalize for 1.7.
* Fix gcc-6 warningsSamuel Thibault2016-05-1821-43/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Revert "Fix getting ELF symbol bind and type"Samuel Thibault2016-05-171-5/+5
| | | | | | This reverts commit a8a52cafb5621b475737ffdc81f63703d5b37904. It seems to be breaking backtracing in ddb...
* Fix pageout deadlockRichard Braun2016-05-163-0/+10
| | | | | | | | | | | | | | | | | | 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.
* Fix warningRichard Braun2016-05-152-2/+3
| | | | | ddb/db_output.c (db_printf): Return 0. ddb/db_printf.h (db_printf): Change declaration to return an int.
* Fix xen bootSamuel Thibault2016-04-211-1/+1
| | | | | * i386/i386/pcb.c (pcb_init): Make sure there is a thread before calling current_task().
* Fix type of program counter argumentJustus Winter2016-04-202-2/+2
| | | | | * i386/i386/hardclock.c (hardclock): Use '0' instead of 'NULL'. * vm/vm_fault (vm_fault_cleanup): Likewise.
* xen: fix buildJustus Winter2016-04-202-3/+4
| | | | | * i386/xen/xen.c (hypclock_machine_intr): Fix 'clock_interrupt' call. * xen/time.c (clkstart): Likewise.
* Add kernel profiling through samplingSamuel Thibault2016-04-208-15/+40
| | | | | | | | | | | | | | | * 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.
* Add memory barrier to spl*Samuel Thibault2016-04-171-0/+9
| | | | | * i386/i386/spl.S (mb): Define macro (SETIPL, spl0, spl7): Call mb.
* Avoid using C99 for variable declaration for nowSamuel Thibault2016-04-171-1/+2
| | | | * kern/gsync.c (gsync_setup): Declare `i' variable out of for loop.
* update NEWS fileSamuel Thibault2016-04-151-0/+3
|
* Lightweight synchronization mechanismAgustina Arzille2016-04-156-0/+516
| | | | | | | | | | | | * Makefrag.am (libkernel_a_SOURCES): Add kern/gsync.c and kern/gsync.h. * include/mach/gnumach.defs (gsync_wait, gsync_wake, gsync_requeue): New routines. * include/mach/kern_return.h (KERN_TIMEDOUT, KERN_INTERRUPTED): New error codes. * kern/gsync.c: New file. * kern/gsync.h: New file. * kern/startup.c: Include <kern/gsync.h> (setup_main): Call gsync_setup.
* Update NEWS fileJustus Winter2016-04-151-0/+14
|
* Add --disable-assert flag to disable assertionsJustus Winter2016-04-151-0/+2
| | | | | | * configfrag.ac: Use 'AC_HEADER_ASSERT'. Signed-off-by: Justus Winter <justus@gnupg.org>
* i386: Fix error handlingJustus Winter2016-04-151-4/+11
| | | | | | * i386/i386at/model_dep.c (i386at_init): Fix error handling. Signed-off-by: Justus Winter <justus@gnupg.org>
* Fix bootstraping issues with stdint.h.Flavio Cruz2016-04-052-2/+1
| | | | | * include/mach/std_types.h: Do not include stdint.h. * kern/rdxtree.h: Replace sys/types.h with stdint.h.
* Follow-up stdint useSamuel Thibault2016-04-042-4/+4
| | | | | | | | 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.
* Use uint32_t instead of unsigned32_t.Flavio Cruz2016-04-0421-91/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make kernel mapping start address configurableSamuel Thibault2016-03-192-2/+7
| | | | | | | | 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.
* Fix getting ELF symbol bind and typeSamuel Thibault2016-03-191-5/+5
| | | | | ddb/db_elf.c (elf_db_search_symbol): Use ELF32_ST_BIND and ELF32_ST_TYPE to access symbol bind and type.
* Avoid panics on physical memory exhaustionRichard Braun2016-03-131-2/+4
| | | | | * vm/vm_resident (vm_page_grab_contig): Return NULL instead of calling panic on memory exhaustion.
* Ship missing filesSamuel Thibault2016-03-112-0/+3
| | | | | | 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.
* Merge remote-tracking branch 'remotes/origin/rbraun/vm_cache_policy'Richard Braun2016-03-114-145/+108
|\ | | | | | | Finally ;-).
| * Fix page cache accountingRichard Braun2016-02-072-31/+42
| | | | | | | | | | | | | | | | | | | | * 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.
| * VM cache policy changeRichard Braun2013-10-094-120/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix stack allocation on XenRichard Braun2016-03-091-21/+12
| | | | | | | | | | | | | | | | | | | | 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.
* | Relax slab allocation alignment constraintRichard Braun2016-03-091-8/+12
| | | | | | | | | | | | | | | | | | | | | | * 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.
* | Inherit fpu control word from parent to childSamuel Thibault2016-03-066-15/+47
| | | | | | | | | | | | | | | | | | | | | | | | * 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().
* | ipc: add missing kernel object typeJustus Winter2016-02-281-1/+2
| | | | | | | | * ipc/ipc_object.c (ikot_print_array): Add entry for IKOT_PAGER_PROXY.
* | doc: clarify memory object initializationJustus Winter2016-02-281-2/+3
| | | | | | | | | | * doc/mach.texi: Mention another way how a memory manager can signal that an object is ready.
* | i386: add parts of cpu.h from x15Justus Winter2016-02-282-0/+111
| | | | | | | | | | * i386/Makefrag.am (libkernel_a_SOURCES): Add new file. * i386/i386/cpu.h: New file.
* | include: avoid generating unused client stubsJustus Winter2016-02-261-0/+41
| | | | | | | | | | | | * 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.
* | Document thread_sleep about events woken from interrupt handlersSamuel Thibault2016-02-261-0/+3
| | | | | | | | | | * kern/sched_prim.c (thread_sleep): Document case of events woken from interrupt handlers.
* | Document why code is not racySamuel Thibault2016-02-261-0/+2
| | | | | | | | | | * i386/i386at/kd_mouse.c (kd_mouse_read): Document why the assert_wait/thread_block pair is not racy.
* | Include the exception protocol in 'gnumach.msgids'Justus Winter2016-02-232-2/+26
| | | | | | | | | | * Makefrag.am: Include the exception protocol in 'gnumach.msgids'. * kern/exc.defs: New file.