54 Commits

Autor SHA1 Mensagem Data
George Kulakowski 37b8cd3f39 [syscalls] Remove mx_timer_start
Change-Id: I35863de22152735f0050a01e388711f2b8e73050
2017-08-16 18:51:57 +00:00
Carlos Pizano 48014701ac [magenta][docs] update syscall.md
with timer_set syscall.

Change-Id: I6f994f8db2954459a7de1fa0432a6f6f5ee87c9c
2017-08-10 19:38:32 -07:00
Dave Bort 4ad3c7671c [syscalls][jobs] Add mx_job_set_relative_importance
Updates a partial ordering between jobs so that job A will be killed before
job B in low-resource situations. Will be used by the out-of-memory (OOM)
ranking service to tell the kernel which jobs to kill first.

No actual OOM killing happens yet.

Also adds the 'k mx jobs' command which dumps the list of all jobs in
importance order.

This reverts commit b92f1a1, which reverted the original commit f97f9fe.
Changes relative to the original commit:
- Avoids wrapping parent_->jobs_ elements in RefPtrs, thus ensures that
  this code won't unintentionally resurrect a job that's in the middle
  of destruction.
- Doesn't hold importance_lock_ as long as before, which isn't critical
  but wasn't necessary.

Change-Id: I82bbf993349004ee8007c28597bc5a995dd15150
2017-07-26 18:55:32 +00:00
George Kulakowski 2b858301a6 [docs] Link to mx_vmo_clone from the table of contents
Change-Id: I63e653a75d274b1a55916ff72b273fd262a72f2a
2017-07-21 10:27:25 -07:00
Dave Bort b92f1a1282 Revert "[syscalls][jobs] Add mx_job_set_relative_importance"
This reverts commit f97f9fe16c.

Reason for revert: Saw a kernel panic (double-acquire of a mutex) in this code on one of the buildbots.

Original change's description:
> [syscalls][jobs] Add mx_job_set_relative_importance
> 
> Updates a partial ordering between jobs so that job A will be killed before
> job B in low-resource situations. Will be used by the out-of-memory (OOM)
> ranking service to tell the kernel which jobs to kill first.
> 
> No actual OOM killing happens yet.
> 
> Also adds the 'k mx jobs' command which dumps the list of all jobs in
> importance order.
> 
> Change-Id: I818dd4e6bdb891a6cc4b4468215d23d479fa58f6

TBR=cpu@google.com,swetland@google.com,dbort@google.com

Change-Id: Ia78c261f68f1cdc75e39869730e2644ae4716634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
2017-07-20 03:21:09 +00:00
Dave Bort f97f9fe16c [syscalls][jobs] Add mx_job_set_relative_importance
Updates a partial ordering between jobs so that job A will be killed before
job B in low-resource situations. Will be used by the out-of-memory (OOM)
ranking service to tell the kernel which jobs to kill first.

No actual OOM killing happens yet.

Also adds the 'k mx jobs' command which dumps the list of all jobs in
importance order.

Change-Id: I818dd4e6bdb891a6cc4b4468215d23d479fa58f6
2017-07-20 01:31:12 +00:00
George Kulakowski 4d2de34af0 [magenta] Remove waitsets
Change-Id: I7343360e054690eefd9abcf01863e78bc4eba122
2017-06-27 19:57:48 +00:00
Carlos Pizano 99e59186a1 [kernel][magenta] Remove PortsV1 bind()
This CL removes mx_port_bind() but more importantly
it removes PortClient from the channel, resource and socket
making them faster and easier to reason about.

The only PortV1 customer not in transition is the exception
dispatcher which does not bind().

Change-Id: I48295cc64bba0dd664194eeadb5455b043483b67
2017-06-26 20:45:03 +00:00
Carlos Pizano 867cff6b11 [magenta][docs] document timer_start and cancel
This completes the documentation for the current
timer implementation.

Change-Id: If3a71cafa6b0e699cb9e2c9b7cdc4b432683a586
2017-05-31 23:55:02 +00:00
Joe Armstrong b0d7a72f5b [docs] fix title Task => Thread
Change-Id: I6af99154dda59342182f4a73959f7fe7b95f4a14
2017-04-18 10:42:49 +08:00
George Kulakowski 7c642bcc6a [docs] Add objects.md and objects/foo.md pages
Change-Id: I95b6a42330f8b9d3711c5c894aeaf88a9256f2de
2017-04-12 19:01:31 +00:00
Carlos Pizano 5cc6b5bb15 [kernel][magenta] Remove mx_handle_cancel syscall
Superseeded by mx_port_cancel(), its other uses are
not that great.

Change-Id: I5dee60ffb6853ab09ac621d240772bb23cfbc71a
2017-04-10 22:41:29 +00:00
Carlos Pizano edcee67bbb [system][libmx] Add port_cancel to mx
And a bit of documentation.

Change-Id: I3425efd8f9d01c675d2ad5a37338a1f2d88d9894
2017-04-07 22:57:10 +00:00
Brian Swetland 3d9891c27b [object] add mx_object_set_cookie(), mx_object_get_cookie()
Initially cookies are supported on Events, VMOs, and Resources.

Change-Id: Iae0c9aaf6f05177be6872e5aa00774932926b4d1
2017-03-26 21:53:08 -07:00
Brian Swetland f7c7cda5eb [syscalls] rename object_wait_cancel to handle_cancel
1. This acts on handles, not the objects behind them

2. Operations canceled are not limited to just object_wait_*()

Change-Id: I6b116e966217972bc5d77c7e1f90e864ab2c6406
2017-03-16 03:11:34 +00:00
Carlos Pizano 9f6eb0d095 [kernel][magenta] Odds and ends for async wait
- Update the docs with the two new syscalls
- move the options param of cancel to the end
- add an libmx cancel call

Change-Id: Ib88312c4fd4bd1a7db4adb42830e0b634b792a59
2017-03-03 16:29:59 -08:00
Roland McGrath 6da13538c1 [ulib][magenta] Add mx_system_get_physmem vDSO call
Also make musl's POSIX.1 sysconf(_SC_PHYS_PAGES) use it.

MG-544 #done

Change-Id: Iec56e78174f7ba7495750d14bfb696dd7a934a84
2017-02-27 22:37:39 +00:00
Roland McGrath fd1421ffe6 [docs] Document mx_system_get_num_cpus and mx_system_get_version
Also added a missing link in syscalls.md.

Change-Id: I6445064041e07a71b7c283228a28cee514b8c498
2017-02-27 22:32:04 +00:00
Christopher Anderson 9c57c8b98e [syscalls] object_bind_exception_port -> task_bind_exception_port
MG-535 #done
Change-Id: Icf61537df9417a18d9a7ff9f5eef15ca5fc939b7
2017-02-24 14:25:23 -08:00
Roland McGrath 01b25b52f5 [ulib][magenta][musl] Stop leaking detached threads' descriptor blocks
This adds a three-in-one vDSO call to roll together mx_vmar_unmap,
mx_handle_close, and mx_thread_exit so a thread can deallocate the
very same stack it's using to call into the vDSO.  With this,
detached threads exiting can do their last bit of cleanup so there
are no leaks and no other thread is required to do it later.

MG-549 #done

Change-Id: I4c872aa847582aa18042b8fca3c22f26f6e52e2a
2017-02-24 19:53:06 +00:00
Brian Swetland 046a516922 [docs] update manpages for object_signal and object_signal_peer
Change-Id: I550ab833692763c6d3ffb7d1ba6fc52c50c2855c
2017-02-10 15:08:52 -08:00
Brian Swetland 0c9d6f13fa [syscalls] rename mx_handle_wait_*() to mx_object_wait_*()
These act on the object the handle refers to, not the handle itself.

Compatibility wrappers are provided to ensure existing code
continues to compile, link, and run.  Later we will deprecate
the wrappers and eventually remove them.

Change-Id: Icf69e75f7e0c060ba6026343f9d26ff9da4317d9
2017-02-10 15:08:52 -08:00
Brian Swetland 00f8d61455 [syscalls][fifo] new improved fifo objects
The new fifo objects are actual fifos, not just bookkeeping entities.

They are intended for small control plane packets for shared memory
interfaces and are designed to be cheaper than sockets or channels
(simpler code path, never allocate along read/write, etc), as well
as having a much more understandable and safer interface than the
old "clever" fifo objects.

Change-Id: Ie020c8c841b20c76b98ab8b08ba81601c2f3444b
2017-02-10 00:10:10 -08:00
Brian Swetland 0c5a556236 [syscalls][fifo] rename mx_fifo_*() to mx_fifo0_*()
The fifo object has been judged a failed experiment and soon will
be replaced by a new, better fifo object.  This change moves the
original out of the way and updates the only clients (the unified
ethernet driver, client library, and unit test).

Change-Id: I050c5903ba063d30a26b7b72f45000248e472faa
2017-02-07 18:15:56 -08:00
Doug Evans 76447211b8 [kernel][syscalls] Add docs for thread_r/w_state
Also recognize ERR_NOT_SUPPORTED,ERR_UNAVAILABLE in debugger
test as they're not fatal errors.

Change-Id: I0e35b726619829a2861aa07b3c722aee7b6f5bad
2017-01-30 21:19:40 +00:00
Brian Swetland ec865bb32a [magenta][syscalls] implement mx_channel_call()
This is a fused write-wait-read syscall for the use of synchronous rpc
callers.  The kernel treats the first uint32_t of the outbound message
as a transaction ID and accepts an inbound message with a matching txid
as a reply, completing the transaction.

This allows multi-threaded calling of synchronous rpc transports
with no userspace bookkeeping required and will provide an opportunity
for smarter scheduling of such transactions in the future.

Change-Id: Ifbb92b36618ebf13a6e52c650d16fed9f5071c3a
2017-01-19 14:00:24 -08:00
Abdulla Kamar 38f77ec75a [kernel][syscalls] Remove mx_thread_arch_prctl.
We no longer need mx_thread_arch_prctl for TLS or for tracing, so we can remove
the syscall altogether.

MG-40 #done

Change-Id: I8b7b38f4382060cba783347c9ca4b52d52f26844
2017-01-19 15:26:33 +00:00
Abdulla Kamar e04aff9323 [kernel][syscalls] Add mx_ticks_per_second to return ticks per second.
Together with mx_ticks_get, this can be used to calculate the amount of time
elapsed between two calls to the high-precision timer.

MG-392 #done

Change-Id: Ie1660ce546f544043e562c265f4d10c7dc0301f6
2017-01-12 23:26:19 +00:00
Abdulla Kamar 91b07dc74e [kernel][vdso] Add mx_ticks_get to return number of ticks since boot.
This adds a vDSO call for returning the number of high-precision timer ticks
since boot. There's currently one issue: ARMv6 and ARMv7 only support a 32-bit
range.

MG-392 #comment

Change-Id: I0fa83295342a9f4227e8705e3f8fcfbd23274c8c
2016-12-22 00:37:03 +00:00
Todd Eisenberger 2d1c46fe68 [vm] Implement new VM Address Region syscall interface
For compatibility, allow passing a process handle instead of a VMAR
to the vmar_map/unmap/protect calls and add usermode shims that
translate the old syscalls into the new ones.

Change-Id: I9ba29921d45f47d0d068e46e113dac1d139fce52
2016-12-15 23:58:05 +00:00
Tim Kilbourn ceb9174770 [kernel][magenta] Add fifo state kernel primitives
A kernel fifo is a pair of head/tail pointers that can be shared
between processes to track the state of a fifo.

Change-Id: Ide7c4a3a40b0e71e106b1d23f9419f6dc69fbc4b
2016-12-15 09:50:30 -08:00
Roland McGrath af4b1dec58 Remove data pipes
All remaining users in Fuchsia have migrated to other facilities.

Change-Id: Id1622b5867f761d95b8ec3a4e90d19fc84321ea1
2016-12-08 18:26:52 +00:00
George Kulakowski ef70c47c67 [docs] Add stubs for all remaining syscalls
This doesn't include debug or DDK syscalls, or syscalls that will go
away in the Grand Resourcening.

Change-Id: Ic25211908d66189c26d0694a8fd0884a6d05069c
2016-11-29 16:22:42 -08:00
George Kulakowski 7b6eb08801 [docs] Fix the location of the nanosleep manpage
This was the only documented syscall that didn't fit the pattern of
documenting mx_foobar() at foobar.md.

Change-Id: I5ad1e4512bea2c5f121ab493961debbb99673d38
2016-11-29 22:24:30 +00:00
Brian Swetland ce076b3a80 [syscalls] simplify mx_object_get_info()
The new simplified API is friendlier, easier to use, and easier
to correctly implement in the kernel.

Change-Id: Id376b9fbeb5f4f56ae78f9ca6f5f1f7d63611fba
2016-11-17 19:19:12 -08:00
George Kulakowski a39228c264 [docs] Add socket man pages
Change-Id: Icb7debc576fc46777f38a7e47170a19eed854062
2016-11-17 10:41:39 -08:00
Travis Geiselbrecht 63a28e08fd [docs][syscalls][vmo] start some simple syscall docs for vmos
Change-Id: I428d83224d977e83d8e3a543984a903d2615c0a1
2016-11-17 00:26:36 +00:00
Roland McGrath 53a9684b9c [ulib][magenta] Add mx_version_get vDSO call
mx_status_t mx_version_get(char* ver, uint32_t len)

Probably temporary in form but very useful.
The string returned can be used with "git show".

- Print version in MOTD
- Change dot for '-' from MOTD, it does not show in graphical console

Change-Id: Ic777d6c04ce31daa3846a90ec6ec75c5ac820d96
2016-11-14 21:51:00 +00:00
Carlos Pizano 9a65e2293d [kernel][syscalls] Add object_signal_peer() syscall
My previous CL (14136) introduced user signals for all objects that are
waitable. This CL adds a new syscall so for two sided objects
the side that gets signal is clear

- object_signal(handle, clear_bits, set_bits)  signals the side
attached to the handle
- object_signal_peer(handle, clear_bits, set_bits) signals the
opposite side to the handle

If and object does not have 'other side' the syscall return
is ERR_NOT_SUPPORTED.

This CL does not address the Channel Object which needs
other changes first.

Change-Id: I83a8b0dff3027aa59f64933ba708ac9bccb67d8b
2016-11-09 02:18:26 +00:00
Brian Swetland 917c9f64cb [docs] update list of syscalls
- add syscalls without manual pages
- add descriptions

Change-Id: Idd8625981eadc4c554f91cd6be7a2973c630931e
2016-11-04 23:46:33 +00:00
Brian Swetland 379783366a [syscalls] mx_current_time -> mx_time_get, mx_exit -> mx_process_exit
Change-Id: I94996acc50b3279f8dc9c353a9faad61f401ddc1
2016-10-27 21:10:45 -07:00
Brian Swetland 0a2c820b1f [syscalls] mx_msgpipe_*() become mx_channel_*()
Compatibility wrappers are provided for the deprecated mx_msgpipe_*() syscalls

Change-Id: I7ad9c1b7e3bb7d1390b284b5542d30b20eb4ecd7
2016-10-27 20:54:13 -07:00
Sean Klein f25780521b [docs] Added documentation for mx_current_time
Change-Id: I803924f140cf3e3b6eede89fae5f6fea566c3e6b
2016-10-17 00:13:10 +00:00
Viet-Trung Luu cb97c1ff7c [docs] Some data pipe doc fixes/updates.
Change-Id: I01c71b28ce2280fb87dbd5b3a86726b39af9740f
2016-09-13 15:47:10 -07:00
Adam Barth 03f63fd934 Add some shell man pages for map and unmap
These pages include some things that weren't obvious to me the first
time I tried using these functions.

Change-Id: If40d818deb3b0e257c101e7c33db2034b0409697
2016-09-11 15:19:55 +00:00
Viet-Trung Luu 362e0dd0f2 [magenta][syscalls] Add event pairs.
Change-Id: I0eafae9130bdd08446fdaaac2c275519e363cd39
2016-09-07 14:15:38 -07:00
Brian Swetland 5d040605c3 [docs][syscalls] thread and process manpages
Change-Id: I539c21a5e6fbf56da1609d4daec00dc7e5d80c63
2016-09-04 14:31:01 -07:00
Brian Swetland dc1fd725f6 [magenta][syscalls] migrate all syscalls to the new names
If DEPCRECATE_COMPAT_SYSCALLS is defined, flag the compatibility
wrappers with the deprecated attribute.

Enable this in the Magenta build only for now.

Change-Id: I422b1294d9db2e56551eca65dede0e5d83f8b363
2016-08-30 01:07:41 +00:00
Viet-Trung Luu 32075f3f6f [magenta][syscalls] Add mx_handle_replace().
Basically like mx_handle_duplicate(), but doesn't duplicate (instead it
invalidates the original source handle) and doesn't require the
"duplicate" right.

This can be used to reduce the rights of a handle (but it yields a new
"replacement" handle), in particular of non-duplicatable handles.

Also fix handle-info-test:
* Actually run handle_rights_test.
* Actually fail correctly (the CHECK macro, which is now gone, returned
  __LINE__ on failure)

Change-Id: I4c2724d5aa6a36ebf1e084b2ff329f8da5453804
2016-08-24 01:23:51 +00:00
Viet-Trung Luu 7cd359b9f5 [docs] Add docs for wait sets.
Change-Id: Idd8d83b3da7c54e572a362a81079c615530539f4
2016-08-01 22:15:50 +00:00