Commit graph

117 commits

Author SHA1 Message Date
Arun Thomas de231a713e Move MIN() and MAX() macros to sys/params.h 2010-08-21 13:10:41 +00:00
Arun Thomas 9a21d1a2fd Macros for symbols used in both ASM and C
-The macros take care of prepending the leading underscore when
 necessary.
2010-08-17 16:44:07 +00:00
Erik van der Kouwe d7c70a41e5 Allow vm to split blocks in memory map (needed for multiboot, contributed by Feiran "Fam" Zheng 2010-07-23 14:22:13 +00:00
Tomas Hruby f6f20e1269 Overly restrictive assert
- not true if APIC is enabled
2010-07-21 13:46:29 +00:00
Cristiano Giuffrida 0824146978 Disable debug info on trunk. 2010-07-21 08:22:24 +00:00
Cristiano Giuffrida 91a83fe265 Crash recovery and live update support for VM. 2010-07-20 23:03:52 +00:00
Cristiano Giuffrida 0d984b36ef Get rid of static spare pages after VM startup. 2010-07-20 21:59:27 +00:00
Cristiano Giuffrida 40b4e71db2 COW for physically contiguous blocks in VM 2010-07-20 18:57:25 +00:00
Cristiano Giuffrida 1b7d95df29 Generalize interface of some VM functions 2010-07-20 02:08:28 +00:00
Ben Gras 16d0609fad vm: restore sanity checks in NONCONTIGUOUS case. 2010-07-19 18:20:14 +00:00
Ben Gras 068944de36 vm: add MEMPROTECT feature in vm.h. 2010-07-19 18:19:59 +00:00
Ben Gras 77267ca28b vm: add missing USE() macros in utility.c. 2010-07-19 18:19:38 +00:00
Ben Gras 5e2c84b119 vm: allow readonly pages when sanity checking when they're supposed to be rw. 2010-07-19 18:19:16 +00:00
Ben Gras 8c925134f9 vm: NONCONTIGUOUS - try to make physical memory as maximally noncontiguous 2010-07-09 12:22:33 +00:00
Ben Gras fc8f0b9ee2 vm: better fix for clang 'unused expression' warning 2010-07-05 17:34:26 +00:00
Ben Gras 86139e8bf2 vm: last commit should not have included wiping out these calls
(this was done temporarily to make vm work with clang; vm crashes when
the 64-bit arithmetic functions are used when compiled with clang.)
2010-07-05 14:01:34 +00:00
Ben Gras b4bea1bfcb vm: fixes for clang warnings 2010-07-05 13:58:57 +00:00
Cristiano Giuffrida 9e4312453d Improve memory pinning. 2010-07-01 08:54:25 +00:00
Cristiano Giuffrida 06700d05d1 Give RS a page table. 2010-06-28 21:53:37 +00:00
Ben Gras 6e47e2996f sep ${.OBJDIR} fixes by Antoine Leica. 2010-06-27 23:47:23 +00:00
Arun Thomas c0c8d25799 Rename mkfiles from minix.*.mk to bsd.*.mk
Makes things easier for pkgsrc
2010-06-25 18:29:09 +00:00
Cristiano Giuffrida 5c7d64b981 No malloc() in VM. 2010-06-25 12:48:56 +00:00
Erik van der Kouwe 498d7d8a4c Don't use kernel responses in servers 2010-06-24 07:37:26 +00:00
Tomas Hruby 8214e5e284 Removed racy COW optimization
- enabling writing in COW once phys block is reference only once is racy if VM
  is preemptible. original memory location may get overwritten before COW copies
  the memory

- problem when DEBUG_RACE is on and a big problem for SMP
2010-06-18 12:46:18 +00:00
Tomas Hruby 1207fcc6f0 int to endpoint_t conversions in mmap 2010-06-09 09:14:53 +00:00
Ben Gras 31adc0a3c4 vm: junkfree feature that fills freed pages with a recognizable pattern. 2010-06-08 00:59:48 +00:00
Arun Thomas b641afc78a VM: Remove legacy non-paging code paths 2010-06-05 14:39:40 +00:00
Arun Thomas 007104d60e GCC build fixes/updates
-Set stack sizes for boot image processes
-Increase RS stack size
-Reduce ramdisk size
-HARDWARE task should use kernel stack
-Minor asm tweaks for leading underscores
2010-05-26 18:45:55 +00:00
Erik van der Kouwe 1f11a57141 Oops, last commit included more than was intended 2010-05-20 08:07:47 +00:00
Erik van der Kouwe 5f15ec05b2 More system processes, this was not enough for the release script to run on some configurations 2010-05-20 08:05:07 +00:00
Ben Gras c5c25e7abc kernel/vm: change pde table info from single buffer to explicit per-process.
makes code in kernel more readable, and allows better sanity checking on
using the pde info.
2010-05-12 08:31:05 +00:00
Tomas Hruby 6e25ad8b0a Use of all NIL_* defines converted to NULL 2010-05-10 13:26:00 +00:00
Ben Gras d5a0af826a vm: use arch_map2str to print pagefault info, to properly display code addrs 2010-05-08 17:25:54 +00:00
Ben Gras b6bb75963b vm: remove leftover diag print 2010-05-05 15:26:48 +00:00
Ben Gras f78d8e74fd secondary cache feature in vm.
A new call to vm lets processes yield a part of their memory to vm,
together with an id, getting newly allocated memory in return. vm is
allowed to forget about it if it runs out of memory. processes can ask
for it back using the same id. (These two operations are normally
combined in a single call.)

It can be used as a as-big-as-memory-will-allow block cache for
filesystems, which is how mfs now uses it.
2010-05-05 11:35:04 +00:00
Cristiano Giuffrida 0164957abb Unified crash recovery and live update.
RS CHANGES:
- Crash recovery is now implemented like live update. Two instances are kept
side by side and the dead version is live updated into the new one. The endpoint
doesn't change and the failure is not exposed (by default) to other system
services.
- The new instance can be created reactively (when a crash is detected) or
proactively. In the latter case, RS can be instructed to keep a replica of
the system service to perform a hot swap when the service fails. The flag
SF_USE_REPL is set in that case.
- The new flag SF_USE_REPL is supported for services in the boot image and
dynamically started services through the RS interface (i.e. -p option in the
service utility).
- Fixed a free unallocated memory bug for core system services.
2010-04-27 11:17:30 +00:00
Tomas Hruby f51eea4b32 Changed pagefault delivery to VM
this patch changes the way pagefaults are delivered to VM. It adopts
the same model as the out-of-quantum messages sent by kernel to a
scheduler.

- everytime a userspace pagefault occurs, kernel creates a message
  which is sent to VM on behalf of the faulting process

- the process is blocked on delivery to VM in the standard IPC code
  instead of waiting in a spacial in-kernel queue (stack) and is not
  runnable until VM tell kernel that the pagefault is resolved and is
  free to clear the RTS_PAGEFAULT flag.

- VM does not need call kernel and poll the pagefault information
  which saves many (1/2?) calls and kernel calls that return "no more
  data"

- VM notification by kernel does not need to use signals

- each entry in proc table is by 12 bytes smaller (~3k save)
2010-04-26 23:21:26 +00:00
Ben Gras e0792d72d7 vm: util.S not used currently; leave it out. 2010-04-13 15:02:32 +00:00
Ben Gras 5c17d5e02f vm: include no-caching bits in PTF_ALLFLAGS for flags sanity check. 2010-04-13 11:08:08 +00:00
Ben Gras 1f1f8d2207 vm: don't force physical addresses to be nonzero. 2010-04-13 11:01:40 +00:00
Kees van Reeuwijk bc314bda91 Remove the types Dev_t, _mnx_Gui, _mnx_Uid, and similar.
Use ANSI-style function declarations where necessary.
2010-04-13 10:58:41 +00:00
Ben Gras 5f7c37bb84 vm: remove assert, map in of phys addr 0 is legit sometimes. 2010-04-13 10:39:46 +00:00
Ben Gras 27fc7ab1f3 vm: use assert() instead of vm_assert(); remove vm_assert(). 2010-04-12 12:37:28 +00:00
Ben Gras c78250332d let vm use physically fragmented memory for allocations.
map_copy_ph_block is replaced by map_clone_ph_block, which can
replace a single physical block by multiple physical blocks.

also,
 . merge map_mem.c with region.c, as they manipulate the same
   data structures
 . NOTRUNNABLE removed as sanity check
 . use direct functions for ALLOC_MEM and FREE_MEM again
 . add some checks to shared memory mapping code
 . fix for data structure integrity when using shared memory
 . fix sanity checks
2010-04-12 11:25:24 +00:00
Arun Thomas 4ed3a0cf3a Convert kernel over to bsdmake 2010-04-01 22:22:33 +00:00
Cristiano Giuffrida ef95bf1bb9 Print stacktrace when a system service fails or when a core dump has to be generated for a user process. 2010-03-22 22:46:29 +00:00
Arun Thomas 436d6012a3 Convert drivers/ and servers/ over to bsdmake
-Move libdriver to lib/
-Install all boot image services on filesystem to aid restartability
2010-03-22 21:25:22 +00:00
Tomas Hruby 12ef495cac atomicity fix when enabling paging
- before enabling paging VM asks kernel to resize its segments. This
  may cause kernel to segfault if APIC is used and an interrupt
  happens between this and paging enabled. As these are 2 separate
  vmctl calls it is not atomic. This patch fixes this problem. VM does
  not ask kernel to resize the segments in a separate call anymore.
  The new segments limit is part of the "enable paging" call. It
  generalizes this call in such a way that more information can be
  passed as need be or the information may be completely different if
  another architecture requires this.
2010-03-22 07:42:52 +00:00
Ben Gras ec30f25d0c VM: fix kernel mappings for children of non-paged parents. 2010-03-18 17:17:31 +00:00
Cristiano Giuffrida cb176df60f New RS and new signal handling for system processes.
UPDATING INFO:
20100317:
        /usr/src/etc/system.conf updated to ignore default kernel calls: copy
        it (or merge it) to /etc/system.conf.
        The hello driver (/dev/hello) added to the distribution:
        # cd /usr/src/commands/scripts && make clean install
        # cd /dev && MAKEDEV hello

KERNEL CHANGES:
- Generic signal handling support. The kernel no longer assumes PM as a signal
manager for every process. The signal manager of a given process can now be
specified in its privilege slot. When a signal has to be delivered, the kernel
performs the lookup and forwards the signal to the appropriate signal manager.
PM is the default signal manager for user processes, RS is the default signal
manager for system processes. To enable ptrace()ing for system processes, it
is sufficient to change the default signal manager to PM. This will temporarily
disable crash recovery, though.
- sys_exit() is now split into sys_exit() (i.e. exit() for system processes,
which generates a self-termination signal), and sys_clear() (i.e. used by PM
to ask the kernel to clear a process slot when a process exits).
- Added a new kernel call (i.e. sys_update()) to swap two process slots and
implement live update.

PM CHANGES:
- Posix signal handling is no longer allowed for system processes. System
signals are split into two fixed categories: termination and non-termination
signals. When a non-termination signaled is processed, PM transforms the signal
into an IPC message and delivers the message to the system process. When a
termination signal is processed, PM terminates the process.
- PM no longer assumes itself as the signal manager for system processes. It now
makes sure that every system signal goes through the kernel before being
actually processes. The kernel will then dispatch the signal to the appropriate
signal manager which may or may not be PM.

SYSLIB CHANGES:
- Simplified SEF init and LU callbacks.
- Added additional predefined SEF callbacks to debug crash recovery and
live update.
- Fixed a temporary ack in the SEF init protocol. SEF init reply is now
completely synchronous.
- Added SEF signal event type to provide a uniform interface for system
processes to deal with signals. A sef_cb_signal_handler() callback is
available for system processes to handle every received signal. A
sef_cb_signal_manager() callback is used by signal managers to process
system signals on behalf of the kernel.
- Fixed a few bugs with memory mapping and DS.

VM CHANGES:
- Page faults and memory requests coming from the kernel are now implemented
using signals.
- Added a new VM call to swap two process slots and implement live update.
- The call is used by RS at update time and in turn invokes the kernel call
sys_update().

RS CHANGES:
- RS has been reworked with a better functional decomposition.
- Better kernel call masks. com.h now defines the set of very basic kernel calls
every system service is allowed to use. This makes system.conf simpler and
easier to maintain. In addition, this guarantees a higher level of isolation
for system libraries that use one or more kernel calls internally (e.g. printf).
- RS is the default signal manager for system processes. By default, RS
intercepts every signal delivered to every system process. This makes crash
recovery possible before bringing PM and friends in the loop.
- RS now supports fast rollback when something goes wrong while initializing
the new version during a live update.
- Live update is now implemented by keeping the two versions side-by-side and
swapping the process slots when the old version is ready to update.
- Crash recovery is now implemented by keeping the two versions side-by-side
and cleaning up the old version only when the recovery process is complete.

DS CHANGES:
- Fixed a bug when the process doing ds_publish() or ds_delete() is not known
by DS.
- Fixed the completely broken support for strings. String publishing is now
implemented in the system library and simply wraps publishing of memory ranges.
Ideally, we should adopt a similar approach for other data types as well.
- Test suite fixed.

DRIVER CHANGES:
- The hello driver has been added to the Minix distribution to demonstrate basic
live update and crash recovery functionalities.
- Other drivers have been adapted to conform the new SEF interface.
2010-03-17 01:15:29 +00:00