Skip to content

Turin Dense is as valid as Turin for VM placement - #11668

Merged
iximeow merged 6 commits into
mainfrom
turin-dense-instance-placement
Nov 3, 2026
Merged

iximeow merged 6 commits into
mainfrom
turin-dense-instance-placement

Conversation

@iximeow

@iximeow iximeow commented Nov 3, 2026

Copy link
Copy Markdown
Member

One may ask, how does Nexus place instances on Dense Cosmos, before this
change? compatible_sled_cpu_families() is only involved if an explicit
CPU platform is set on the instance to be started.

If no explicit CPU platform is set, sis_create_vmm_record implements
the defaulting behavior of picking a minimum compatible platform for the
sled chosen according to any other placement constraints. For all of
Milan, Turin, and TurinDense, that means instances end up with the Milan
CPU platform.

Because of this, though, simply setting an explicit CPU platform - even
amd_milan - would make a Dense sled ineligible as a host for that
instance. Even one which it had just happily hosted with a Milan CPU
platform by virtue of the minimum-compatible default above.

In adding the new test which both demonstrates the issue without the instance_cpu_platform.rs change, and passes with that change, the now 10k-line integration_tests/instances.rs is somewhat dizzying. I've included two additional commits here that kinda make the new test more legible to me.. I'd be happy to squash this all together, if we want a48c3de in one change and the test cleanup in another, that's fine too.

One may ask, how does Nexus place instances on Dense Cosmos, before this
change? `compatible_sled_cpu_families()` is only involved if an explicit
CPU platform is set on the instance to be started.

If no explicit CPU platform is set, `sis_create_vmm_record` implements
the defaulting behavior of picking a minimum compatible platform for the
sled chosen according to any other placement constraints. For all of
Milan, Turin, and TurinDense, that means instances end up with the Milan
CPU platform.

Because of this, though, simply setting an explicit CPU platform - even
`amd_milan` - would make a Dense sled ineligible as a host for that
instance. Even one which it had just happily hosted with a Milan CPU
platform by virtue of the minimum-compatible default above.
@iximeow iximeow added the virtualization Propolis Integration & VM Management label Nov 3, 2026
Comment on lines -41 to -42
Self::AmdTurin => &[SledCpuFamily::AmdTurin],
Self::AmdTurinV2 => &[SledCpuFamily::AmdTurin],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol. lmao.

);
}

fn instance_compute_update(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would mildly prefer we called this

Suggested change
fn instance_compute_update(
fn instance_compute_reconfigure(

to match the name of the API, though i will accept if you think that's a bit weirdly non-verb-y?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd named this update because the struct that comes out is InstanceUpdate :(

}

#[nexus_test]
async fn test_can_start_turin_dense_instance_with_cpu_platform(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this test being basically a carbon copy of test_can_start_instance_with_cpu_platform with one line changed, but trying to get a bit smarter about the test seems way more prone to inappropriately passing than is worth the trade.

namely, if you simply create both Turin and TurinDense simulated sleds, you also need to somehow control the instance's placement for the test. I don't think you can do a "to this specific sled" affinity rule, so that's off the table. there could be a local disk "on the sled" to constrain placement, but that seems terrible for legibility too. the option I tried the hardest was to have a list of sled CPU families to create fake sleds for, then we could just make instances of size the whole test sled, and go through an instance and its CPU platform choices one by one, leaving test sleds fully occupied as we go through. that seemed pretty complicated too.

a more legible option is probably to enumerate CPU platforms and the sleds on which they can be placed, then step through the mechanics like this for a list of (SledCpuFamily, Vec<InstancePlatformAndExpectation>). that's probably the best way to express what we're testing without getting lost in the details, but I wanted to get a patch up here before spinning too much more on the test situation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think you're right, the repeated code in two tests is not the absolute worst thing given the risk of accidentally passing tests...

iximeow and others added 2 commits November 2, 2026 18:45
@iximeow
iximeow merged commit 2b452f1 into main Nov 3, 2026
19 checks passed
@iximeow
iximeow deleted the turin-dense-instance-placement branch November 3, 2026 18:12
iliana pushed a commit that referenced this pull request Nov 3, 2026
@lkozloff lkozloff added this to the 23 milestone Nov 3, 2026
iximeow added a commit that referenced this pull request Nov 4, 2026
Both of these had versions of `compatible_sled_cpu_families()`, and one
was right, while the other was stale, resulting in #11668. Now and for
the future an instance's CPU platform, if explicitly chosen, is
represented by exactly one VMM CPU platform. Because of that, we can
convert the instance's CPU platform to the VMM CPU platform for it and
have a single authoritative `compatible_sled_cpu_families()`.
iximeow added a commit that referenced this pull request Nov 4, 2026
Both of these had versions of `compatible_sled_cpu_families()`, and one
was right, while the other was stale, resulting in #11668. Now and for
the future an instance's CPU platform, if explicitly chosen, is
represented by exactly one VMM CPU platform. Because of that, we can
convert the instance's CPU platform to the VMM CPU platform for it and
have a single authoritative `compatible_sled_cpu_families()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

virtualization Propolis Integration & VM Management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants