mgmt-gateway: Update to new MGS serialization of large messages#733
Merged
Conversation
mkeeter
reviewed
Aug 29, 2022
mkeeter
reviewed
Aug 29, 2022
Collaborator
There was a problem hiding this comment.
I'm not a huge fan of destructuring in function arguments, but that's just, like, my opinion, man.
Contributor
Author
There was a problem hiding this comment.
Hah, me neither. IIRC this is a relic of trying to get cargo fmt to do something reasonable with a long line before I introduced the SerializedMessageBuf typedef; it was doing something heinous like
buffers: &'static mut [ArrayVec<[u8; SOME_LONG_CONSTANT]>;
2],With the typedef I don't think that's a concern any more, so I'll switch this back.
mkeeter
approved these changes
Aug 29, 2022
f4102ce to
7f4fe83
Compare
Update payloads and serial console packets are now serialized as raw data _after_ a hubpack-encoded message, instead of the data being embedded as part of the hubpack message. Formerly we were required to allocate several moderately-sized arrays on the stack and copy data unnecessarily; now the raw data is borrowed from the receive buffer we pass to `net`, which requires no extra copies or stack allocation of large arrays.
7f4fe83 to
5f441ea
Compare
FawazTirmizi
pushed a commit
to rivosinc/hubris
that referenced
this pull request
Oct 3, 2022
…ecomputer#733) Update payloads and serial console packets are now serialized as raw data _after_ a hubpack-encoded message, instead of the data being embedded as part of the hubpack message. Formerly we were required to allocate several moderately-sized arrays on the stack and copy data unnecessarily; now the raw data is borrowed from the receive buffer we pass to `net`, which requires no extra copies or stack allocation of large arrays.
FawazTirmizi
pushed a commit
to rivosinc/hubris
that referenced
this pull request
Oct 3, 2022
…ecomputer#733) Update payloads and serial console packets are now serialized as raw data _after_ a hubpack-encoded message, instead of the data being embedded as part of the hubpack message. Formerly we were required to allocate several moderately-sized arrays on the stack and copy data unnecessarily; now the raw data is borrowed from the receive buffer we pass to `net`, which requires no extra copies or stack allocation of large arrays.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update payloads and serial console packets are now serialized as raw
data after a hubpack-encoded message, instead of the data being
embedded as part of the hubpack message. Formerly we were required to
allocate several moderately-sized arrays on the stack and copy data
unnecessarily; now the raw data is borrowed from the receive buffer we
pass to
net, which requires no extra copies or stack allocation oflarge arrays.
This is the hubris half of oxidecomputer/omicron#1645, which did the MGS side of this work.
We get significant improvements in flash and stack, and a modest improvement in ram (although it doesn't look like it at first glance). Before this PR:
After this PR:
Our absolute ram usage goes up by about 1k, but our buffers are significantly larger: we can now receive ~1k update chunks (previously 512 bytes), and we can send and receive ~1k serial console packets (previously 128 bytes). Handwaving a bit, I think we have about 1.8k more buffer space for only 1k more ram usage.