Skip to content

sidecar: remove assert in sidecar node creation flow (#4044) - #4101

Open
babayet2 wants to merge 1 commit into
microsoft:release/1.8.2607from
babayet2:sc-assert-backport
Open

sidecar: remove assert in sidecar node creation flow (#4044)#4101
babayet2 wants to merge 1 commit into
microsoft:release/1.8.2607from
babayet2:sc-assert-backport

Conversation

@babayet2

Copy link
Copy Markdown
Collaborator

Backport of #4044

The sidecar client initialization flow assumes that sidecar nodes are contiguous, and that the nodes' CPU range begin at CPU 0. This does not always hold; in scale tests in which we stress the IO path, most VPs need a full linux kernel, and the CPU range for the first sidecar client in nonzero.

This PR removes the assert.

@babayet2
babayet2 requested a review from a team as a code owner July 30, 2026 20:56
Copilot AI review requested due to automatic review settings July 30, 2026 20:56
@babayet2 babayet2 added the release-ci-required Add to a PR to trigger PR gates in release mode label Jul 30, 2026
@github-actions github-actions Bot added release_1.8.2607 Targets the release/1.8.2607 branch. unsafe Related to unsafe code labels Jul 30, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copilot AI left a comment

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.

Pull request overview

This PR backports #4044 to relax assumptions in the sidecar client initialization so sidecar nodes can have non-zero base CPU ranges without triggering an assertion.

Changes:

  • Removed the CPU base contiguity assertion during sidecar node discovery/initialization.
  • Allows sidecar nodes whose base_cpu does not begin at CPU 0.

Err(err) => return Err(err),
};
assert_eq!(node.cpus.start, expected_base);
expected_base = node.cpus.end;
Copilot AI review requested due to automatic review settings July 30, 2026 21:59
@babayet2
babayet2 force-pushed the sc-assert-backport branch from 8550264 to 4d58b19 Compare July 30, 2026 22:01

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

openhcl/sidecar_client/src/lib.rs:153

  • After removing the contiguity assert, expected_base is now never read. This will trigger an unused-variable warning (and may fail CI if warnings are denied). Either remove it entirely, or rename it to _expected_base if it’s intentionally kept for future use.
                }
                Err(err) => return Err(err),
            };
            if node.cpus.start > expected_base {
                tracing::info!(

Copilot AI review requested due to automatic review settings July 30, 2026 22:02
The sidecar client initialization flow assumes that sidecar nodes are
contiguous, and that the nodes' CPU range begin at CPU 0. This does not
always hold; in scale tests in which we stress the IO path, most VPs
need a full linux kernel, and the CPU range for the first sidecar client
in nonzero.

This PR removes the assert.
@babayet2
babayet2 force-pushed the sc-assert-backport branch from 4d58b19 to cf02031 Compare July 30, 2026 22:03

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

openhcl/sidecar_client/src/lib.rs:156

  • The new gap log message is misleading: this loop cannot “skip earlier node(s)” because SidecarNode::new stops iteration at the first missing /dev/mshv_vtl_sidecar{node}. Also, after removing the assert_eq!, a node with cpus.start < expected_base (overlap / out-of-order range) would be silently accepted and could cause incorrect CPU->node mapping later. Consider treating start < expected_base as an InvalidData error, and adjust the log text to describe a CPU-index gap (not skipped nodes).
            if node.cpus.start > expected_base {
                tracing::info!(
                    node = nodes.len(),
                    gap_start = expected_base,
                    gap_end = node.cpus.start,

Copilot AI review requested due to automatic review settings July 30, 2026 22:09

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

openhcl/sidecar_client/src/lib.rs:161

  • With the contiguous-CPU assert removed, an out-of-order/overlapping CPU layout (node.cpus.start < expected_base) would now pass silently, and the expected_base = node.cpus.end update could move backwards and hide a real layout issue. Consider explicitly warning on overlaps/out-of-order layouts and keeping expected_base monotonic. Also, the current info message says "earlier node(s) skipped" but the condition is a CPU-range gap (including before the first node), so the wording is inaccurate in the nonzero-base scenario described in the PR.
                    "sidecar node follows a gap; earlier node(s) skipped (no sidecar-started APs)"
                );
            }
            expected_base = node.cpus.end;
            nodes.push(node);

@github-actions

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_1.8.2607 Targets the release/1.8.2607 branch. release-ci-required Add to a PR to trigger PR gates in release mode unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants