TopologyConstraints

Struct TopologyConstraints 

Source
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: u32

Minimum number of NUMA nodes.

§max_numa_nodes: Option<u32>

Maximum number of NUMA nodes.

§min_llcs: u32

Minimum number of LLCs.

§max_llcs: Option<u32>

Maximum number of LLCs.

§requires_smt: bool

Whether the test requires SMT (threads_per_core > 1).

§min_cpus: u32

Minimum total CPU count.

§max_cpus: Option<u32>

Maximum total CPU count.

Implementations§

Source§

impl TopologyConstraints

Source

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.

Source

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

Source

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.

Source

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.

Source

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

Source

pub const fn with_min_numa_nodes(self, min_numa_nodes: u32) -> Self

Override min_numa_nodes.

Source

pub const fn with_max_numa_nodes(self, max_numa_nodes: u32) -> Self

Override max_numa_nodes.

Source

pub const fn without_max_numa_nodes(self) -> Self

Clear max_numa_nodes (lift the upper bound).

Source

pub const fn with_min_llcs(self, min_llcs: u32) -> Self

Override min_llcs.

Source

pub const fn with_max_llcs(self, max_llcs: u32) -> Self

Override max_llcs.

Source

pub const fn without_max_llcs(self) -> Self

Clear max_llcs (lift the upper bound).

Source

pub const fn with_requires_smt(self, requires_smt: bool) -> Self

Override requires_smt.

Source

pub const fn with_min_cpus(self, min_cpus: u32) -> Self

Override min_cpus.

Source

pub const fn with_max_cpus(self, max_cpus: u32) -> Self

Override max_cpus.

Source

pub const fn without_max_cpus(self) -> Self

Clear max_cpus (lift the upper bound).

Trait Implementations§

Source§

impl Clone for TopologyConstraints

Source§

fn clone(&self) -> TopologyConstraints

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TopologyConstraints

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TopologyConstraints

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
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.

Source§

fn from(j: TopologyConstraintsJson) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for TopologyConstraints

Source§

fn eq(&self, other: &TopologyConstraints) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TopologyConstraints

Source§

impl Eq for TopologyConstraints

Source§

impl StructuralPartialEq for TopologyConstraints

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,