Commit graph

115 commits

Author SHA1 Message Date
Sean Cross
fbcbc8dfa1 kernel: fix deadlock in threaded messages
Due to an ordering issue, it was possible for thread message responses
to become deadlocked, wherein a message would get stored in the shared
table in between checking the table value and locking the network
connection.

This change makes a second check of the table after the network
connection is locked, in order to prevent this condition.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 18:12:52 +08:00
Sean Cross
f925011ea2 kernel: fix multiple contexts test
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 14:03:44 +08:00
Sean Cross
9af0fec049 kernel: convert multi-thread test (it's broken right now)
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:54:11 +08:00
Sean Cross
c40e0a138d kernel: convert scalar message test to use processes
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:40:02 +08:00
Sean Cross
1512d2138e kernel: tests: remove excess prints
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:35:15 +08:00
Sean Cross
19222c34a9 kernel: get shutdown and multi-clients working
THis now has proper authentication for tests.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-28 13:28:14 +08:00
Sean Cross
7258fc83b7 kernel: rework process creation
This now uses a system of access keys to associate processes with the
kernel.

This currently does not pass tests.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-27 21:44:50 +08:00
Sean Cross
ab7a56937c create_process: rename from spawn_process
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-27 09:30:43 +08:00
Sean Cross
b9d211af3b xous: begin adding a create_process() call
This will mimic the `create_thread()` call and will obviate our own
process-creation code.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-26 10:54:54 +08:00
Sean Cross
cf992e9b09 kernel: hosted: properly shut down process
This ensures a process with a server can be reused.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:57:35 +08:00
Sean Cross
0c2eb002ec kernel: hosted: use timeout for tcp reading
Previously we were blocking, which used way too much processing power.
Instead, use a timeout of ~200 ms.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:56:39 +08:00
Sean Cross
ca73e8a8dd kernel: test: ensure environment variables are cleared
These interfere with the test.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-23 17:55:48 +08:00
Sean Cross
8242f1b53f kernel: make server IDs 128 bits
This makes server IDs a full 128 bits, and changes the argument to
CreateServer from 32-bits to 128-bits.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 17:28:18 +08:00
Sean Cross
68691a757d kernel: fix hanging shutdown thread and warnings
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 16:23:21 +08:00
Sean Cross
4130ce7bd1 kernel: fix threading and multiplexing issues
Connections weren't getting multiplexed correctly. As a result, they
would respond with the wrong message to a given thread.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 15:51:51 +08:00
Sean Cross
e63e29916a kernel: syscall: move return_memory into its own function
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:18:40 +08:00
Sean Cross
d84fd73cfa kernel: rename mod files for IDE support
If these files are called `mod.rs`, the IDE interface gets really
confusing.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:14:43 +08:00
Sean Cross
cf571ad1ee kernel: more renaming context -> thread
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:13:24 +08:00
Sean Cross
e1bf9965c3 kernel: more renaming context -> thread
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 10:01:57 +08:00
Sean Cross
16d88d8cb5 kernel: syscall: move receive_message to its own function
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:57:06 +08:00
Sean Cross
549866bcd5 kernel: remove printlns, needless context queries
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:52:18 +08:00
Sean Cross
1a6b1160a3 syscall: move send_message into its own function
This breaks up the giant `handle()` function.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-21 09:44:16 +08:00
Sean Cross
42f95e6488 threading: get basic threading tests working
With this, we can now run two "threads" within one process.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 12:23:09 +08:00
Sean Cross
e2296fceac ThreadID: rename from CtxID
Contexts are now renamed to Threads, which better reflects what they
actually are.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 11:04:31 +08:00
Sean Cross
11994d325b kernel: test: add test for server_client_same_process
This is part of `multiple_contexts`, but it's nice to have an explicit
test for this functionality.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:22:26 +08:00
Sean Cross
1216963d24 rename contexts -> threads and spawn -> create
This ensures we're more consistent in naming for these constructs.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:17:46 +08:00
Sean Cross
ba7bb29ce2 kernel: don't block on full queue for Scalar/Move msgs
For Scalar and Move messages, the client does not need to block if the
server does not have any waiting messages. In this case, send an `Ok`
response.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:16:42 +08:00
Sean Cross
506d01fe4a kernel: test: use server_address() to create fn as_process()
This allows us to spawn a new process and set the server address
transparently.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-16 10:04:50 +08:00
Sean Cross
fb32aab691 kernel: testing: move memory profiling into its own test
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 21:24:18 +08:00
Sean Cross
bf15ac08f4 kernel: tests: add memory measurement to test suite
This adds a feature to enable memory measurement, so we can determine if
we're leaking memory anywhere.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 17:08:05 +08:00
Sean Cross
e652150c6e kernel: get multiple message passing working
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-15 16:09:42 +08:00
Sean Cross
0ffbaa369a kernel: fix remaining warnings
This just silences them, which isn't great in the long run.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 15:16:51 +08:00
Sean Cross
b93abcc926 kernel: test: implement mutable borrow
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 15:10:25 +08:00
Sean Cross
d7006e675e kernel: get send_borrow_message test working
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 12:11:57 +08:00
Sean Cross
964b6e0f46 kernel: disable more debug prints
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-14 10:08:49 +08:00
Sean Cross
05d1cf71dc port: use kernel-assigned port number for tests
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:57:30 +08:00
Sean Cross
b388d2e1f4 kernel: use SocketAddr instead of &str
This is easier to copy around and seems to be more informative.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:45:29 +08:00
Sean Cross
8f74159674 rename ImmutableBorrow -> Borrow
THis is more in-line with Rust conventions.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:19:25 +08:00
Sean Cross
85c719643a kernel: tests: factor out common connect code
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 19:15:51 +08:00
Sean Cross
05ccba9450 kernel: implement move test
We can now `Move` memory from one "process" to another.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 18:31:51 +08:00
Sean Cross
40ed6365e2 first memory message works
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-13 17:41:50 +08:00
Sean Cross
acf9b049f7 hosted: start working on memory-based message passing
Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-12 11:18:26 +08:00
Sean Cross
e1a92e929c kernel: replace more unimplemented!() with UnhandledSyscall
This should prevent pacnics when calling unhandled functions.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-04 11:58:18 +08:00
Sean Cross
acfe8e5076 kernel: fix pid termination
Previously, we were recycling PIDs when devices disconnected, however we
weren't cleaning up PIDs within the system-level table.

This now cleans up these entries.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-25 18:15:36 +08:00
Sean Cross
9f1b1e7ec8 kernel: tests: get both tests working
We now have two tests. These tests may be run either in parallel or in series.

If they are run in parallel, then they will each have their own thread
local storage, and each will initialize things from scratch.

If they are run in series, then the thread local storage will be reused
between the two processes.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-25 17:41:17 +08:00
Sean Cross
54a0db50b3 kernel: start using tls
This allows us to run multiple kernels in parallel.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-24 17:51:31 +08:00
Sean Cross
abcba48a2a kernel: add tests
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-24 12:29:04 +08:00
Sean Cross
04faa898c7 hosted: cutting down on println messages
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 16:40:51 +08:00
Sean Cross
cbd8ec3a30 test: get message passing working
We are now able to pass messages around as part of a test.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 15:47:18 +08:00
Sean Cross
e9469991be test: get initial test passing
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-23 14:42:01 +08:00