Skip to content

Make hiffy callable over the network#2466

Open
mkeeter wants to merge 3 commits intomasterfrom
mkeeter/hiffy-net
Open

Make hiffy callable over the network#2466
mkeeter wants to merge 3 commits intomasterfrom
mkeeter/hiffy-net

Conversation

@mkeeter
Copy link
Copy Markdown
Collaborator

@mkeeter mkeeter commented Apr 8, 2026

For too long, a network-attached Humility has only been able to run a subset of hiffy programs (ones that exclusively use the Send operations, using the udprpc hack). This PR adds a net feature to the hiffy task, restoring it to full usefulness when network-attached.

hiffy accepts three messages:

  • Write program text
  • Write data
  • Kick (begin execution)

For simplicity, these messages only write to RAM. Even the HiffyKick message doesn't actually start execution itself; it just sets the HIFFY_KICK variable, which is checked the main loop. This mimics the behavior of the debugger.

Interestingly, we don't need any new infrastructure to read the results; we can use the existing RAM-reading infrastructure.

Unfortunately, Github is butchering the diff here. The existing code (look for kick, run program) is unchanged but for indentation, because we have two notifications (timer and net activity). If the new net notification fires, then we handle the packet in a new net::State object.

I'm opening this as a draft while I polish up the Humility side, but it's ready for review now.

@mkeeter mkeeter force-pushed the mkeeter/hiffy-net branch 7 times, most recently from d116c1e to 54b42af Compare April 13, 2026 15:27
@mkeeter mkeeter marked this pull request as ready for review April 14, 2026 14:32
@mkeeter
Copy link
Copy Markdown
Collaborator Author

mkeeter commented Apr 14, 2026

Marking this a ready-for-review now that oxidecomputer/humility#616 is out

@mkeeter mkeeter force-pushed the mkeeter/hiffy-net branch from 54b42af to b95a834 Compare April 14, 2026 15:22
Copy link
Copy Markdown
Contributor

@lzrd lzrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would fix the repeated literal constants.
It would be nice to see all of the loop timing and retry constants be together.

Comment thread task/hiffy/src/main.rs
sleeps = 0;
// Exponentially backoff our sleep value, but no more than 250ms
if sleeps == 10 {
sleep_ms = core::cmp::min(sleep_ms * 10, 250);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same literal constant repeated. Make it symbolic.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you suggest names for these constants? The first 10 is "number of iterations to run between updates to sleep_ms", the second 10 is "scale factor between updates"; neither of them have a good pithy name.

(This is also unchanged from the previous code, just indented)

Comment thread task/hiffy/src/main.rs
rstack,
&mut *HIFFY_SCRATCH.borrow_mut(),
check,
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're in an intentional insecure mode. But, do we at least get an integrity check on the network transport? There isn't one at this layer. This is debug/YOLO mode, but a light check to scope a data corruption error would be good.
Maybe just a comment on data integrity for now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use IPv6 UDP, which has a 16-bit checksum. This is true for all Hubris network activity, so calling out Hiffy as uniquely bad doesn't make sense to me.

@mkeeter mkeeter force-pushed the mkeeter/hiffy-net branch from b95a834 to 1dc7422 Compare April 16, 2026 19:19
@mkeeter mkeeter force-pushed the mkeeter/hiffy-net branch from 1dc7422 to 9dfe770 Compare April 16, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants