Skip to content

Commit

Permalink
Allow 64-vCPU instances on Helios (stlouis)
Browse files Browse the repository at this point in the history
With VM_MAXCPU expanded from 32 to 64 on the stlouis build of Helios, so
too can the limit used for the checks in the Propolis library when
constructing instance VMM resources.

Fixes #474
  • Loading branch information
pfmooney committed Aug 4, 2023
1 parent 5b8f7df commit 4b9314a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/propolis-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ default = []

# When building to be packaged for inclusion in the production ramdisk
# (nominally an Omicron package), certain code is compiled in or out.
omicron-build = []
omicron-build = ["propolis/omicron-build"]

# If selected, only build a mock server which does not actually spawn instances
# (i.e. to test with a facsimile of the API on unsupported platforms)
Expand Down
1 change: 1 addition & 0 deletions lib/propolis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ rand.workspace = true
default = []
crucible-full = ["crucible", "crucible-client-types", "oximeter", "nexus-client"]
falcon = ["libloading", "p9ds", "dlpi", "ispf", "rand", "softnpu-lib"]
omicron-build = []
7 changes: 7 additions & 0 deletions lib/propolis/src/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ mod probes {
fn vm_exit(vcpuid: u32, rip: u64, code: u32) {}
}

#[cfg(not(feature = "omicron-build"))]
pub const MAXCPU: usize = bhyve_api::VM_MAXCPU;

// Helios (stlouis) is built with an expanded limit of 64
#[cfg(feature = "omicron-build")]
pub const MAXCPU: usize = 64;

/// A handle to a virtual CPU.
pub struct Vcpu {
hdl: Arc<VmmHdl>,
Expand Down
4 changes: 2 additions & 2 deletions lib/propolis/src/vmm/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::accessors::*;
use crate::hw;
use crate::mmio::MmioBus;
use crate::pio::PioBus;
use crate::vcpu::Vcpu;
use crate::vcpu::{Vcpu, MAXCPU};
use crate::vmm::{create_vm, CreateOpts, PhysMap, VmmHdl};

/// Arbitrary limit for the top of the physical memory map.
Expand Down Expand Up @@ -249,7 +249,7 @@ impl Builder {
}
/// Sets the maximum number of CPUs for the machine.
pub fn max_cpus(mut self, max: u8) -> Result<Self> {
if max == 0 || max > bhyve_api::VM_MAXCPU as u8 {
if max == 0 || max > MAXCPU as u8 {
Err(Error::new(ErrorKind::InvalidInput, "maxcpu out of range"))
} else {
self.max_cpu = max;
Expand Down

0 comments on commit 4b9314a

Please sign in to comment.