mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
acpi: Add hotplug numa node
virtio-mem device would use 'VIRTIO_MEM_F_ACPI_PXM' to add memory to NUMA node, which MUST be existed, otherwise it will be assigned to node id 0, even if user specify different node id. According ACPI spec about Memory Affinity Structure, system hardware supports hot-add memory region using 'Hot Pluggable | Enabled' flags. Signed-off-by: Jiangbo Wu <jiangbo.wu@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
223189c063
commit
22a2a99e5f
@@ -218,6 +218,7 @@ pub type Result<T> = result::Result<T, Error>;
|
||||
#[derive(Clone, Default)]
|
||||
pub struct NumaNode {
|
||||
memory_regions: Vec<Arc<GuestRegionMmap>>,
|
||||
hotplug_regions: Vec<Arc<GuestRegionMmap>>,
|
||||
cpus: Vec<u8>,
|
||||
distances: BTreeMap<u32, u8>,
|
||||
memory_zones: Vec<String>,
|
||||
@@ -228,6 +229,10 @@ impl NumaNode {
|
||||
&self.memory_regions
|
||||
}
|
||||
|
||||
pub fn hotplug_regions(&self) -> &Vec<Arc<GuestRegionMmap>> {
|
||||
&self.hotplug_regions
|
||||
}
|
||||
|
||||
pub fn cpus(&self) -> &Vec<u8> {
|
||||
&self.cpus
|
||||
}
|
||||
@@ -411,6 +416,9 @@ impl Vm {
|
||||
for memory_zone in memory_zones.iter() {
|
||||
if let Some(mm_zone) = mm_zones.get(memory_zone) {
|
||||
node.memory_regions.extend(mm_zone.regions().clone());
|
||||
if let Some(virtiomem_zone) = mm_zone.virtio_mem_zone() {
|
||||
node.hotplug_regions.push(virtiomem_zone.region().clone());
|
||||
}
|
||||
node.memory_zones.push(memory_zone.clone());
|
||||
} else {
|
||||
error!("Unknown memory zone '{}'", memory_zone);
|
||||
|
||||
Reference in New Issue
Block a user