Commit graph

2817 commits

Author SHA1 Message Date
bunnie
6a6c2aef0f add a thread to respond to suspend requests on the connection manager
the connection manager actually wants a ping on resume,
and when we suspend we suspend -- "it is what it is". However,
the connection manager is a hairball that can block for a while,
so, to prevent failures to suspend, we put the suspend listener
in its own thread, and on resume the suspend listener will
automagically kick out an event to tell the connection manager
to deal with stuff.
2022-03-30 02:29:09 +08:00
bunnie
d8065b76df turn off RTC wakeup alarms
This call was originally part of the RTC driver, but when we
refactored things out, this was forgotten.

So, what would happen is, if you did a coldboot or reboot,
an alarm would get set and...well, the way the RTC blocks
is it'll keep asserting the alarm until you clear it.

This prevents the system from sleeping, and also keeps
the CPU pegged at 100% for some reason. The prevention
from sleeping makes sense to me. The CPU at 100% probably
indicates there's a problem in the event router, but
this path isn't used for anything at the moment so
we'll just open an issue and leave it as technical debt.
2022-03-30 02:27:14 +08:00
bunnie
04d074de1b fix hosted mode build 2022-03-29 22:55:27 +08:00
bunnie
93e22e88bb Merge remote-tracking branch 'origin/xtask-ureq-assets' into bunnie-dev 2022-03-29 22:51:14 +08:00
bunnie
1455ea6d8b clean up the suspend/resume path for the screen and enforce redraw 2022-03-29 22:50:25 +08:00
Sean Cross
e6209302e7 xtask: use assets api for determining URL
Now that we have full JSON parsing inside xtask, actually parse the
assets API endpoint to determine the correct URL.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-29 21:47:32 +08:00
Sean Cross
35857ab543 xtask: replace curl with ureq
The `ureq` package is much smaller, and may be more reliable on Linux.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-29 20:47:37 +08:00
bunnie
c8382a671a move the CPU status bar slightly to address text overflow issues 2022-03-29 16:54:27 +08:00
bunnie
d736d54cee make pddbtest not part of the hw build but part of hosted mode by default 2022-03-29 16:49:18 +08:00
bunnie
e4eed87a55 Merge remote-tracking branch 'origin/main' into bunnie-dev 2022-03-29 16:45:56 +08:00
bunnie
4f1f4a3907 optimize journal resolution code
We have the journals tracked in a HashSet, so, use the hashing
properties instead of an O(N) search.
2022-03-29 16:39:54 +08:00
bunnie
0bdf21b3ac retire debugging infos 2022-03-29 16:33:40 +08:00
bunnie
c542807958 fix PDDB bug where journal numbers on pages were incorrectly restored
An edge case was missed where a page which was allocated out of
the FSCB and then later written to disk was having its journal
number set to 0.

The root cause of the logic issue is that the page table itself
does not store a journal number. It's assumed that the page table
is ground truth, and is unjournaled.

As long as the pages don't exist in the FSCB, that's not a problem,
the journal number doesn't matter.

But, let's say this sequence happens:

1. FSCB allocates some free space
2. process takes that free space allocation and commits it to its own page table
3. FSCB update log gets a note that free space is now allocated
4. system reboots
5. process reads its page table from disk. There are no journals associated
with the page table on disk, so, it assigns a journal number of 0 by default.
6. we now have a conflict between the Process' view of the journal age
of that page table entry, and the FSCB's view.

The fix to this is during the page table scan, to check and see if
any candidate pages happen to already exist inside the FSCB. If it does,
then you adopt the latest journal number for that page in the FSCB.
This keeps the two views consistent.

A second bug was also identified while fixing this where the "Random"
order we were hoping for in visiting the free space cache as an
iterator is less random than we had hoped. So, there is a patch to
extract the free pages and pull one random one from the pool, using
entropy coming from the TRNG. This is less computationally efficient,
but at least it is correct and has more transparent properties
than relying on the indeterminism of the HashSet implementation.
2022-03-29 16:26:55 +08:00
bunnie
bdd194ea7b retire rust issue 90195 work-around in PDDB 2022-03-29 16:25:33 +08:00
bunnie
da89a61a28 retire work around for rust issue 90195 in I2C 2022-03-29 16:24:14 +08:00
Sean Cross
c1237ae023
Merge pull request #126 from qbit/bash
Switch to using env to find the path to bash.
2022-03-29 08:57:47 +08:00
Aaron Bieber
6f98940189 Switch to using env to find the path to bash.
Systems like OpenBSD and NixOS have bash in different locations. This
allows the various scripts to be run on those systems.
2022-03-28 16:43:47 -06:00
bunnie
aaa68def7d
Merge pull request #124 from alextibbles/buildfix
build fix for 5452fae33c
2022-03-29 05:29:53 +08:00
Alex Tibbles
f6030fe213
build fix for 5452fae33c 2022-03-28 17:01:25 -04:00
bunnie
b32cde6870 mute a debug message 2022-03-29 04:54:57 +08:00
bunnie
d074de34d6 add seek tests 2022-03-29 04:40:51 +08:00
bunnie
4eec54620c fix warnings and debug messages 2022-03-29 04:39:33 +08:00
bunnie
9a41b18400 fix bug where dictionaries with 1 entry fail to sync
also ensure that at least 1 byte is reserved for any key
that is allocated; this helps avoid edge cases dealing with
zero-length key entries later on.
2022-03-29 04:38:15 +08:00
bunnie
afb9974309 issue a warning if dup journal entries are found (pdddbg) 2022-03-29 04:37:35 +08:00
bunnie
0cf27be3b0 make the partition on dump vs ci analysis cleaner 2022-03-29 01:53:42 +08:00
bunnie
5f6a21bff1 add some manual test cases that run in hosted mode for pddb
these are helpful for debugging "real" use cases, instead of
the synthetic CI benches that don't fully exercise the file-like
API.
2022-03-29 01:49:47 +08:00
bunnie
55b05cfd80 add debugging routines; fix zero-length key creation case
- add a "dangerous debug" command that only exists when the feature
"pddbtest" is enabled. The feature can't work on real hardware, but
still, it enables things like dumping of the database and storing
the keys for inspection, so it's isolated in a feature that prevents
the code from being compiled in the first place when it's not selected.

- fix a bug where keys that have zero length aren't being created
correctly. this is a common use case for reserving some space for
data that isn't yet available.
2022-03-29 01:47:28 +08:00
bunnie
23041ab1f1 add a dump mode to pddbdbg.py so we can just view records
helpful for manual debugging
2022-03-29 01:47:00 +08:00
bunnie
b1966a2274 Merge branch 'main' into bunnie-dev 2022-03-28 23:30:17 +08:00
bunnie
5452fae33c harmonize blitstr2 and graphics-server to an i16 pixel representation
previously blitstr2 is using usize for x/y coords, which means that
for layout purposes points could not go to the top or left boundary
without causing arithmetic overflow. Of course, you want to render
everything on-screen, but, as we have multi-line text with overflow
possibility, it's reasonable to be able to use negative coordinates
to locate text boxes that flow into the visible region.

This of course means that occassionally you can come out with
things like "negative widths", but even then, there can be reasonable
uses for this as an intermediate in calculations that ultimately
arrive at a positive result.
2022-03-28 23:17:18 +08:00
bunnie
18c202dcee start of testing code for the PDDB 2022-03-28 22:56:32 +08:00
bunnie
287aea90b6 bump to latest version of minifb 2022-03-28 17:49:03 +08:00
bunnie
874a5ac20e bump to latest version of minifb 2022-03-28 17:48:38 +08:00
bunnie
290188f36b try to fix the gh automation 2022-03-28 15:49:22 +08:00
bunnie
6a7ac73034 Merge branch 'bunnie-dev' into main 2022-03-28 15:40:10 +08:00
bunnie
2da52a1d5c fix millis vs seconds bug in hosted mode 2022-03-28 15:39:42 +08:00
bunnie
bd78ba94f1 refactor time setting modals into a separate thread
modals don't work when triggered in the status thread in hosted
mode (but they do, somehow, on real hardware). I think this
is an actual locking problem that would exhibit itself if
we had a true multiprocessor system, but since real hardware
is a single processor it doesn't show.
2022-03-28 15:25:43 +08:00
bunnie
1130bda4a8 add a UX delay to help ensure redraw order when switching apps 2022-03-28 15:25:08 +08:00
bunnie
64ad28cb18 quiet down hosted mode debug messages 2022-03-28 14:44:05 +08:00
bunnie
83da511dc5 fix double redraw issue on menu close 2022-03-28 14:38:26 +08:00
bunnie
cbd36b269b Merge branch 'bunnie-dev' into main 2022-03-28 04:36:50 +08:00
bunnie
6fefd6cdf5 small tweak that makes hosted mode run a little more smoothly 2022-03-28 04:31:37 +08:00
bunnie
c79afd4220 make sure the directory is not deleted 2022-03-28 04:09:57 +08:00
bunnie
6cbc93f8de make sure the directory is not deleted 2022-03-28 04:09:19 +08:00
bunnie
aeef6f26f6 Merge branch 'bunnie-dev' into main 2022-03-28 04:04:55 +08:00
bunnie
c69b9e451d unbreak hosted mode 2022-03-28 04:04:38 +08:00
bunnie
ea6da8becd Merge branch 'bunnie-dev' into main 2022-03-28 03:41:25 +08:00
bunnie
c78273f540 refactor time setting to make a little more sense
now you set time in local time. If time zone hasn't been set already,
it'll prompt you to enter a time zone.

The main oddity is now that you have to know your time zone as
an offset from UTC. This can be fixed later with a proper symbolic
TZ to numeric mapping, but, that's actually a surprisingly hard
feature to implement.
2022-03-28 03:37:27 +08:00
bunnie
91ed8193a7 fix delete commands to sync and also make keyword ordering parallel 2022-03-28 03:37:04 +08:00
bunnie
ae0b1f1288 fix bug in dict delete.
also soften a journal fault message to help with debugging.
that it no longer panics does not mean it is right...
2022-03-28 03:36:27 +08:00