Skip to content

Commit 2318367

Browse files
committed
docs(rng-buf): Clarify spec diff and add impl plan
- Reference the "Difference from virtio spec" section from summary - Rename section to "Difference from virtio spec" - Reflow packed ring explanation for readability - Add an implementation plan and future work outline Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
1 parent cd4eab1 commit 2318367

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

proposals/0001-rng-buf/README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- [Implementation History](#implementation-history)
2727
- [Drawbacks](#drawbacks)
2828
- [Alternatives](#alternatives)
29-
<!-- /toc -->
29+
<!-- /toc -->
3030

3131
## Summary
3232

@@ -38,7 +38,8 @@ as streams, RPC, and other I/O patterns in both single-threaded and multi-thread
3838

3939
The design leverages virtio's well-defined publishing/consumption semantics and memory safety
4040
guarantees while adapting them to Hyperlight's specific needs. Since we control both ends of the
41-
queue, we can deviate from strict virtio compliance where it makes sense.
41+
queue, we can deviate from strict virtio compliance where it makes sense (see
42+
[Difference from virtio spec](#difference-from-virtio-spec) section).
4243

4344
## Motivation
4445

@@ -206,10 +207,10 @@ with atomic publishing of flags ensure that the other side will never observe a
206207
- Driver: Write descriptor fields ? memory barrier ? atomic Release-store flags
207208
- Device: Atomic Acquire-load flags ? memory barrier ? read descriptor fields
208209

209-
Because the packed ring reuses the same descriptor slot for both `available` and `used` states and both
210-
sides only poll a single next slot, each side needs to differentiate between "this change belongs to
211-
the current lap in the ring" and "this is an old value from the previous lap." This is done using
212-
"wrap" counters:
210+
Because the packed ring reuses the same descriptor slot for both `available` and `used` states and
211+
both sides only poll a single next slot, each side needs to differentiate between "this change
212+
belongs to the current lap in the ring" and "this is an old value from the previous lap." This is
213+
done using "wrap" counters:
213214

214215
- Each side keeps a boolean "wrap" flag that toggles when it passes the last descriptor in the ring,
215216
- When the driver publishes an available descriptor, it sets `AVAIL` to its wrap bit and `USED` to
@@ -355,7 +356,7 @@ descriptor layer or in the flatbuffer schema:
355356
Snapshotting requires that the descriptor table has no in-flight guest-to-host requests and any
356357
attempt to snapshot a sandbox with such pending requests will result in a snapshot failure.
357358

358-
### Difference from spec
359+
### Difference from virtio spec
359360

360361
- Do not support indirect descriptor table (can be deferred to future work if needed),
361362
- Do not support feature negotiation, set of features is fixed for driver and device,
@@ -721,6 +722,23 @@ impl RingReceiver
721722
- Performance benchmarks vs. current VM exit approach
722723
- Stress testing under high load
723724

725+
### Implementation Plan
726+
727+
As proposed, the queue will eventually replace the current stack‑based mechanism for function calls.
728+
The initial implementation will be gated behind a feature flag. The work can be roughly broken down
729+
into:
730+
731+
- Introduce a low‑level queue implementation that operates on shared memory.
732+
- Introduce a serialization trait for data that can be safely sent through the queue.
733+
- Introduce a high‑level API over the queue.
734+
- Integrate the queue infrastructure with the existing memory model and function‑call API.
735+
736+
Future work includes:
737+
738+
- Adding `Future` and `Stream` as function argument and return types.
739+
- Supporting host and guest running on separate threads.
740+
- Providing an asynchronous API for function calls, streams, and related workflows.
741+
724742
## Implementation History
725743

726744
- **2025-11-12**: HIP proposed

0 commit comments

Comments
 (0)