Commit graph

114 commits

Author SHA1 Message Date
Sanchayan Maity 8501cb7ed8 Allow users to request a asynchronous notification
This patch adds functionality to request an asynchronous notification
if some other process has send a message to it. We currently send a
SIGALRM to avoid any changes to core infrastructure of signal handling.
Ideally we should implement a separate signal for this. Currently there
is an obvious disadvantage of not being able to use SIGALRM with alarm,
if we are using this functionality.
2016-03-22 17:51:09 +05:30
Sanchayan Maity 55d341bc54 Allow users to get and set attributes
Currently we only allow users to get and set number of queues. The
operation is always non blocking. There is no provision for non
blocking operation at the moment.

The queue sizes are set to MAX 256 by default. If a user changes the
attributes and sets the queue size or number of messages in a queue
to less than 256, it is the responsibility of the user to close any
queues which were opened with a descriptor greater than the value
currently set.

For example, by default queue sizes are 256. If 150 queues are opened
and then the user sets the number of queues to 32, all open descriptors
and queues from 32 to 150 must be closed. Note that descriptor number
allocation starts with zero and not one.
2016-03-22 15:57:53 +05:30
Sanchayan Maity fe71ea4bc1 First round of assorted bug fixes
Fixed the following bugs:
1. Message priority was not set at all at two places
2. Limits check was not correct while returning error values
3. We are suppose to allow multiple users operate on the same queue
using a named descriptor. However any one user calling close before
the other would result in closing the queue even when other users
might be using it. Track number of users and close only if number of
users is zero. Yet to do functional tests for this, so this is untested,
but introduce it anyway at this juncture.
2016-03-19 11:49:48 +05:30
Sanchayan Maity 63062e7e15 Add message queue support for Minix
Implement message queues support for Minix.

Pending tasks:
Blocking or non blocking for send receive?
Sort by priority and time?
Test codes?
Bug fixes?
2016-03-07 17:41:07 +05:30
Jean-Baptiste Boric 69eead77ff New image framework generation
The CD now boots directly from the ISO 9660 filesystem instead of using
MBR partitioning with Minix file systems. This saves some space on the
CD and reduces memory requirements by some unknown amount as the root
ramdisk is completely eliminated.

The x86 hard drive image creation is also rewritten in the same
fashion.

The setup is modified to be more NetBSD-like (unpacking sets
tarballs instead of blindly copying the CD contents). Splitting MINIX
into sets is done in another commit due to it being a nightmare to
rebase.

Since MINIX lacks union mounts for now, a bunch of ramdisks are
generated at run-time to make parts of the filesystem writeable for the
CD. This solution isn't ideal, but it's enough for an installation CD.

Change-Id: Icbd9cca4dafebf7b42c345b107a17679a622d5cd
2015-10-10 19:09:35 +02:00
Jean-Baptiste Boric 22ad44d6a9 libutil: add getmaxpartitions() implementation
Change-Id: I6f1d7838e10bcb079fb5b68ff513c3279fffb4f9
2015-10-07 12:36:36 +02:00
Lionel Sambuc 41a30155b9 Fix gcc -O1 builds for ARM
The builds are failing as GCC somehow thinks ino might be
uninitialized before use.

Change-Id: Id99fd5e46bcbaafd5001752e16c3f77c1d568556
2015-10-04 03:47:57 -07:00
David van Moolenbroek 29346ab043 PM: add support for wait4(2)
This patch adds support for the wait4 system call, and with that the
wait3 call as well.  The implementation is absolutely minimal: only
user and system times of the exited child are returned (with all other
rusage fields left zero), and there is no support for tracers.  Still,
this should cover the main use cases of wait4.

Change-Id: I7a04589a8423a23990ab39aa38e85d535556743a
2015-09-29 18:15:28 +00:00
David van Moolenbroek bc2d75fa05 Rework getrusage(2) infrastructure
- the userland call is now made to PM only, and PM relays the call to
  other servers as appropriate; this is an ABI change that will
  ultimately allow us to add proper support for wait3() and the like;
  for the moment there is backward compatibility;
- the getrusage-specific kernel subcall has been removed, as it
  provided only redundant functionality, and did not provide the means
  to be extended correctly in the future - namely, allowing the kernel
  to return different values depending on whether resource usage of
  the caller (self) or its children was requested;
- VM is now told whether resource usage of the caller (self) or its
  children is requested, and it refrains from filling in wrong values
  for information it does not have;
- VM now uses the correct unit for the ru_maxrss values;
- VFS is cut out of the loop entirely, since it does not provide any
  values at the moment; a comment explains how it should be readded.

Change-Id: I27b0f488437dec3d8e784721c67b03f2f853120f
2015-09-28 14:06:59 +00:00
Lionel Sambuc 81b1f87117 Fix noassert builds
Change-Id: I5626950ffa29afe7a0fb9e9144839b311824da92
2015-09-25 15:47:43 -07:00
David van Moolenbroek ba736c7968 libpuffs: clean up, unbreak
- move MINIX3-specific files into minix/lib/libpuffs;
- resynchronize the remaining files with NetBSD code;
- remove a few unnecessary changes;
- put remaining MINIX3-specific changes in __minix blocks;
- sort out the source files being linked at all.

The result is that libpuffs now successfully links against FUSE
file system programs again.  It can successfully mount, perform
some of the most basic operations, and unmount the file system.

Change-Id: Ieac220f7ad8c4d1fa293abda81967e8045be0bb4
2015-09-23 12:05:03 +00:00
David van Moolenbroek 7c48de6cc4 Resolve more warnings
Change-Id: Ibc1b7f7cd45ad7295285e59c6ce55888266fece8
2015-09-23 12:04:58 +00:00
David van Moolenbroek 9488aa4c04 Import NetBSD flock(1)
Also fix the MINIX3 libc flock(3) implementation.

Change-Id: Ia80280029968786d7f029940ec02e942057701bd
2015-09-23 12:03:13 +00:00
David van Moolenbroek 040ec64444 libfetch: switch to external/bsd version
Change-Id: I7eb6fbf0ae6c008e399fe9bffdfc2b98dfed3432
2015-09-23 12:03:08 +00:00
David van Moolenbroek ed223591a8 libc: support for deprecated FIO* ioctl(2) calls
Various generic file IOCTL calls should be processed by VFS rather
than individual drivers.  For this reason, we rewrite them to use
fcntl(2) instead.

Change-Id: I38a5f3c7b21943a897114a51678a800f7e7f0a77
2015-09-23 12:03:06 +00:00
David van Moolenbroek 20054ae93f Kernel: separate userland ABI on kernel page
Currently, the userland ABI uses a single field ('user_sp') far
into the very large 'kinfo' structure on the shared kernel
information page.  This precludes us from modifying or getting
rid of 'kinfo' in the future without breaking userland.  This
patch adds a separate 'kuserinfo' structure to the kernel
information page, with only information that is part of the
userland ABI, in an extensible manner.  Userland now uses this
field if it is present, and falls back to the old field if not.

Change-Id: Ib7b24b53a440f40a2edc28cdfa48447ac2179288
2015-09-23 12:01:15 +00:00
David van Moolenbroek 26f5c8f84b Kernel: store ARM frclock info in one structure
This change serves to reduce the clutter inside the top-level kerninfo
structure, and allows other ARM-specific values to be added on the
kernel page in one place.

Change-Id: I36a6aada9dbd1230b25014728be675d389088667
2015-09-23 12:01:10 +00:00
David van Moolenbroek d91f738bd8 Kernel: export clock information on kernel page
Please note that this information is for use by system services only!
The clock facility is not ready to be used directly by userland, and
thus, this kernel page extension is NOT part of the userland ABI.

For service programmers' convenience, change the prototype of the
getticks(3) to return the uptime clock value directly, since the call
can no longer fail.

Correct the sys_times(2) reply message to use the right field type
for the boot time.

Restructure the kernel internals a bit so as to have all the clock
stuff closer together.

Change-Id: Ifc050b7bd253aecbe46e3bd7d7cc75bd86e45555
2015-09-23 12:00:46 +00:00
David van Moolenbroek 594df55e53 Abstract away minix_kerninfo access
Instead of importing an external _minix_kerninfo variable, any code
using the shared kernel page should now call get_minix_kerninfo(3).
Since this is the only logical name for such a function, rename the
previous get_minix_kerninfo call to ipc_minix_kerninfo.

Change-Id: I2e424b6fb55aa55d3da850187f1f7a0b7cbbf910
2015-09-21 15:09:04 +00:00
David van Moolenbroek ef52a26bab VFS/libblockdriver: enlarge threads stacks for ASR
Change-Id: If4e858bc2dbb2c69850cd265ff612bd5a6119bd3
2015-09-17 17:14:53 +00:00
David van Moolenbroek 0d6c408f48 libblockdriver: suspend threads for live update
Same as for VFS.

Change-Id: I0f09d43f24c32361af5e5658923140c79244d3d1
2015-09-17 17:13:52 +00:00
David van Moolenbroek 728b0e5b34 VFS: suspend threads for live update
- do not allow live update for request and protocol free states if
  there are any worker threads that have pending or active work;
- destroy all worker threads before such live updates and recreate
  them afterwards, because transferring (the contents of) the
  thread stacks is not an option at this time;
- recreate worker threads in the new instance only if they were
  shut down before the state transfer, by letting RS provide the
  original preparation state as initialization information.

Change-Id: I846225f5b7281f19e69175485f2c88a4b4891dc2
2015-09-17 17:13:46 +00:00
David van Moolenbroek 129adfeb53 Annotations and tweaks for live update
This change is necessary for instrumentation-aided state transfer.

Change-Id: I24be938009f02e302a15083f9a7a11824975e42b
2015-09-17 17:13:38 +00:00
David van Moolenbroek 1aad172900 Make more services use stateful live update
Change-Id: If2e5b8e56fef633e471ec1cbb6e08ce3496ea755
2015-09-17 17:12:02 +00:00
David van Moolenbroek 7f79fb8810 Improve asynsend support for process swapping
This resolves various system stalls while running testrelpol.

Change-Id: Ie70fc2dbcdb0a8c9e3800cc0df564be747e111ec
2015-09-17 14:08:30 +00:00
David van Moolenbroek 9b9bea921f Do not instrument malloc implementation variables
Since the heap is reconstructed upon state transfer, the old malloc
state is discarded.  In order to avoid state transfer errors, we can
and in fact must discard the internal state of the malloc
implementation.  This patch achieves this by using the sectionify
pass to mark the variables in the libminc malloc object as state that
must be skipped during state transfer.

Change-Id: Ie330f582c8bd45f37a878ea41fa0f9d4a18045e1
2015-09-17 14:03:47 +00:00
David van Moolenbroek abf8a7e7b3 RS/VM: proper preparation for multi-VM live update
Due to changed VM internals, more elaborate preparation is required
before a live update with multiple components including VM can take
place.  This patch adds the essential preparation infrastructure to
VM and adapts RS to make use of it.  As a side effect, it is no
longer necessary to supply RS as the last component (if at all)
during the set-up of a multicomponent live update operation.

Change-Id: If069fd3f93f96f9d5433998e4615f861465ef448
2015-09-17 14:01:06 +00:00
David van Moolenbroek 2867e60add SEF: query VM about holes during state transfer
The 'memory' service has holes in its data section, which causes
problems during state transfer.  Since VM cannot handle page faults
during a multicomponent-with-VM live update, the state transfer must
ensure that no page faults occur during copying.  Therefore, we now
query VM about the regions to copy, thus skipping holes.  While the
solution is not ideal, it is sufficiently generic that it can be used
for the data section state transfer of all processes, and possibly
for state transfer of other regions in the future as well.

Change-Id: I2a71383a18643ebd36956c396fbd22c8fd137202
2015-09-17 13:43:06 +00:00
Cristiano Giuffrida 75206e2f3e libmthread: Fix guard page mapping.
Edited by David van Moolenbroek to deallocate the guard page as well.
Note that while the new approach is better in theory (previously, the
hole could end up being filled by another allocated page), guard page
protection is now broken in practice, because VM does not support
setting specific page permissions (in this case, PROT_NONE).

Change-Id: I882624f5d152d3ebe82fca649cbad85aa4931780
2015-09-17 13:38:44 +00:00
Cristiano Giuffrida 43065aa378 sef: Support for LLVM ltckpt instrumentation.
Change-Id: I86073bddc3a820ab3d7c5d016ea1348840b0260a
2015-09-17 13:36:35 +00:00
Cristiano Giuffrida 3f82ac6a4e services: Selectively enable stateful restart.
Change-Id: Ibf6afa3041013ca714e28b673abb1329cd72d2d5
2015-09-17 13:36:01 +00:00
Cristiano Giuffrida 3837bb5c0b rs: Add support for RS_FI.
Change-Id: Id8663859accfc4e3587db35dec7000059860fd49
2015-09-17 13:29:47 +00:00
David van Moolenbroek 37489f8a24 Resolve boot-time VM/RS deadlock
VM used to call sendrec to send a boot-time RS_INIT reply to RS, but
RS could run into a pagefault at the same time, thus spawning a
message to VM, resulting in a deadlock.  We resolve this situation by
making VM acknowledge RS_INIT asynchronously at boot time, while
retaining the synchronous sendrec for subsequent RS_INIT responses.

Change-Id: I3cb72d7f8d6b9bfdc59a85958ada739c37fa3bde
2015-09-17 13:27:05 +00:00
Cristiano Giuffrida 0e78c0166c Switch to stateful restart.
The following services have been updated to support stateful restarts:
 - Drivers: tty
 - Filesystems: isofs, mfs, pfs, libvtreefs-based file servers
 - System servers: tty, ds, pm, vfs, vm

Change-Id: Ie84baa3ba1774047b3ae519808fe4116928edabb
2015-09-17 13:26:22 +00:00
Cristiano Giuffrida 2b641b28b1 ds: Add live update extensions.
Change-Id: I093c462ddad4a5e9b3dc39140f45f0e25e83bb55
2015-09-17 13:26:09 +00:00
Cristiano Giuffrida 5c8eb53d49 libsys: mark regions allocated for DMA as special
This ensures that they will not be relocated.

Edited by David van Moolenbroek.

Change-Id: Ic2a97bc65b94dfcf364c06577aa340a9a5299e74
2015-09-16 15:31:55 +00:00
Cristiano Giuffrida 162b8995bb vm: Let SEF know about special mmapped regions.
Change-Id: I742529a6747ddd181937aa1a45264b87677c01c8
2015-09-16 15:31:40 +00:00
Cristiano Giuffrida d196e2c333 sef: Extensions for new RS.
Change-Id: I89b6f8015b1f9c46bf98694450bdaa80b7777940
2015-09-16 15:30:34 +00:00
Cristiano Giuffrida 006d6e94f9 sef: New definitions and event loop refactory.
Change-Id: I0cd0906e513b2b804b94eebc86c76b5c402b572b
2015-09-16 15:30:24 +00:00
Cristiano Giuffrida e6f5b0cc65 sef: Naming refactory.
Change-Id: Id313e73fde577e48a17f2c16c808c9156a1be804
2015-09-16 11:07:18 +00:00
Cristiano Giuffrida dd09614042 sef: GCOV cleanup.
Change-Id: I2e5a6ae10f45108a2c112f78e5a0af4f93e0bed1
2015-09-16 11:07:01 +00:00
Cristiano Giuffrida 63483e02e6 vm: Improve live update support.
Change-Id: I02da3ea32cd05c4ed84a6e199236e5df6e25cb60
2015-09-16 11:06:41 +00:00
Cristiano Giuffrida 48f446ecd5 vm: Extend the vm_memctl() interface.
Change-Id: I87b7c188bd1fc54a3ec943e7ff1d05c6f4c8a56a
2015-09-16 11:04:09 +00:00
Cristiano Giuffrida 704033fd9d libsys: Increase number of static grants.
This is required by the state transfer framework.

Change-Id: I6bc08cee6c70ff406fbd8d45a12721a26c86d45a
2015-09-16 11:03:42 +00:00
Cristiano Giuffrida d639cffec9 libsys: Support for senda_reload().
Change-Id: I67f94515d2b89199643195d32d92f1bef9770359
2015-09-16 11:03:30 +00:00
Cristiano Giuffrida e1f889d228 libsys: Change SEF Live Update state callback API.
The following callbacks are concerned:
 - state_save
 - state_isvalid

Change-Id: I75f71fe162ccd8b23b18cae15f844b79b290a8c1
2015-09-16 11:03:17 +00:00
Cristiano Giuffrida 9e6b1315c3 kernel: Allow kernel calls to return ENOTREADY.
This is required to avoid races with safecopy() at live update time.

Change-Id: I1f3e22d40f22d94bd2b850915f9b8163a08b5616
2015-09-16 11:02:31 +00:00
Cristiano Giuffrida a1760b573b kernel: Extend the {sys,vm}_update() interfaces.
Change-Id: I9ada3c04c08d219b198e9081f4e1942b11c722f6
2015-09-16 11:01:47 +00:00
Cristiano Giuffrida 76bf77a21f kernel: Extend the sys_whoami() interface.
Add support for init flags.

Change-Id: Ibb4d7eb9064d2bbee6d51112ad0c56b2750a5f8e
2015-09-16 11:01:36 +00:00
Cristiano Giuffrida 41022be182 kernel: Extend the sys_statectl() interface.
Change-Id: Ica37640f61513db9466dacf861a8148e3fb799d5
2015-09-16 11:01:15 +00:00