Commit graph

76 commits

Author SHA1 Message Date
bunnie
b1a37037dd add more debugging logic 2022-06-28 01:14:11 +08:00
bunnie
89e7849bc5 improve debug output 2022-06-27 18:22:25 +08:00
bunnie
e32ea4d3f5 fix #174 2022-06-10 21:36:53 +08:00
Sean Cross
3ae9d8abf0 apps/services: remove xous::xous_main macro usage
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-31 13:33:30 +08:00
bunnie
3fccc6c314 fix hosted mode error 2022-05-24 17:06:43 +08:00
bunnie
058e3480df add facility to help debug stalled suspend/resume 2022-05-23 13:50:40 +08:00
bunnie
424f8feab7 advance timer state by +1 ms on suspend to avoid double-interrupts on resume
Issue #159 may be caused by queueing a connection to respond to when
the timer expires, but if the timer expires twice then it tries to
respond to a null connection id.

And if it goes to suspend in the same millisecond as it services the
condvar, then it'll reissue the interrupt when it comes back from
suspend.
2022-05-23 13:50:30 +08:00
bunnie
0aa2f21f0b make scheduler quantum a visible parameter, and adjust to 10ms down from 20ms 2022-05-12 17:49:03 +08:00
bunnie
1261d73451 remove execution gate server and use deferred callback idiom instead
reduces one connection on all PIDs that require suspend/resume
callbacks; lightens kernel by about 16k runtime load
2022-04-07 01:13:49 +08:00
bunnie
ec4515579c stashing a bit of code so i can remember how to conjure a delay in susres 2022-03-31 01:44:48 +08:00
bunnie
8b5ad2657b an aborted attempt at doing a clean-shutdown for hosted mode
This doesn't work because the shutdown call destroys all the servers then terminates
the processes. But, the problem is that the processes are still
running, but servers are disappearing. So what you end up with is a
panic when the first message gets delivered to a server that no longer
exists, and then you end up with the program hanging on that panic
because some servers haven't been destroyed/exited yet and are now
just spinning waiting to be scheduled. so the call works in the tidy
kernel test cases but to get it to work on a full OS you'd need to
have a way to put every server into an eternal blocking state before
making the shutdown call (to prevent new messages from being issued
while servers are going away), which is more work than i'm willing to
put into the problem right now.
2022-03-31 01:10:58 +08:00
bunnie
c503316c3d refactor suspend/resume ordering
Add a "Later" stage, and have exactly one "Last" stage.

"Last" to suspend is the ticktimer -- this is crucial for
basically everything else to work. The other really
low level stuff that needs to work to the last minute is
now in the "Later" bin.
2022-03-30 02:30:39 +08:00
bunnie
4df39797c1 fix issue #101 based on @xobs changes 2022-02-15 17:36:53 +08:00
bunnie
827888ccbb fix up the REFCOUNT on connections
Was doing disjoint loads and stores on an Atomic, really, should
be using the fetch_add, fetch_sub variants to be proper.

Didn't seem to impact anything but maybe there's a future version
of me that high fives me for doing this.
2022-01-31 23:13:10 +08:00
bunnie
5a1139a367 move cache flush on susres to just before the suspend event
- also nail down the interrupt handlers from firing from the COM
during suspend
- ensure that connects don't happen while scanning
2022-01-27 22:05:38 +08:00
bunnie
3f2f304202 refactor connection manager to be more responsive to suspend/resume 2022-01-27 13:46:43 +08:00
bunnie
18130cddae fix suspend/resume regression
had to pin down the correct order of events to avoid lockups on suspend
2022-01-17 22:46:18 +08:00
bunnie
69eefb3e64 add a reboot command to the main menu 2022-01-12 14:00:31 +08:00
bunnie
eb0c1c4377 fix some hosted mode brokeness that came with pinning crates
the rand api was downgraded to be in line with the ed25519 crate
which removed some "modern" conveniences. Small price to pay for
less code to review.
2022-01-10 17:13:00 +08:00
bunnie
b3788a54af clarify the dependency policy 2022-01-10 16:50:10 +08:00
bunnie
995915ed4e nail down a couple more dependencies, and add a policy note to Cargo.toml
Each Cargo.toml now includes a comment which remnids maintainers
of the dependency policy for Xous (that is, nail down every dependency
to the minor number).
2022-01-10 15:54:27 +08:00
bunnie
dd943c5416 pin down versions and harmonize versions across servers
Versions are pinned down to the minor number. Yes, this means that
we don't automatically pull in features and bug updates from crates.io,
but it also means we don't pull in new attack surfaces and code that
hasn't been tested or reviewed. I'd like this process to be very deliberate
and not automatic for Xous.

The `rand` crate is almost pinned down to a single version, except
for an odd dependency that's pulled in by hosted mode that depends
on rand 0.8.4 via a subordinate dependency via the `tempfile` crate.
Pondering if it's worth it to try and eliminate that, because the
0.8.4 version doesn't get compiled into any version that touches
real hardware. It just makes it harder to analyze the Cargo.lock
file, mostly. I think I'll leave it as-is.
2022-01-10 15:39:55 +08:00
bunnie
c5fe1bc99b add sequencing to suspend/resume order of operations
this is necessary because we want to make sure that the SPINOR
service does not shut down before the PDDB service finishes syncing
its disks.
2022-01-10 13:45:56 +08:00
bunnie
489a26dd11 fix an issue where we don't decrement the connection counter on drop 2022-01-05 20:01:54 +08:00
bunnie
8da2364832 clean out some old debug cruft in the susres crate 2021-10-30 19:15:32 +08:00
bunnie
5df4e38caf add some debug helpers for suspend/resume 2021-09-18 02:19:43 +08:00
bunnie
21fb59c4d9 fix incorrect &mut self in library call 2021-09-16 03:53:36 +08:00
bunnie
dbab3d2b27 adjust L2 cache flush region to 512k
although te cache is only 128k, experiments show that the cache
is not reliably flushed until 512k is written. Not sure why...
2021-08-29 18:28:25 +08:00
bunnie
f4232a3236 stabilize suspend/resume a bit
- introduce wfi backoff during the suspend process
- increase the region of cache flush - seems to improve
stability
- remove some print calls to avoid interference during
the sleeping process
2021-08-29 12:04:20 +08:00
bunnie
e2ce3cad2c make sure that the power states get set correctly early in the resume process 2021-08-27 15:47:27 +08:00
bunnie
57574495d8 handle case of sleep request before resume is fully completed 2021-08-24 23:35:32 +08:00
Sean Cross
b86e0a65cd services: recognize xous as a hardware OS
Support `xous` as a valid OS. This allows us to build the entire kernel
under this target.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-02 18:11:48 +08:00
bunnie
1949c1bbc9 a semblance of sanity, finally 2021-07-09 23:01:50 +08:00
bunnie
6c697de512 add l2 cache support (suspend/resume flushing)
also noted some performance benchmark improvements
2021-07-05 17:05:10 +08:00
bunnie
3f08dcccee increase the susres timeout to be less aggressive
now that we have auto-clock throttling, fast SR cycles are not
as critical to power saving. They are more a mechanism to be
invoked based on user command, not automatically, and thus it's
not as critical to shut things down ungracefully if the CPU is
heavily loaded.
2021-06-30 19:05:20 +08:00
bunnie
5d21ef0c76 beginnings of the curve25519 accelerator engine core driver
the engine-25519 server just takes microcode jobs and runs them
on the curve25519 accelerator engine.

all the fancy crypto stuff comes from other crates, which will
be filled in later.
2021-06-22 01:48:51 +08:00
bunnie
69a22adee9 menus basically working 2021-06-19 00:25:18 +08:00
bunnie
aa967a5a17 quiet up hosted mode build warnings 2021-06-18 22:37:08 +08:00
bunnie
eee9f4e765 refactor xous-names to permit only a fixed number of connections
this prevents less trusted processes from connecting to servers
after the kernel initializations are done.

this works so long as we don't have disconnects from the kernel
servers. In order to support disconnects we will also need a
way to re-enumerate the SID to guarantee that we don't have a re-use
problem. But for now, the kernel is not designed with any practical
disconnect mechanism; there is no code that calls the Quit mechanism
on any server.
2021-06-15 17:41:14 +08:00
bunnie
fadc9c29ab Merge remote-tracking branch 'origin/master' into bunnie-dev 2021-06-02 03:59:25 +08:00
bunnie
afe8d8733d updates to use the always-on power domain timers 2021-05-30 04:29:03 +08:00
bunnie
7529628053 partial progress on EC updater 2021-05-24 04:34:50 +08:00
bunnie
30aa794f30 add reference counting on connections between servers
the connection number is re-used for all objects created
within a process space, so you can't `Drop` the connection
immediately when an object goes out of scope. You have to
make sure all instance of the object go out of scope. This
patch adds reference counting to all the objects so that
the `Drop` function works as intended.
2021-05-21 16:24:30 +08:00
Sean Cross
eb7895d601 xous: add a return code to TerminateProcess
As part of this refactor, make `terminate_process()` a divergent call.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-20 11:01:00 +08:00
bunnie
d44ad58637 sha512 now compiling, at least. 2021-05-20 03:29:26 +08:00
bunnie
69576695bf give a little more time for the suspend
right now some graphics ops aren't completing.
2021-05-11 16:51:52 +08:00
bunnie
7dd66a4c18 playback is mostly working and stable 2021-05-07 05:42:39 +08:00
bunnie
05df98d1c1 disable suspend/resume support in hosted mode
hosted mode doesn't have suspend/resume support, and it's
not worth debugging subtle issues on that side of the fence
that seem to be OS-dependent.
2021-05-02 16:10:51 +08:00
bunnie
0621fed5d6 back up debugging statements 2021-05-02 12:51:41 +08:00
bunnie
b17753ce8b retrofit the rest of the servers for suspend/resume
we can now do suspend/resume in the xous chat!
2021-05-02 01:38:44 +08:00