mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-04 19:11:11 +00:00
vmm: Rename NUMA option 'id' into 'guest_numa_id'
The goal of this commit is to rename the existing NUMA option 'id' with 'guest_numa_id'. This is done without any modification to the way this option behaves. The reason for the rename is caused by the observation that all other parameters with an option called 'id' expect a string to be provided. Because in this particular case we expect a u32 representing a proximity domain from the ACPI specification, it's better to name it with a more explicit name. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
55e9827e00
commit
e15dba2925
@ -308,7 +308,7 @@ struct NumaConfig {
|
||||
--numa <numa> Settings related to a given NUMA node "id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,memory_zones=<list_of_memory_zones>"
|
||||
```
|
||||
|
||||
### `id`
|
||||
### `guest_numa_id`
|
||||
|
||||
Node identifier of a guest NUMA node. This identifier must be unique, otherwise
|
||||
an error will be returned.
|
||||
@ -320,14 +320,14 @@ Value is an unsigned integer of 32 bits.
|
||||
_Example_
|
||||
|
||||
```
|
||||
--numa id=0
|
||||
--numa guest_numa_id=0
|
||||
```
|
||||
|
||||
### `cpus`
|
||||
|
||||
List of virtual CPUs attached to the guest NUMA node identified by the `id`
|
||||
option. This allows for describing a list of CPUs which must be seen by the
|
||||
guest as belonging to the NUMA node `id`.
|
||||
List of virtual CPUs attached to the guest NUMA node identified by the
|
||||
`guest_numa_id` option. This allows for describing a list of CPUs which
|
||||
must be seen by the guest as belonging to the NUMA node `guest_numa_id`.
|
||||
|
||||
One can use this option for a fine grained description of the NUMA topology
|
||||
regarding the CPUs associated with it, which might help the guest run more
|
||||
@ -348,17 +348,17 @@ _Example_
|
||||
|
||||
```
|
||||
--cpus boot=8
|
||||
--numa id=0,cpus=1-3:7
|
||||
--numa id=1,cpus=0:4-6
|
||||
--numa guest_numa_id=0,cpus=1-3:7
|
||||
--numa guest_numa_id=1,cpus=0:4-6
|
||||
```
|
||||
|
||||
### `distances`
|
||||
|
||||
List of distances between the current NUMA node referred by `id` and the
|
||||
destination NUMA nodes listed along with distances. This option let the user
|
||||
choose the distances between guest NUMA nodes. This is important to provide an
|
||||
accurate description of the way non uniform memory accesses will perform in the
|
||||
guest.
|
||||
List of distances between the current NUMA node referred by `guest_numa_id`
|
||||
and the destination NUMA nodes listed along with distances. This option let
|
||||
the user choose the distances between guest NUMA nodes. This is important to
|
||||
provide an accurate description of the way non uniform memory accesses will
|
||||
perform in the guest.
|
||||
|
||||
One or more tuple of two values must be provided through this option. The first
|
||||
value is an unsigned integer of 32 bits as it represents the destination NUMA
|
||||
@ -374,16 +374,16 @@ different distances, it can be described with the following example.
|
||||
_Example_
|
||||
|
||||
```
|
||||
--numa id=0,distances=1@15:2@25
|
||||
--numa id=1,distances=0@15:2@20
|
||||
--numa id=2,distances=0@25:1@20
|
||||
--numa guest_numa_id=0,distances=1@15:2@25
|
||||
--numa guest_numa_id=1,distances=0@15:2@20
|
||||
--numa guest_numa_id=2,distances=0@25:1@20
|
||||
```
|
||||
|
||||
### `memory_zones`
|
||||
|
||||
List of memory zones attached to the guest NUMA node identified by the `id`
|
||||
option. This allows for describing a list of memory ranges which must be seen
|
||||
by the guest as belonging to the NUMA node `id`.
|
||||
List of memory zones attached to the guest NUMA node identified by the
|
||||
`guest_numa_id` option. This allows for describing a list of memory ranges
|
||||
which must be seen by the guest as belonging to the NUMA node `guest_numa_id`.
|
||||
|
||||
This option can be very useful and powerful when combined with `host_numa_node`
|
||||
option from `--memory-zone` parameter as it allows for creating a VM with non
|
||||
@ -402,6 +402,6 @@ _Example_
|
||||
--memory-zone id=mem0,size=1G
|
||||
--memory-zone id=mem1,size=1G
|
||||
--memory-zone id=mem2,size=1G
|
||||
--numa id=0,memory_zones=mem0:mem2
|
||||
--numa id=1,memory_zones=mem1
|
||||
--numa guest_numa_id=0,memory_zones=mem0:mem2
|
||||
--numa guest_numa_id=1,memory_zones=mem1
|
||||
```
|
||||
|
@ -2325,9 +2325,9 @@ mod tests {
|
||||
])
|
||||
.args(&[
|
||||
"--numa",
|
||||
"id=0,cpus=0-2,distances=1@15:2@20,memory_zones=mem0",
|
||||
"id=1,cpus=3-4,distances=0@20:2@25,memory_zones=mem1",
|
||||
"id=2,cpus=5,distances=0@25:1@30,memory_zones=mem2",
|
||||
"guest_numa_id=0,cpus=0-2,distances=1@15:2@20,memory_zones=mem0",
|
||||
"guest_numa_id=1,cpus=3-4,distances=0@20:2@25,memory_zones=mem1",
|
||||
"guest_numa_id=2,cpus=5,distances=0@25:1@30,memory_zones=mem2",
|
||||
])
|
||||
.args(&["--kernel", guest.fw_path.as_str()])
|
||||
.capture_output()
|
||||
|
@ -736,10 +736,10 @@ components:
|
||||
|
||||
NumaConfig:
|
||||
required:
|
||||
- id
|
||||
- guest_numa_id
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
guest_numa_id:
|
||||
type: integer
|
||||
format: uint32
|
||||
cpus:
|
||||
|
@ -1223,7 +1223,7 @@ pub struct NumaDistance {
|
||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, Default)]
|
||||
pub struct NumaConfig {
|
||||
#[serde(default)]
|
||||
pub id: u32,
|
||||
pub guest_numa_id: u32,
|
||||
#[serde(default)]
|
||||
pub cpus: Option<Vec<u8>>,
|
||||
#[serde(default)]
|
||||
@ -1234,19 +1234,19 @@ pub struct NumaConfig {
|
||||
|
||||
impl NumaConfig {
|
||||
pub const SYNTAX: &'static str = "Settings related to a given NUMA node \
|
||||
\"id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,\
|
||||
\"guest_numa_id=<node_id>,cpus=<cpus_id>,distances=<list_of_distances_to_destination_nodes>,\
|
||||
memory_zones=<list_of_memory_zones>\"";
|
||||
pub fn parse(numa: &str) -> Result<Self> {
|
||||
let mut parser = OptionParser::new();
|
||||
parser
|
||||
.add("id")
|
||||
.add("guest_numa_id")
|
||||
.add("cpus")
|
||||
.add("distances")
|
||||
.add("memory_zones");
|
||||
parser.parse(numa).map_err(Error::ParseNuma)?;
|
||||
|
||||
let id = parser
|
||||
.convert::<u32>("id")
|
||||
let guest_numa_id = parser
|
||||
.convert::<u32>("guest_numa_id")
|
||||
.map_err(Error::ParseNuma)?
|
||||
.unwrap_or(0);
|
||||
let cpus = parser
|
||||
@ -1270,7 +1270,7 @@ impl NumaConfig {
|
||||
.map(|v| v.0);
|
||||
|
||||
Ok(NumaConfig {
|
||||
id,
|
||||
guest_numa_id,
|
||||
cpus,
|
||||
distances,
|
||||
memory_zones,
|
||||
|
@ -377,10 +377,10 @@ impl Vm {
|
||||
let mut numa_nodes = BTreeMap::new();
|
||||
|
||||
if let Some(configs) = &configs {
|
||||
let node_id_list: Vec<u32> = configs.iter().map(|cfg| cfg.id).collect();
|
||||
let node_id_list: Vec<u32> = configs.iter().map(|cfg| cfg.guest_numa_id).collect();
|
||||
|
||||
for config in configs.iter() {
|
||||
if numa_nodes.contains_key(&config.id) {
|
||||
if numa_nodes.contains_key(&config.guest_numa_id) {
|
||||
error!("Can't define twice the same NUMA node");
|
||||
return Err(Error::InvalidNumaConfig);
|
||||
}
|
||||
@ -425,7 +425,7 @@ impl Vm {
|
||||
}
|
||||
}
|
||||
|
||||
numa_nodes.insert(config.id, node);
|
||||
numa_nodes.insert(config.guest_numa_id, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user