pub struct TopologyConstraints {
pub min_numa_nodes: u32,
pub max_numa_nodes: Option<u32>,
pub min_llcs: u32,
pub max_llcs: Option<u32>,
pub requires_smt: bool,
pub min_cpus: u32,
pub max_cpus: Option<u32>,
}Expand description
Gauntlet topology filtering constraints.
Controls which gauntlet presets are eligible for a test entry. Presets that don’t meet all constraints are skipped.
Fields§
§min_numa_nodes: u32Minimum number of NUMA nodes.
max_numa_nodes: Option<u32>Maximum number of NUMA nodes.
min_llcs: u32Minimum number of LLCs.
max_llcs: Option<u32>Maximum number of LLCs.
requires_smt: boolWhether the test requires SMT (threads_per_core > 1).
min_cpus: u32Minimum total CPU count.
max_cpus: Option<u32>Maximum total CPU count.
Implementations§
Source§impl TopologyConstraints
impl TopologyConstraints
Sourcepub const DEFAULT: Self
pub const DEFAULT: Self
Conservative default constraints: single NUMA node, 1-12 LLCs,
no SMT requirement, 1-192 CPUs. Accepts most single-node
gauntlet presets ktstr ships while rejecting multi-NUMA presets
(numa2-, numa4-) and the scale-boundary single-node presets
that exceed the CPU/LLC caps (near-max-llc, max-cpu, and their
-nosmt variants). Test authors that want broader coverage must
raise max_numa_nodes, max_llcs, or max_cpus explicitly.
The canonical const handle — use directly when you need an
explicit const binding (pub const X: TopologyConstraints = TopologyConstraints::DEFAULT;). For struct-literal spread in
a static / const initializer, either form works (modern
Rust promotes the trivially-Copy temporary returned by the
const-fn constructor):
pub static A: TopologyConstraints = TopologyConstraints {
min_llcs: 4,
..TopologyConstraints::DEFAULT // const path
};
pub static B: TopologyConstraints = TopologyConstraints {
min_llcs: 4,
..TopologyConstraints::new() // const-fn constructor
};Self::new() and Default::default() delegate to this const
for the const fn / trait-impl entry points.
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Build the default constraints. Equivalent to Self::DEFAULT.
Either form works for struct-literal spread in static /
const: ..Self::DEFAULT (const path) or ..Self::new()
(const-fn constructor — modern Rust promotes the trivially-Copy
temporary). Default::default() is the trait-impl entry point
for non-const contexts.
Source§impl TopologyConstraints
impl TopologyConstraints
Sourcepub fn accepts(
&self,
topo: &Topology,
host_cpus: u32,
host_llcs: u32,
host_max_cpus_per_llc: u32,
) -> bool
pub fn accepts( &self, topo: &Topology, host_cpus: u32, host_llcs: u32, host_max_cpus_per_llc: u32, ) -> bool
Whether a topology preset is eligible under these constraints and the host’s physical limits.
Sourcepub fn accepts_no_perf_mode(&self, topo: &Topology, host_cpus: u32) -> bool
pub fn accepts_no_perf_mode(&self, topo: &Topology, host_cpus: u32) -> bool
No-perf-mode variant of Self::accepts. The VM topology is
emulated via KVM (vCPUs, ACPI SRAT/SLIT, CPUID), not pinned to
host hardware, so the host’s NUMA-node count, LLC count, and
per-LLC CPU width do not constrain it. Only the total-CPU
inequality survives — the guest needs topo.total_cpus() host
CPUs to schedule its vCPU threads, regardless of how those
vCPUs are grouped into virtual LLCs and nodes.
The entry’s min_numa_nodes / min_llcs / min_cpus /
requires_smt / max_* fields still gate which gauntlet
presets the test author wants to exercise — those are
expressing test scope, not host capability — so they keep
firing here. The host-side checks (<= host_cpus,
<= host_llcs, <= host_max_cpus_per_llc) collapse to the
single CPU-budget check.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Reject inverted ranges (any max_* strictly less than the
matching min_*). An inverted range cannot match ANY topology
— Self::accepts / Self::accepts_no_perf_mode would
silently return false for every preset and the test would
be skipped without diagnostic.
Wired into KtstrTestEntry::validate, which fires at the
start of run_ktstr_test (before any VM boot or preset
enumeration). A struct-literal like TopologyConstraints { min_numa_nodes: 5, max_numa_nodes: Some(2), ..DEFAULT }
surfaces a loud error within seconds of test dispatch instead
of as a silently-empty gauntlet sweep at runtime. NOTE: this
only covers the BASE test invocation path — nextest’s
--list output for gauntlet variant lines still elides
presets that don’t satisfy accepts(), so an inverted entry
produces zero gauntlet variant lines in --list output
without a per-variant diagnostic. The base-test invocation
surfaces the error definitively; the listing-time silent
elision of gauntlet variants is a separate concern.
Source§impl TopologyConstraints
impl TopologyConstraints
Sourcepub const fn with_min_numa_nodes(self, min_numa_nodes: u32) -> Self
pub const fn with_min_numa_nodes(self, min_numa_nodes: u32) -> Self
Override min_numa_nodes.
Sourcepub const fn with_max_numa_nodes(self, max_numa_nodes: u32) -> Self
pub const fn with_max_numa_nodes(self, max_numa_nodes: u32) -> Self
Override max_numa_nodes.
Sourcepub const fn without_max_numa_nodes(self) -> Self
pub const fn without_max_numa_nodes(self) -> Self
Clear max_numa_nodes (lift the upper bound).
Sourcepub const fn with_min_llcs(self, min_llcs: u32) -> Self
pub const fn with_min_llcs(self, min_llcs: u32) -> Self
Override min_llcs.
Sourcepub const fn with_max_llcs(self, max_llcs: u32) -> Self
pub const fn with_max_llcs(self, max_llcs: u32) -> Self
Override max_llcs.
Sourcepub const fn without_max_llcs(self) -> Self
pub const fn without_max_llcs(self) -> Self
Clear max_llcs (lift the upper bound).
Sourcepub const fn with_requires_smt(self, requires_smt: bool) -> Self
pub const fn with_requires_smt(self, requires_smt: bool) -> Self
Override requires_smt.
Sourcepub const fn with_min_cpus(self, min_cpus: u32) -> Self
pub const fn with_min_cpus(self, min_cpus: u32) -> Self
Override min_cpus.
Sourcepub const fn with_max_cpus(self, max_cpus: u32) -> Self
pub const fn with_max_cpus(self, max_cpus: u32) -> Self
Override max_cpus.
Sourcepub const fn without_max_cpus(self) -> Self
pub const fn without_max_cpus(self) -> Self
Clear max_cpus (lift the upper bound).
Trait Implementations§
Source§impl Clone for TopologyConstraints
impl Clone for TopologyConstraints
Source§fn clone(&self) -> TopologyConstraints
fn clone(&self) -> TopologyConstraints
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TopologyConstraints
impl Debug for TopologyConstraints
Source§impl Default for TopologyConstraints
impl Default for TopologyConstraints
Source§impl From<TopologyConstraintsJson> for TopologyConstraints
Infallible shape conversion — every field maps 1:1 to
TopologyConstraints, so the verifier sweep dispatch can reuse
the same accepts / accepts_no_perf_mode filters that gauntlet
dispatch uses.
impl From<TopologyConstraintsJson> for TopologyConstraints
Infallible shape conversion — every field maps 1:1 to
TopologyConstraints, so the verifier sweep dispatch can reuse
the same accepts / accepts_no_perf_mode filters that gauntlet
dispatch uses.
Source§fn from(j: TopologyConstraintsJson) -> Self
fn from(j: TopologyConstraintsJson) -> Self
Source§impl PartialEq for TopologyConstraints
impl PartialEq for TopologyConstraints
impl Copy for TopologyConstraints
impl Eq for TopologyConstraints
impl StructuralPartialEq for TopologyConstraints
Auto Trait Implementations§
impl Freeze for TopologyConstraints
impl RefUnwindSafe for TopologyConstraints
impl Send for TopologyConstraints
impl Sync for TopologyConstraints
impl Unpin for TopologyConstraints
impl UnwindSafe for TopologyConstraints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more