Skip to content

[AI Generated] BugFix: compute ringbuffer tolerance from PAGE_SIZE#4364

Merged
LiliDeng merged 3 commits intomainfrom
bugfix/ringbuffer-tolerance-64k-page_190326_133123
Mar 22, 2026
Merged

[AI Generated] BugFix: compute ringbuffer tolerance from PAGE_SIZE#4364
LiliDeng merged 3 commits intomainfrom
bugfix/ringbuffer-tolerance-64k-page_190326_133123

Conversation

@johnsongeorge-w
Copy link
Copy Markdown
Collaborator

Summary

The netvsc driver rounds buffer sizes up to PAGE_SIZE, causing the actual RX/TX section count to differ from the requested value. On ARM64 systems with 64 KiB pages, the delta can be up to ceil(65536/1728) = 38 for RX and ceil(65536/6144) = 11 for TX, which exceeds the previous hard-coded tolerance of ±5.

This PR:

  • Queries the guest PAGE_SIZE via getconf PAGE_SIZE
  • Computes tolerance dynamically: ceil(PAGE_SIZE / section_size)
  • Fixes a copy-paste typo in the TX assertion that used expected_rx instead of expected_tx

Validation Results

Image Result
almalinux almalinux-arm 10-arm64-64k-gen2 latest (64K pages) PASSED
canonical ubuntu-24_04-lts server-arm64 latest (4K pages) PASSED
almalinux almalinux-arm 9-arm-gen2 latest (4K pages, pre-fix baseline) PASSED

Copilot AI review requested due to automatic review settings March 19, 2026 20:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the NetworkSettings.verify_ringbuffer_settings_change test to account for netvsc ringbuffer section rounding behavior that depends on the guest PAGE_SIZE, avoiding false failures on ARM64/64KiB-page systems.

Changes:

  • Compute RX/TX section-count tolerance dynamically using the guest page size (getconf PAGE_SIZE) and per-section sizes.
  • Fix TX assertion bounds to use expected_tx (instead of the prior expected_rx typo).
  • Minor comment correction (PAGE_SIZE casing).

Comment thread lisa/microsoft/testsuites/network/networksettings.py Outdated
Comment thread lisa/microsoft/testsuites/network/networksettings.py Outdated
The netvsc driver rounds buffer sizes up to PAGE_SIZE, causing the actual
RX/TX section count to differ from the requested value.  On systems with
64 KiB pages (common on ARM64), the delta can be up to
ceil(65536/1728) = 38 for RX and ceil(65536/6144) = 11 for TX, which
exceeds the previous hard-coded tolerance of 5.

Compute the tolerance dynamically: ceil(PAGE_SIZE / section_size).

Also fix a copy-paste typo in the TX assertion upper bound that
incorrectly used expected_rx instead of expected_tx.
@johnsongeorge-w johnsongeorge-w force-pushed the bugfix/ringbuffer-tolerance-64k-page_190326_133123 branch from bd67569 to 9040894 Compare March 19, 2026 21:27
@johnsongeorge-w johnsongeorge-w changed the title BugFix: compute ringbuffer tolerance from PAGE_SIZE [AI Generated] BugFix: compute ringbuffer tolerance from PAGE_SIZE Mar 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

@LiliDeng I've opened a new pull request, #4366, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI review requested due to automatic review settings March 20, 2026 13:57
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 2 comments.

Comments suppressed due to low confidence (1)

lisa/microsoft/testsuites/network/networksettings.py:157

  • The 2 MiB adjustment used for txbuffer is a test-behavior magic number but isn't explained. Please add an inline comment (or extract a named constant) documenting why ±2 MiB is chosen and what it is intended to validate.
                if original_rxbuffer - 2 > 0
                else (original_rxbuffer + 2)

Comment thread lisa/microsoft/testsuites/network/networksettings.py
Comment thread lisa/microsoft/testsuites/network/networksettings.py
@LiliDeng LiliDeng merged commit df8cfb8 into main Mar 22, 2026
58 checks passed
@LiliDeng LiliDeng deleted the bugfix/ringbuffer-tolerance-64k-page_190326_133123 branch March 22, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants