Repository navigation
Conversation
|
this actually does the needful now and would be something I'm willing to merge, but the conflicts of course need addressing. even if rebased this will conflict with #1217 on account of the API changes, so we should probably get that in, then I'll get this in, and then we can do a new ACPI type in the API to set up X2APIC structs over there too. |
this also plumbs the configuration to propolis-server's API as well as propolis-standalone. beyond simply specifying a number of sockets, some additional specializer support was needed along the way. specific topology leaves to specialize (or discard) are taken in the API in support of the (pretty funky) existing topology that guests see. choice of a given CPU toplogy will be determined, for now, in Nexus by the corresponding virtual platform for an instance.
989eaaa to
f229887
Compare
acfoltzer
left a comment
There was a problem hiding this comment.
Comments for everything except propolis::cpuid itself, which I ran out of time
to tackle until tomorrow
| launch_cpuid_smoke_test_vm_with_topo(ctx, vm_name, None).await | ||
| } | ||
|
|
||
| async fn launch_cpuid_smoke_test_vm_with_topo( | ||
| ctx: &TestCtx, | ||
| vm_name: &str, | ||
| guest_topo: Option<CpuTopology>, |
There was a problem hiding this comment.
| launch_cpuid_smoke_test_vm_with_topo(ctx, vm_name, None).await | |
| } | |
| async fn launch_cpuid_smoke_test_vm_with_topo( | |
| ctx: &TestCtx, | |
| vm_name: &str, | |
| guest_topo: Option<CpuTopology>, | |
| launch_cpuid_smoke_test_vm_with_topo(ctx, vm_name, CpuTopology::single_socket_smt()).await | |
| } | |
| async fn launch_cpuid_smoke_test_vm_with_topo( | |
| ctx: &TestCtx, | |
| vm_name: &str, | |
| guest_topo: CpuTopology, |
There was a problem hiding this comment.
hm yeah, fair enough! this is a consequence of "at one point it was optional in the spec", I think.
| /// Some tests cover specific CPU topologies, for which this helper is | ||
| /// unsuitable; instead, use `launch_cpuid_smoke_test_vm_with_topo` and use | ||
| /// explicit settings for the code under test. |
There was a problem hiding this comment.
| /// Some tests cover specific CPU topologies, for which this helper is | |
| /// unsuitable; instead, use `launch_cpuid_smoke_test_vm_with_topo` and use | |
| /// explicit settings for the code under test. | |
| /// This helper launches a VM with the default | |
| /// [`CpuTopology::single_socket_smt()`] topology. For tests that require a | |
| /// different topology, use [`launch_cpuid_smoke_test_vm_with_topo()`]. |
| // Because the "legacy" (AMD) topology is single-thread sockets, a bunch of | ||
| // things that are seemingly bogus. |
| // A truly egregious conversion from single digit integer to `char`, but | ||
| // I don't want you to have to read `(0x30 + mask) as char` |
| std_4: true, | ||
| std_b: true, | ||
| ext_8: true, | ||
| ext_1e: false, |
There was a problem hiding this comment.
A comment explaining this particular combo of values would be useful (I believe
this is for compat with pre-patch behavior?)
| // The initial CPU platform as presented was even funkier than | ||
| // simply "vCPU-many single-thread sockets"; we would report SMT | ||
| // (above), but clear topology information from CPUID leaves Bh and | ||
| // 8000_001Eh. CPUID leaf 4h got topology information because it is | ||
| // Intel-only, so by populating that information we would not alter | ||
| // VMs in the product but would get to make Intel more right by | ||
| // default. |
There was a problem hiding this comment.
This is a bit hard to follow. Maybe referencing details in #1258 would help? The
last part about changing (I think?) Intel behavior should probably be fleshed
out a bit more.
| //! Version `NVME_WRITE_CACHE` of the Propolis Server API. | ||
| //! | ||
| //! This version adds an API field to control if an NVMe device reports having a | ||
| //! volatile write cache. |
| // This `From` impl, like others, is lossy. It should probably be a | ||
| // try_from and fail if this is not the implied default topology in | ||
| // v6. | ||
| cpu_topology: _, | ||
| } = new.board; | ||
|
|
||
| // Like above, this is lossy, should instead be an error in a TryFrom. |
There was a problem hiding this comment.
Making sure I understand the potential consequences of this lossiness: an older
client requesting an instance_spec could end up with, say, a response with
255 for a newer instance with >255 cpus. Just want to make sure this is an
acceptable loss of information vs bubbling up an error into
instance_spec_get_v7
| /// Typically this will be configured as `threads_per_core: 2` to indicate SMT, | ||
| /// and one socket. The number of vCPUs in each socket is the same, meaning that | ||
| /// the number of vCPUs must divide evenly into the number of sockets in the | ||
| /// topology. |
There was a problem hiding this comment.
| /// Typically this will be configured as `threads_per_core: 2` to indicate SMT, | |
| /// and one socket. The number of vCPUs in each socket is the same, meaning that | |
| /// the number of vCPUs must divide evenly into the number of sockets in the | |
| /// topology. | |
| /// Typically this will be configured as `threads_per_core: 2` to indicate SMT, | |
| /// and one socket. Each socket has the same number of vCPUs, so the total | |
| /// number of vCPUs specified in `cpus` must divide evenly into the number of | |
| /// sockets in the topology. |
Strawman wording change in the suggestion. A few issues I see here:
threads_per_coreis not mentioned anywhere else in the repo; stale name?vCPUsvsBoard::cpus: at least in the generated JSON, "vCPUs" only shows
up from this one docstring. Perhaps in the API context we should stick with
cpussinceBoardwas there first? Though that would be unfortunate because...- The API docs make it unclear whether
Board::cpusare cores or threads. E.g.,
iscpus: 4,sockets: 4,has_smt: truea valid config? If so, does it
have 4 threads or 8?
| /// Leaves may be selected here without being present in `Cpuid`, in which case | ||
| /// the extra selected topology leaves are ignored. Conversely, `Cpuid` leaves | ||
| /// with topology information that are not mentioend here probably indicate a | ||
| /// bug (at best, those leaves will probably indicate collection of single-core | ||
| /// sockets in the machine.) |
There was a problem hiding this comment.
| /// Leaves may be selected here without being present in `Cpuid`, in which case | |
| /// the extra selected topology leaves are ignored. Conversely, `Cpuid` leaves | |
| /// with topology information that are not mentioend here probably indicate a | |
| /// bug (at best, those leaves will probably indicate collection of single-core | |
| /// sockets in the machine.) | |
| /// Leaves may be selected here without being present in `Cpuid`, in which case | |
| /// the extra selected topology leaves are ignored. Conversely, `Cpuid` leaves | |
| /// with topology information that are not mentioned here probably indicate a | |
| /// bug (at best, those leaves will probably indicate collection of single-core | |
| /// sockets in the machine.) |
Typo suggestion above, but also I wonder if this could be rewritten to be more
actionable to users of the API. The last sentence reads more like a note-to-self
than an active solicitation of bug reports/feature requests.
I suspect this behavior is too subtle to cram a complete description in this
field. Maybe we can reference a longer explanation in other docs?
this moves a VM's apparent CPU topology into the propolis-server API (and makes it more configurable in propolis-standalone as well). this is really intended as a stepping stone for all of: more explicit CPU pinning directives based on control plane CPU selection, CCX-aware CPU placement, getting Propolis a bit out of the way of >254 vCPU work, and, most excitingly to me, closing VMs should not have vCPU-many sockets.
realistically this is a demonstrator for another change I'll have up against Omicron in a bit here to select a new virtual platform which has as a detail more reasonable CPU topology.
it's also full of TODOs and could use at least one (1) test that on AMD the guest gets a topology we'd want it to get, instead of single-thread sockets.