Skip to content

evetest: let a test ask for SMT sibling threads - #7130

Merged
rene merged 1 commit into
lf-edge:masterfrom
rucoder:rucoder/evetest-threads-per-core
Nov 17, 2026
Merged

rene merged 1 commit into
lf-edge:masterfrom
rucoder:rucoder/evetest-threads-per-core

Conversation

@rucoder

@rucoder rucoder commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Description

evetest tests can ask for a device whose CPUs are SMT sibling threads: RequireEdgeDevice.ThreadsPerCore, carried to the broker in EVEDevice.threads_per_core (field 9). Today every provider gives the EVE VM one thread per core: QEMU expands a bare -smp N with threads=1, the libvirt domain's topology is fixed at one thread per core, and Proxmox VE starts QEMU with -smp N,sockets=1,cores=N.

The QEMU, libvirt and Proxmox providers derive the sockets/cores/threads layout from the CPU count and the requested threads per core through one helper (CPUTopology), so a requirement means the same whichever provider runs the test. Proxmox VE has no threads-per-core setting, so the layout reaches QEMU through the VM's args as a second -smp, which QEMU merges over the one PVE generates, key by key.

Zero or one, the default, keeps the layout every provider uses today. The harness refuses a value that does not divide the device's CPU count, and reuses a device only for a test asking for the same value.

This is split out of #6335 (SMT-aware CPU placement), whose CPU placement tests ask for ThreadsPerCore: 2. A broker without this change ignores the field and boots single-thread cores, so those tests cannot pass on CI until the broker runs this code. Merging this first lets the broker be updated ahead of #6335.

How to test and validate this PR

  • Unit tests: cd evetest && go test ./broker/provider/ -run 'TestCPUTopology|TestSMPArg|TestBuildVMOptionsThreadsPerCore'. They cover the layout for 0, 1, 2 and 4 threads per core and for counts that do not divide, and check that the Proxmox VM's args carry -smp 8,sockets=1,cores=4,threads=2 for an 8-CPU SMT device and no -smp without SMT.
  • End to end: SMT/NUMA-aware CPU placement for pinned applications #6335's CPU placement tests request ThreadsPerCore: 2 on 8 CPUs and fail unless the node's sysfs shows 4 cores with 2 siblings each. All eight passed with the QEMU provider (embedded broker). QEMU merging a second -smp over PVE's was checked with QEMU 8.2 directly; the tests have not yet run on a Proxmox broker with this change, nor on libvirt.

Changelog notes

No user-facing changes (test framework only).

PR Backports

  • 17.0-stable: No, test framework only.
  • 16.0-stable: No, test framework only.
  • 14.5-stable: No, test framework only.
  • 13.4-stable: No, test framework only.

Checklist

  • I've provided a proper description

  • I've added the proper documentation

  • I've tested my PR on amd64 device

  • I've tested my PR on arm64 device

  • I've written the test verification instructions

  • I've set the proper labels to this PR

  • I've checked the boxes above, or I've provided a good reason why I didn't check them: the new requirement and proto field are documented where they are declared; arm64 not tested (the change is the same on every architecture).

A test of SMT-aware behaviour, such as CPU placement that allocates
whole physical cores, needs a node whose CPUs share cores. Every
provider gives the EVE VM one thread per core: QEMU expands a bare
"-smp N" with threads=1, the libvirt domain's topology is fixed at one
thread per core, and Proxmox VE starts QEMU with
"-smp N,sockets=1,cores=N".

The device requirements gain ThreadsPerCore, carried to the broker in
EVEDevice.threads_per_core. The QEMU, libvirt and Proxmox providers
derive the sockets/cores/threads layout from the CPU count and that
value through one shared helper, so a requirement means the same
whichever provider runs the test. Proxmox VE has no threads-per-core
setting; the layout reaches QEMU through the VM's args, as a second
-smp that QEMU merges over the one PVE generates, key by key.

Zero or one, the default, keeps the layout every provider uses today.
The harness refuses a value that does not divide the device's CPU
count, and reuses a device only for a test asking for the same value.

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
@rucoder rucoder added the testing New test or test framework changes label Nov 16, 2026
@rucoder
rucoder requested a review from rene November 16, 2026 18:07
@milan-zededa

Copy link
Copy Markdown
Contributor

It is not really worth waiting for EVE build, Eden or even evetest (it will run tests with whatever broker version is currently deployed, it will not pick up these changes).
Let's just wait for unit tests to complete.

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 29.77%. Comparing base (db53df7) to head (67c9fa1).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7130      +/-   ##
==========================================
+ Coverage   29.29%   29.77%   +0.48%     
==========================================
  Files         550      561      +11     
  Lines       99471   101066    +1595     
==========================================
+ Hits        29137    30090     +953     
- Misses      68037    68723     +686     
+ Partials     2297     2253      -44     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rene
rene merged commit a4e72a4 into lf-edge:master Nov 17, 2026
65 of 82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing New test or test framework changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants