mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: support setting cpu affinity with host cpu indices >255
On hosts with >256 cpus, setting the cpu affinity to a host cpu index >255 will return an error because type of `host_cpu` is `u8`. This commit changes the type of `host_cpu` to `usize` to remove this limitation. Signed-off-by: Sean Banko <sbanko@crusoeenergy.com>
This commit is contained in:
@@ -479,7 +479,7 @@ pub struct CpuManager {
|
||||
#[cfg_attr(target_arch = "aarch64", allow(dead_code))]
|
||||
acpi_address: Option<GuestAddress>,
|
||||
proximity_domain_per_cpu: BTreeMap<u8, u32>,
|
||||
affinity: BTreeMap<u8, Vec<u8>>,
|
||||
affinity: BTreeMap<u8, Vec<usize>>,
|
||||
dynamic: bool,
|
||||
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
||||
}
|
||||
@@ -921,7 +921,7 @@ impl CpuManager {
|
||||
unsafe { libc::CPU_ZERO(&mut cpuset) };
|
||||
for host_cpu in host_cpus {
|
||||
// SAFETY: FFI call, trivially safe
|
||||
unsafe { libc::CPU_SET(*host_cpu as usize, &mut cpuset) };
|
||||
unsafe { libc::CPU_SET(*host_cpu, &mut cpuset) };
|
||||
}
|
||||
cpuset
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user