Skip to content

Serve broker calls on per-call lanes - #1688

Merged
Weidong Cui (wdcui) merged 12 commits into
uliteboxfrom
wdcui/ulitebox/broker-lanes
Oct 25, 2026
Merged

Weidong Cui (wdcui) merged 12 commits into
uliteboxfrom
wdcui/ulitebox/broker-lanes

Conversation

@wdcui

@wdcui Weidong Cui (wdcui) commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

This PR replaces the userland broker's shared request/response rings, pending-call registry, and receiving-role hand-off between broker workers with per-call lanes. Each runner call claims the lowest free single-slot lane in the control ring, and the broker lazily starts one worker per demanded lane, so concurrent guest calls no longer contend on shared rings or rely on another thread to receive for them. The Linux and Windows transports adopt the multi-lane layout; the VM-kernel transport keeps a byte-identical single-lane layout. No call succeeds after its association fails.

@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/broker-lanes branch 7 times, most recently from de536d2 to d694a00 Compare October 22, 2026 15:46
Weidong Cui (wdcui) and others added 12 commits October 25, 2026 13:58
Replace the userland broker's shared request/response rings and receiving-role
hand-off with call lanes. A control ring now holds several single-slot
request/response lanes; a runner call claims the lowest free lane, and the
broker serves each lane on its own worker, started when the runner first uses
the lane. The association thread serves the first lane itself, and an observer
thread starts further workers and cancels requests once the association ends.
The VM transport keeps the single-lane layout, which is byte-identical to the
previous one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
The lane observer now applies owner-death handling as soon as it observes
the association's end, so a request waiting for a child to start, such as
StartChild on the first lane, is released and the child fails as before.
Having ended the association, the observer then joins the workers it
started. Calls accept a response only while the association is live, and
the runner test broker ends its association when a lane thread panics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Accept a call's response and free its lane in one admission critical
section, so a call still cannot succeed after the association fails
without taking an extra lock per call.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
The field now matches its lane_count accessor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Count fields and locals in the call-lane pool and the broker's lane demand
now end in _count, and the shared demand word is the demanded lane count
rather than requested lanes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
BrokerControlRingEndpoints, BrokerControlRingLane, BrokerLaneDemand and
into_broker become HostControlRingEndpoints, HostControlRingLane,
HostLaneDemand and into_host, matching the Local/Host pairing the channel
traits and platform transports use.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4e8b6cad-28c2-46d9-aef5-95cf4a401fb7
@wdcui
Weidong Cui (wdcui) force-pushed the wdcui/ulitebox/broker-lanes branch from 4fadd08 to c368b7d Compare October 25, 2026 21:04
@wdcui
Weidong Cui (wdcui) added this pull request to the merge queue Oct 25, 2026
@github-actions

Copy link
Copy Markdown

🤖 SemverChecks 🤖 ⚠️ Potential breaking API changes detected ⚠️

Click for details
--- failure constructible_struct_adds_field: struct exhaustively constructible through public API adds field ---

Description:
A pub struct that could be exhaustively constructed with a literal using only public API has a new pub field, breaking existing exhaustive literals.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field LocalControlRingEndpoints.lanes in /home/runner/work/litebox/litebox/litebox_broker_transport/src/control_ring.rs:491
  field LocalControlRingEndpoints.lane_demand in /home/runner/work/litebox/litebox/litebox_broker_transport/src/control_ring.rs:493

--- failure enum_changed_kind: pub enum changed kind ---

Description:
A public enum has been replaced by a different kind of item at the same path, which breaks code that relied on the enum's variants and representation.
        ref: https://github.com/obi1kenobi/cargo-semver-checks/issues/302
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_changed_kind.ron

Failed in:
  enum litebox_broker_transport::control_ring::ControlRingDirection became struct in /home/runner/work/litebox/litebox/litebox_broker_transport/src/control_ring.rs:327

--- failure enum_discriminants_undefined_non_unit_variant: enum's variants no longer have defined discriminants due to non-unit variant ---

Description:
An enum's variants no longer have well-defined discriminant values due to a tuple or struct variant in the enum. This breaks downstream code that accesses discriminants via a numeric cast like `as isize`.
        ref: https://doc.rust-lang.org/reference/items/enumerations.html#assigning-discriminant-values
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_discriminants_undefined_non_unit_variant.ron

Failed in:
  enum MemoryAccessPolicy in /home/runner/work/litebox/litebox/litebox_broker_transport/src/control_ring.rs:290

--- failure enum_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_missing.ron

Failed in:
  enum litebox_broker_transport::pending_calls::PendingCallsError, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:67

--- failure enum_unit_variant_changed_kind: An enum unit variant changed kind ---

Description:
A public enum's exhaustive unit variant has changed to a different kind of enum variant, breaking possible instantiations and patterns.
        ref: https://doc.rust-lang.org/reference/items/enumerations.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/enum_unit_variant_changed_kind.ron

Failed in:
  variant MemoryAccessPolicy::ControlRing in /home/runner/work/litebox/litebox/litebox_broker_transport/src/control_ring.rs:295

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/function_missing.ron

Failed in:
  function litebox_broker_transport::control_ring::memory_permits_byte_range, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:113
  function litebox_broker_transport::control_ring::memory_permits_u64, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:154
  function litebox_broker_transport::control_ring::memory_permits_u32, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:139

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/inherent_method_missing.ron

Failed in:
  ControlRing::into_broker, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:408

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters, not counting the receiver (self) parameter.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/method_parameter_count_changed.ron

Failed in:
  litebox_broker_transport::control_ring::ControlRing::new takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:372, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox_broker_transport/src/control_ring.rs:543

--- failure module_missing: pub module removed or renamed ---

Description:
A publicly-visible module cannot be imported by its prior path. A `pub use` may have been removed, or the module may have been renamed, removed, or made non-public.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/module_missing.ron

Failed in:
  mod litebox_broker_transport::pending_calls, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:4

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing or renamed
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/pub_module_level_const_missing.ron

Failed in:
  CONTROL_RING_MEMORY_SIZE in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:51
  CONTROL_RING_SLOT_COUNT in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:40
  MAX_PENDING_CALLS in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:15
  CONTROL_RING_READY in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:22

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_broker_transport::control_ring::BrokerControlRingEndpoints, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:361
  struct litebox_broker_transport::pending_calls::PendingCalls, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:84
  struct litebox_broker_transport::pending_calls::PendingCall, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:141

--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---

Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/struct_pub_field_missing.ron

Failed in:
  field request_producer of struct LocalControlRingEndpoints, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:353
  field response_consumer of struct LocalControlRingEndpoints, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/control_ring.rs:355

--- failure trait_missing: pub trait removed or renamed ---

Description:
A publicly-visible trait cannot be imported by its prior path. A `pub use` may have been removed, or the trait itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/trait_missing.ron

Failed in:
  trait litebox_broker_transport::pending_calls::PendingCallsSync, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:51
  trait litebox_broker_transport::channel::HostRequestSource, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/channel.rs:146
  trait litebox_broker_transport::pending_calls::PendingCallsCondvar, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:30
  trait litebox_broker_transport::pending_calls::PendingCallsMutex, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/pending_calls.rs:18
  trait litebox_broker_transport::channel::HostResponseSink, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport/src/channel.rs:160

--- failure function_parameter_count_changed: pub fn parameter count changed ---

Description:
A publicly-visible function now takes a different number of parameters.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/function_parameter_count_changed.ron

Failed in:
  litebox_broker_transport_linux_userland::memfd::receive_control_ring_memfd now takes 3 parameters instead of 2, in /home/runner/work/litebox/litebox/litebox_broker_transport_linux_userland/src/memfd.rs:472

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters, not counting the receiver (self) parameter.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/method_parameter_count_changed.ron

Failed in:
  litebox_broker_transport_linux_userland::unix_socket::UnixStreamLocalSetupChannel::receive_control_ring takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport_linux_userland/src/unix_socket/local.rs:141, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox_broker_transport_linux_userland/src/unix_socket/local.rs:142
  litebox_broker_transport_linux_userland::memfd::MemfdSharedMemory::create_control_ring takes 0 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport_linux_userland/src/memfd.rs:211, but now takes 1 parameters in /home/runner/work/litebox/litebox/litebox_broker_transport_linux_userland/src/memfd.rs:206
  litebox_broker_transport_linux_userland::memfd::MemfdSharedMemory::control_ring_from_received_fd takes 1 parameters in /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport_linux_userland/src/memfd.rs:242, but now takes 2 parameters in /home/runner/work/litebox/litebox/litebox_broker_transport_linux_userland/src/memfd.rs:240

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/struct_missing.ron

Failed in:
  struct litebox_broker_transport_linux_userland::unix_socket::UnixControlRingHostResponseSink, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport_linux_userland/src/unix_socket/host.rs:110
  struct litebox_broker_transport_linux_userland::unix_socket::UnixControlRingHostRequestSource, previously in file /home/runner/work/litebox/litebox/target/semver-checks/git-ulitebox/f4b156cdbe947b6a0fef28bc5ee84afeccda7a35/litebox_broker_transport_linux_userland/src/unix_socket/host.rs:103

--- failure function_requires_different_generic_type_params: function now requires a different number of generic type parameters ---

Description:
A function now requires a different number of generic type parameters than it used to. Uses of this function that supplied the previous number of generic types (e.g. via turbofish syntax) will be broken.
        ref: https://doc.rust-lang.org/reference/items/generics.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/function_requires_different_generic_type_params.ron

Failed in:
  function serve_in_process_runner_association (6 -> 5 generic types) in /home/runner/work/litebox/litebox/litebox_broker_userland/src/runtime.rs:72

Merged via the queue into ulitebox with commit 3cd0063 Oct 25, 2026
11 checks passed
@wdcui
Weidong Cui (wdcui) deleted the wdcui/ulitebox/broker-lanes branch October 25, 2026 21:25
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.

1 participant