mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-17 21:26:13 -07:00
numa: move numa global variable numa_info into MachineState
Move existing numa global numa_info (renamed as "nodes") into NumaState. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Suggested-by: Igor Mammedov <imammedo@redhat.com> Suggested-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Tao Xu <tao3.xu@intel.com> Message-Id: <20190809065731.9097-5-tao3.xu@intel.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
118154b767
commit
7e721e7b10
11 changed files with 36 additions and 25 deletions
|
|
@ -55,8 +55,6 @@ static int have_mem;
|
|||
static int max_numa_nodeid; /* Highest specified NUMA node ID, plus one.
|
||||
* For all nodes, nodeid < max_numa_nodeid
|
||||
*/
|
||||
NodeInfo numa_info[MAX_NODES];
|
||||
|
||||
|
||||
static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
|
||||
Error **errp)
|
||||
|
|
@ -66,6 +64,7 @@ static void parse_numa_node(MachineState *ms, NumaNodeOptions *node,
|
|||
uint16List *cpus = NULL;
|
||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||
unsigned int max_cpus = ms->smp.max_cpus;
|
||||
NodeInfo *numa_info = ms->numa_state->nodes;
|
||||
|
||||
if (node->has_nodeid) {
|
||||
nodenr = node->nodeid;
|
||||
|
|
@ -145,6 +144,7 @@ void parse_numa_distance(MachineState *ms, NumaDistOptions *dist, Error **errp)
|
|||
uint16_t src = dist->src;
|
||||
uint16_t dst = dist->dst;
|
||||
uint8_t val = dist->val;
|
||||
NodeInfo *numa_info = ms->numa_state->nodes;
|
||||
|
||||
if (src >= MAX_NODES || dst >= MAX_NODES) {
|
||||
error_setg(errp, "Parameter '%s' expects an integer between 0 and %d",
|
||||
|
|
@ -203,7 +203,7 @@ void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp)
|
|||
error_setg(&err, "Missing mandatory node-id property");
|
||||
goto end;
|
||||
}
|
||||
if (!numa_info[object->u.cpu.node_id].present) {
|
||||
if (!ms->numa_state->nodes[object->u.cpu.node_id].present) {
|
||||
error_setg(&err, "Invalid node-id=%" PRId64 ", NUMA node must be "
|
||||
"defined with -numa node,nodeid=ID before it's used with "
|
||||
"-numa cpu,node-id=ID", object->u.cpu.node_id);
|
||||
|
|
@ -263,6 +263,7 @@ static void validate_numa_distance(MachineState *ms)
|
|||
int src, dst;
|
||||
bool is_asymmetrical = false;
|
||||
int nb_numa_nodes = ms->numa_state->num_nodes;
|
||||
NodeInfo *numa_info = ms->numa_state->nodes;
|
||||
|
||||
for (src = 0; src < nb_numa_nodes; src++) {
|
||||
for (dst = src; dst < nb_numa_nodes; dst++) {
|
||||
|
|
@ -303,6 +304,7 @@ static void validate_numa_distance(MachineState *ms)
|
|||
static void complete_init_numa_distance(MachineState *ms)
|
||||
{
|
||||
int src, dst;
|
||||
NodeInfo *numa_info = ms->numa_state->nodes;
|
||||
|
||||
/* Fixup NUMA distance by symmetric policy because if it is an
|
||||
* asymmetric distance table, it should be a complete table and
|
||||
|
|
@ -362,6 +364,7 @@ void numa_complete_configuration(MachineState *ms)
|
|||
{
|
||||
int i;
|
||||
MachineClass *mc = MACHINE_GET_CLASS(ms);
|
||||
NodeInfo *numa_info = ms->numa_state->nodes;
|
||||
|
||||
/*
|
||||
* If memory hotplug is enabled (slots > 0) but without '-numa'
|
||||
|
|
@ -527,8 +530,8 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
|
|||
|
||||
memory_region_init(mr, owner, name, ram_size);
|
||||
for (i = 0; i < ms->numa_state->num_nodes; i++) {
|
||||
uint64_t size = numa_info[i].node_mem;
|
||||
HostMemoryBackend *backend = numa_info[i].node_memdev;
|
||||
uint64_t size = ms->numa_state->nodes[i].node_mem;
|
||||
HostMemoryBackend *backend = ms->numa_state->nodes[i].node_memdev;
|
||||
if (!backend) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -594,7 +597,7 @@ void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms)
|
|||
|
||||
numa_stat_memory_devices(node_mem);
|
||||
for (i = 0; i < ms->numa_state->num_nodes; i++) {
|
||||
node_mem[i].node_mem += numa_info[i].node_mem;
|
||||
node_mem[i].node_mem += ms->numa_state->nodes[i].node_mem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue