numa: code consolidation and fixes
v3 cover numa: code consolidation and fixes
changelog since v2:
(Eduardo)
- keep original logic in when moving numa part into helper
numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
- drop "numa: fallback to default NUMA node instead of node 0"
- split out monitor hunk into separate patch
- split out spapr_fixup_cpu_numa_dt refactoring into separate patch
- add extra patch to make default node-id calculation more robust
changelog since v1:
(Eduardo)
- user error_abort in numa_cpu_pre_plug()
- make default_mapping boolean
- redo default mapping detection loop as a combo of for/if
- return back lost TODO comment
- new patch removing numa_node from generic CPUState
- drop silence test patch as it's already in pull req on list
- new patch [3/5] to fix missing _PXM/fdt nodes for implicitly mapped CPUs
- new patch dropping fallback to node 0
git repo for testing:
https://github.com/imammedo/qemu.git cphp_numa_cfg_follow_up_v3_cleanups_v3
Igor Mammedov (7):
numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
numa: move default mapping init to machine
numa: make sure that all cpus have has_node_id set if numa is enabled
numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus()
result
numa: move numa_node from CPUState into target specific classes
spapr: cleanup spapr_fixup_cpu_numa_dt() usage
numa: cpu: calculate/set default node-ids after all -numa CLI options
are parsed
include/hw/boards.h | 3 +++ include/qom/cpu.h | 2 -- include/sysemu/numa.h | 10 +++++++++ target/arm/cpu.h | 2 ++ target/i386/cpu.h | 1 + target/ppc/cpu.h | 1 + hw/arm/virt-acpi-build.c | 4 +--- hw/arm/virt.c | 32 +++++++++------------------ hw/core/machine.c | 38 +++++++++++++++++++++++--------- hw/i386/acpi-build.c | 3 +-- hw/i386/pc.c | 42 ++++++++++++----------------------- hw/ppc/spapr.c | 57 ++++++++++++++++-------------------------------- hw/ppc/spapr_cpu_core.c | 4 +++- monitor.c | 11 ++++++---- numa.c | 43 +++++++++++++++--------------------- target/arm/cpu.c | 2 +- target/i386/cpu.c | 2 +- 17 files changed, 119 insertions(+), 138 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/7 numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
---
v3:
retain opriginal error checking logic in case of
"node-id" set && !slot->props.has_node_id
it will be cleaned up in a follow up patch
Eduardo Habkost <[email protected]>
v2:
user error_abort in numa_cpu_pre_plug()
Eduardo Habkost <[email protected]>
--- include/sysemu/numa.h | 1 + hw/arm/virt.c | 16 ++-------------- hw/i386/pc.c | 17 +---------------- hw/ppc/spapr.c | 17 +---------------- numa.c | 23 +++++++++++++++++++++++ 5 files changed, 28 insertions(+), 46 deletions(-)
include/sysemu/numa.h +1 -0
@@ -35,4 +35,5 @@ void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, int nb_nodes, ram_addr_t size);void numa_default_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size); +void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp);#endif
hw/arm/virt.c +2 -14
@@ -1351,7 +1351,6 @@ static void machvirt_init(MachineState *machine)for (n =0 ; n < possible_cpus->len; n++) {Object *cpuobj;CPUState *cs; -int node_id;if (n >= smp_cpus) {break ;
@@ -1364,19 +1363,8 @@ static void machvirt_init(MachineState *machine) cs =CPU (cpuobj); cs->cpu_index = n; - node_id = possible_cpus->cpus[cs->cpu_index].props.node_id; -if (!possible_cpus->cpus[cs->cpu_index].props.has_node_id) { -/* by default CPUState::numa_node was 0 if it's not set via CLI -* keep it this way for now but in future we probably should -* refuse to start up with incomplete numa mapping */ - node_id =0 ; - } -if (cs->numa_node ==CPU_UNSET_NUMA_NODE_ID ) { - cs->numa_node = node_id; - }else { -/* CPU isn't device_add compatible yet, this shouldn't happen */ -error_setg (&error_abort,"user set node-id not implemented" ); - } +numa_cpu_pre_plug (&possible_cpus->cpus[cs->cpu_index],DEVICE (cpuobj), + &error_fatal);if (!vms->secure) {object_property_set_bool (cpuobj, false,"has_el3" ,NULL );
hw/i386/pc.c +1 -16
@@ -1893,7 +1893,6 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) {int idx; -int node_id;CPUState *cs;CPUArchId *cpu_slot;X86CPUTopoInfo topo;
@@ -1984,21 +1983,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, cs =CPU (cpu); cs->cpu_index = idx; - node_id = cpu_slot->props.node_id; -if (!cpu_slot->props.has_node_id) { -/* by default CPUState::numa_node was 0 if it's not set via CLI -* keep it this way for now but in future we probably should -* refuse to start up with incomplete numa mapping */ - node_id =0 ; - } -if (cs->numa_node ==CPU_UNSET_NUMA_NODE_ID ) { - cs->numa_node = node_id; - }else if (cs->numa_node != node_id) { -error_setg (errp,"node-id %d must match numa node specified" -"with -numa option for cpu-index %d" , - cs->numa_node, cs->cpu_index); -return ; - } +numa_cpu_pre_plug (cpu_slot, dev, errp); } static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
hw/ppc/spapr.c +1 -16
@@ -2831,11 +2831,9 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,MachineClass *mc =MACHINE_GET_CLASS (hotplug_dev);Error *local_err =NULL ;CPUCore *cc =CPU_CORE (dev); -sPAPRCPUCore *sc =SPAPR_CPU_CORE (dev);char *base_core_type =spapr_get_cpu_core_type (machine->cpu_model);const char *type =object_get_typename (OBJECT (dev));CPUArchId *core_slot; -int node_id;int index;if (dev->hotplugged && !mc->has_hotpluggable_cpus) {
@@ -2870,20 +2868,7 @@ static void spapr_core_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, goto out; } - node_id = core_slot->props.node_id; -if (!core_slot->props.has_node_id) { -/* by default CPUState::numa_node was 0 if it's not set via CLI -* keep it this way for now but in future we probably should -* refuse to start up with incomplete numa mapping */ - node_id =0 ; - } -if (sc->node_id ==CPU_UNSET_NUMA_NODE_ID ) { - sc->node_id = node_id; - }else if (sc->node_id != node_id) { -error_setg (&local_err,"node-id %d must match numa node specified" -"with -numa option for cpu-index %d" , sc->node_id, cc->core_id); - goto out; - } +numa_cpu_pre_plug (core_slot, dev, &local_err); out:g_free (base_core_type);
numa.c +23 -0
@@ -534,6 +534,29 @@ void parse_numa_opts(MachineState *ms) } } +void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp) +{ +int mapped_node_id;/* set by -numa option */ +int node_id =object_property_get_int (OBJECT (dev),"node-id" , &error_abort); + +/* by default CPUState::numa_node was 0 if it wasn't set explicitly +* TODO: make it error when incomplete numa mapping support is removed +*/ + mapped_node_id = slot->props.node_id; +if (!slot->props.has_node_id) { + mapped_node_id =0 ; + } + +if (node_id ==CPU_UNSET_NUMA_NODE_ID ) { +/* due to bug in libvirt, it doesn't pass node-id from props on +* device_add as expected, so we have to fix it up here */ +object_property_set_int (OBJECT (dev), mapped_node_id,"node-id" , errp); + }else if (node_id != mapped_node_id) { +error_setg (errp,"node-id=%d must match numa node specified " +"with -numa option" , node_id); + } +} +static void allocate_system_memory_nonnuma (MemoryRegion *mr,Object *owner,const char *name,uint64_t ram_size)
Signature · 1 line
2.7.4
PATCH v3 2/7 numa: move default mapping init to machine
In reply to Igor Mammedovthere is no need use cpu_index_to_instance_props() for setting default cpu -> node mapping. Generic machine code can do it without cpu_index by just enabling already preset defaults in possible_cpus.
PS:
as bonus it makes one less user of cpu_index_to_instance_props()
---
v2:
- make default_mapping boolean, Eduardo Habkost <[email protected]>
- redo default mapping detection loop as a combo of for/if, Eduardo Habkost <[email protected]>
- return back lost TODO comment, Eduardo Habkost <[email protected]>
--- hw/core/machine.c | 33 +++++++++++++++++++++++---------- numa.c | 26 -------------------------- 2 files changed, 23 insertions(+), 36 deletions(-)
hw/core/machine.c +23 -10
@@ -700,26 +700,39 @@ static char *cpu_slot_to_string(const CPUArchId *cpu)return g_string_free (s, false); } -static void machine_numa_validate (MachineState *machine) +static void machine_numa_finish_init (MachineState *machine) {int i; +bool default_mapping;GString *s =g_string_new (NULL );MachineClass *mc =MACHINE_GET_CLASS (machine);const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids (machine);assert (nb_numa_nodes);for (i =0 ; i < possible_cpus->len; i++) { +if (possible_cpus->cpus[i].props.has_node_id) { +break ; + } + } + default_mapping = (i == possible_cpus->len); + +for (i =0 ; i < possible_cpus->len; i++) {const CPUArchId *cpu_slot = &possible_cpus->cpus[i]; -/* at this point numa mappings are initilized by CLI options -* or with default mappings so it's sufficient to list -* all not yet mapped CPUs here */ -/* TODO: make it hard error in future */ if (!cpu_slot->props.has_node_id) { -char *cpu_str =cpu_slot_to_string (cpu_slot); -g_string_append_printf (s,"%sCPU %d [%s]" , s->len ?", " :"" , i, - cpu_str); -g_free (cpu_str); +if (default_mapping) { +/* fetch default mapping from board and enable it */ +CpuInstanceProperties props = cpu_slot->props; + props.has_node_id = true; +machine_set_cpu_numa_node (machine, &props, &error_fatal); + }else { +/* record slots with not set mapping, +* TODO: make it hard error in future */ +char *cpu_str =cpu_slot_to_string (cpu_slot); +g_string_append_printf (s,"%sCPU %d [%s]" , + s->len ?", " :"" , i, cpu_str); +g_free (cpu_str); + } } }if (s->len) {
@@ -737,7 +750,7 @@ void machine_run_board_init(MachineState *machine)MachineClass *machine_class =MACHINE_GET_CLASS (machine);if (nb_numa_nodes) { -machine_numa_validate (machine); +machine_numa_finish_init (machine); } machine_class->init (machine); }
numa.c +0 -26
@@ -427,7 +427,6 @@ void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,void parse_numa_opts (MachineState *ms) {int i; -const CPUArchIdList *possible_cpus;MachineClass *mc =MACHINE_GET_CLASS (ms);if (qemu_opts_foreach (qemu_find_opts ("numa" ), parse_numa, ms,NULL )) {
@@ -485,31 +484,6 @@ void parse_numa_opts(MachineState *ms)numa_set_mem_ranges (); -/* assign CPUs to nodes using board provided default mapping */ -if (!mc->cpu_index_to_instance_props || !mc->possible_cpu_arch_ids) { -error_report ("default CPUs to NUMA node mapping isn't supported" ); -exit (1 ); - } - - possible_cpus = mc->possible_cpu_arch_ids (ms); -for (i =0 ; i < possible_cpus->len; i++) { -if (possible_cpus->cpus[i].props.has_node_id) { -break ; - } - } - -/* no CPUs are assigned to NUMA nodes */ -if (i == possible_cpus->len) { -for (i =0 ; i < max_cpus; i++) { -CpuInstanceProperties props; -/* fetch default mapping from board and enable it */ - props = mc->cpu_index_to_instance_props (ms, i); - props.has_node_id = true; - -machine_set_cpu_numa_node (ms, &props, &error_fatal); - } - } -/* QEMU needs at least all unique node pair distances to build * the whole NUMA distance table. QEMU treats the distance table * as symmetric by default, i.e. distance A->B == distance B->A.
Signature · 1 line
2.7.4
PATCH v3 3/7 numa: make sure that all cpus have has_node_id set if numa is enabled
In reply to Igor MammedovIt fixes/add missing _PXM object for non mapped CPU (x86) and missing fdt node (virt-arm).
It ensures that possible_cpus contains complete mapping if numa is enabled by the time machine_init() is executed.
As result non completely mapped CPUs:
1) appear in ACPI/fdt blobs
2) QMP query-hotpluggable-cpus command shows bound nodes for such CPUs
3) allows to drop checks for has_node_id in numa only code, reducing number of invariants incomplete mapping could produce
4) moves fixup/implicit node init from runtime numa_cpu_pre_plug() (when CPU object is created) to machine_numa_finish_init() which helps to fix [1, 2] and make possible_cpus complete source of numa mapping available even before CPUs are created.
--- hw/arm/virt-acpi-build.c | 4 +--- hw/core/machine.c | 16 ++++++++++------ hw/i386/acpi-build.c | 3 +-- hw/i386/pc.c | 4 +--- numa.c | 16 +++++----------- 5 files changed, 18 insertions(+), 25 deletions(-)
hw/arm/virt-acpi-build.c +1 -3
@@ -496,12 +496,10 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) srat->reserved1 =cpu_to_le32 (1 );for (i =0 ; i < cpu_list->len; ++i) { -int node_id = cpu_list->cpus[i].props.has_node_id ? - cpu_list->cpus[i].props.node_id :0 ; core =acpi_data_push (table_data,sizeof (*core)); core->type =ACPI_SRAT_PROCESSOR_GICC ; core->length =sizeof (*core); - core->proximity =cpu_to_le32 (node_id); + core->proximity =cpu_to_le32 (cpu_list->cpus[i].props.node_id); core->acpi_processor_uid =cpu_to_le32 (i); core->flags =cpu_to_le32 (1 ); }
hw/core/machine.c +10 -6
@@ -720,19 +720,23 @@ static void machine_numa_finish_init(MachineState *machine)const CPUArchId *cpu_slot = &possible_cpus->cpus[i];if (!cpu_slot->props.has_node_id) { -if (default_mapping) { -/* fetch default mapping from board and enable it */ -CpuInstanceProperties props = cpu_slot->props; - props.has_node_id = true; -machine_set_cpu_numa_node (machine, &props, &error_fatal); - }else { +/* fetch default mapping from board and enable it */ +CpuInstanceProperties props = cpu_slot->props; + +if (!default_mapping) {/* record slots with not set mapping, * TODO: make it hard error in future */ char *cpu_str =cpu_slot_to_string (cpu_slot);g_string_append_printf (s,"%sCPU %d [%s]" , s->len ?", " :"" , i, cpu_str);g_free (cpu_str); + +/* non mapped cpus used to fallback to node 0 */ + props.node_id =0 ; } + + props.has_node_id = true; +machine_set_cpu_numa_node (machine, &props, &error_fatal); } }if (s->len) {
hw/i386/acpi-build.c +1 -2
@@ -2335,8 +2335,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) srat->reserved1 =cpu_to_le32 (1 );for (i =0 ; i < apic_ids->len; i++) { -int node_id = apic_ids->cpus[i].props.has_node_id ? - apic_ids->cpus[i].props.node_id :0 ; +int node_id = apic_ids->cpus[i].props.node_id;uint32_t apic_id = apic_ids->cpus[i].arch_id;if (apic_id <255 ) {
hw/i386/pc.c +1 -3
@@ -788,9 +788,7 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms)for (i =0 ; i < cpus->len; i++) {unsigned int apic_id = cpus->cpus[i].arch_id;assert (apic_id < pcms->apic_id_limit); -if (cpus->cpus[i].props.has_node_id) { - numa_fw_cfg[apic_id +1 ] =cpu_to_le64 (cpus->cpus[i].props.node_id); - } + numa_fw_cfg[apic_id +1 ] =cpu_to_le64 (cpus->cpus[i].props.node_id); }for (i =0 ; i < nb_numa_nodes; i++) { numa_fw_cfg[pcms->apic_id_limit + 1 + i] =
numa.c +5 -11
@@ -510,22 +510,16 @@ void parse_numa_opts(MachineState *ms)void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp) { -int mapped_node_id;/* set by -numa option */ int node_id =object_property_get_int (OBJECT (dev),"node-id" , &error_abort); -/* by default CPUState::numa_node was 0 if it wasn't set explicitly -* TODO: make it error when incomplete numa mapping support is removed -*/ - mapped_node_id = slot->props.node_id; -if (!slot->props.has_node_id) { - mapped_node_id =0 ; - } -if (node_id ==CPU_UNSET_NUMA_NODE_ID ) {/* due to bug in libvirt, it doesn't pass node-id from props on * device_add as expected, so we have to fix it up here */ -object_property_set_int (OBJECT (dev), mapped_node_id,"node-id" , errp); - }else if (node_id != mapped_node_id) { +if (slot->props.has_node_id) { +object_property_set_int (OBJECT (dev), slot->props.node_id, +"node-id" , errp); + } + }else if (node_id != slot->props.node_id) {error_setg (errp,"node-id=%d must match numa node specified " "with -numa option" , node_id); }
Signature · 1 line
2.7.4
PATCH v3 4/7 numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result
In reply to Igor MammedovHMP command 'info numa' is the last external user that access CPUState::numa_node field directly. In order to move it to CPU classes that actually use it, eliminate direct access and use an alternative approach by using result of qmp_query_cpus(), which provides topology properties CPU threads are associated with (including node-id).
--- monitor.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
monitor.c +7 -4
@@ -1696,23 +1696,26 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)static void hmp_info_numa (Monitor *mon,const QDict *qdict) {int i; -CPUState *cpu;uint64_t *node_mem; +CpuInfoList *cpu_list, *cpu; + cpu_list =qmp_query_cpus (&error_abort); node_mem =g_new0 (uint64_t, nb_numa_nodes);query_numa_node_mem (node_mem);monitor_printf (mon,"%d nodes\n" , nb_numa_nodes);for (i =0 ; i < nb_numa_nodes; i++) {monitor_printf (mon,"node %d cpus:" , i); -CPU_FOREACH (cpu) { -if (cpu->numa_node == i) { -monitor_printf (mon," %d" , cpu->cpu_index); +for (cpu = cpu_list; cpu; cpu = cpu->next) { +if (cpu->value->has_props && cpu->value->props->has_node_id && + cpu->value->props->node_id == i) { +monitor_printf (mon," %" PRIi64, cpu->value->CPU); } }monitor_printf (mon,"\n" );monitor_printf (mon,"node %d size: %" PRId64" MB\n" , i, node_mem[i] >>20 ); } +qapi_free_CpuInfoList (cpu_list);g_free (node_mem); }
Signature · 1 line
2.7.4
PATCH v3 5/7 numa: move numa_node from CPUState into target specific classes
In reply to Igor MammedovMove vcpu's assocciated numa_node field out of generic CPUState into inherited classes that actually care about cpu<->numa mapping, i.e: ARMCPU, PowerPCCPU, X86CPU.
--- include/qom/cpu.h | 2 -- target/arm/cpu.h | 2 ++ target/i386/cpu.h | 1 + target/ppc/cpu.h | 1 + hw/ppc/spapr.c | 2 +- hw/ppc/spapr_cpu_core.c | 4 +++- target/arm/cpu.c | 2 +- target/i386/cpu.c | 2 +- 8 files changed, 10 insertions(+), 6 deletions(-)
include/qom/cpu.h +0 -2
@@ -265,7 +265,6 @@ struct qemu_work_item;* @cpu_index: CPU index (informative). * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU. -* @numa_node: NUMA node this CPU is belonging to. * @host_tid: Host thread ID. * @running: #true if CPU is currently running (lockless). * @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end;
@@ -314,7 +313,6 @@ struct CPUState {int nr_cores;int nr_threads; -int numa_node;struct QemuThread *thread;#ifdef _WIN32
target/arm/cpu.h +2 -0
@@ -703,6 +703,8 @@ struct ARMCPU {ARMELChangeHook *el_change_hook;void *el_change_hook_opaque; + +int32_t node_id;/* NUMA node this CPU is belonging to */ };static inline ARMCPU *arm_env_get_cpu (CPUARMState *env)
target/i386/cpu.h +1 -0
@@ -1275,6 +1275,7 @@ struct X86CPU {struct kvm_msrs *kvm_msr_buf; +int32_t node_id;/* NUMA node this CPU is belonging to */ int32_t socket_id;int32_t core_id;int32_t thread_id;
target/ppc/cpu.h +1 -0
@@ -1205,6 +1205,7 @@ struct PowerPCCPU {uint32_t compat_pvr;PPCVirtualHypervisor *vhyp;Object *intc; +int32_t node_id;/* NUMA node this CPU is belonging to */ /* Fields related to migration compatibility hacks */ bool pre_2_8_migration;
hw/ppc/spapr.c +1 -1
@@ -187,7 +187,7 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, CPUState *cs)cpu_to_be32 (0x0 ),cpu_to_be32 (0x0 ),cpu_to_be32 (0x0 ), -cpu_to_be32 (cs->numa_node), +cpu_to_be32 (cpu->node_id), cpu_to_be32(index)};/* Advertise NUMA via ibm,associativity */
hw/ppc/spapr_cpu_core.c +3 -1
@@ -183,15 +183,17 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)for (i =0 ; i < cc->nr_threads; i++) {char id[32 ];CPUState *cs; +PowerPCCPU *cpu; obj = sc->threads + i * size;object_initialize (obj, size, typename); cs =CPU (obj); + cpu =POWERPC_CPU (cs); cs->cpu_index = cc->core_id + i;/* Set NUMA node for the threads belonged to core */ - cs->numa_node = sc->node_id; + cpu->node_id = sc->node_id;snprintf (id,sizeof (id),"thread[%d]" , i);object_property_add_child (OBJECT (sc), id, obj, &local_err);
target/arm/cpu.c +1 -1
@@ -1573,7 +1573,7 @@ static Property arm_cpu_properties[] = {DEFINE_PROP_UINT32 ("midr" ,ARMCPU , midr,0 ),DEFINE_PROP_UINT64 ("mp-affinity" ,ARMCPU , mp_affinity,ARM64_AFFINITY_INVALID ), -DEFINE_PROP_INT32 ("node-id" , CPUState, numa_node,CPU_UNSET_NUMA_NODE_ID ), +DEFINE_PROP_INT32 ("node-id" ,ARMCPU , node_id,CPU_UNSET_NUMA_NODE_ID ), DEFINE_PROP_END_OF_LIST() };
target/i386/cpu.c +1 -1
@@ -3986,7 +3986,7 @@ static Property x86_cpu_properties[] = {DEFINE_PROP_INT32 ("core-id" ,X86CPU , core_id,-1 ),DEFINE_PROP_INT32 ("socket-id" ,X86CPU , socket_id,-1 ), #endif -DEFINE_PROP_INT32 ("node-id" , CPUState, numa_node,CPU_UNSET_NUMA_NODE_ID ), +DEFINE_PROP_INT32 ("node-id" ,X86CPU , node_id,CPU_UNSET_NUMA_NODE_ID ),DEFINE_PROP_BOOL ("pmu" ,X86CPU , enable_pmu, false), { .name = "hv-spinlocks", .info = &qdev_prop_spinlocks }, DEFINE_PROP_BOOL("hv-relaxed", X86CPU, hyperv_relaxed_timing, false),
Signature · 1 line
2.7.4
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 5/7] numa: move numa_node from CPUState into target specific classes
Quoted 1 line · Igor Mammedov
Move vcpu's assocciated
numa_nodefield out of generic CPUState
s/assocciated/associated/
target/arm/cpu.h struct ARMCPU { · line 707
Quoted 13 lines
into inherited classes that actually care about cpu<->numa mapping, i.e: ARMCPU, PowerPCCPU, X86CPU.
Signed-off-by Igor Mammedov <[email protected]>---
+++
b/target/arm/cpu.htarget/arm/cpu.h +2
-0@@ -703,6 +703,8 @@ struct ARMCPU {ARMELChangeHook *el_change_hook;void *el_change_hook_opaque; + +int32_t node_id;/* NUMA node this CPU is belonging to */
s/is belonging/belongs/ (multiple places in the patch)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 5/7] numa: move numa_node from CPUState into target specific classes
Quoted 14 lines · Eric Blake
Quoted 1 line · Igor Mammedov
Move vcpu's assocciated
numa_nodefield out of generic CPUStates/assocciated/associated/
Quoted 9 lines
into inherited classes that actually care about cpu<->numa mapping, i.e: ARMCPU, PowerPCCPU, X86CPU.
Signed-off-by Igor Mammedov <[email protected]>---
+++
b/target/arm/cpu.h(quoted diff) +0
-0@@ -703,6 +703,8 @@ struct ARMCPU {
Quoted 6 lines
target/arm/cpu.h struct ARMCPU { · line 707
Quoted 4 lines
target/arm/cpu.h +2
-0ARMELChangeHook *el_change_hook;void *el_change_hook_opaque; + +int32_t node_id;/* NUMA node this CPU is belonging to */ s/is belonging/belongs/ (multiple places in the patch)
I have fixed those while applying the patch. Thanks!
Signature · 1 line
Eduardo
PATCH v3 6/7 spapr: cleanup spapr_fixup_cpu_numa_dt() usage
In reply to Igor Mammedoveven though spapr_fixup_cpu_numa_dt() has no effect on FDT if numa is disabled, don't call it uselessly. It makes it obvious at call sites that function is need only when numa is enabled.
--- hw/ppc/spapr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
hw/ppc/spapr.c +10 -12
@@ -178,10 +178,8 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,return ret; } -static int spapr_fixup_cpu_numa_dt (void *fdt,int offset,CPUState *cs) +static int spapr_fixup_cpu_numa_dt (void *fdt,int offset,PowerPCCPU *cpu) { -int ret =0 ; -PowerPCCPU *cpu =POWERPC_CPU (cs);int index =ppc_get_vcpu_dt_id (cpu);uint32_t associativity[] = {cpu_to_be32 (0x5 ),cpu_to_be32 (0x0 ),
@@ -191,12 +189,8 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, CPUState *cs) cpu_to_be32(index)};/* Advertise NUMA via ibm,associativity */ -if (nb_numa_nodes >1 ) { - ret =fdt_setprop (fdt, offset,"ibm,associativity" , associativity, +return fdt_setprop (fdt, offset,"ibm,associativity" , associativity,sizeof (associativity)); - } - -return ret; }/* Populate the "ibm,pa-features" property */
@@ -321,9 +315,11 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)return ret; } - ret =spapr_fixup_cpu_numa_dt (fdt, offset, cs); -if (ret <0 ) { -return ret; +if (nb_numa_nodes >1 ) { + ret =spapr_fixup_cpu_numa_dt (fdt, offset, cpu); +if (ret <0 ) { +return ret; + } } ret =spapr_fixup_cpu_smt_dt (fdt, offset, cpu, compat_smt);
@@ -538,7 +534,9 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,_FDT ((fdt_setprop (fdt, offset,"ibm,pft-size" , pft_size_prop,sizeof (pft_size_prop)))); -_FDT (spapr_fixup_cpu_numa_dt (fdt, offset, cs)); +if (nb_numa_nodes >1 ) { +_FDT (spapr_fixup_cpu_numa_dt (fdt, offset, cpu)); + }_FDT (spapr_fixup_cpu_smt_dt (fdt, offset, cpu, compat_smt));
Signature · 1 line
2.7.4
Re: [Qemu-devel] [Qemu-ppc] [PATCH v3 6/7] spapr: cleanup spapr_fixup_cpu_numa_dt() usage
Quoted 3 lines · On Tue, 30 May 2017 18:24:01 +0200 Igor Mammedov <[email protected]> wrote:
even though
spapr_fixup_cpu_numa_dt()has no effect on FDT if numa is disabled, don't call it uselessly. It makes it obvious at call sites that function is need only when numa
s/need/needed
Quoted 4 lines
is enabled.
Signed-off-by Igor Mammedov <[email protected]>---
Quoted 59 lines
hw/ppc/spapr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)hw/ppc/spapr.c +10
-12@@ -178,10 +178,8 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu,return ret; } -static int spapr_fixup_cpu_numa_dt (void *fdt,int offset,CPUState *cs) +static int spapr_fixup_cpu_numa_dt (void *fdt,int offset,PowerPCCPU *cpu) { -int ret =0 ; -PowerPCCPU *cpu =POWERPC_CPU (cs);int index =ppc_get_vcpu_dt_id (cpu);uint32_t associativity[] = {cpu_to_be32 (0x5 ),cpu_to_be32 (0x0 ),@@ -191,12 +189,8 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, CPUState *cs) cpu_to_be32(index)};/* Advertise NUMA via ibm,associativity */ -if (nb_numa_nodes >1 ) { - ret =fdt_setprop (fdt, offset,"ibm,associativity" , associativity, +return fdt_setprop (fdt, offset,"ibm,associativity" , associativity,sizeof (associativity)); - } - -return ret; }/* Populate the "ibm,pa-features" property */ @@ -321,9 +315,11 @@ static int spapr_fixup_cpu_dt(void *fdt, sPAPRMachineState *spapr)return ret; } - ret =spapr_fixup_cpu_numa_dt (fdt, offset, cs); -if (ret <0 ) { -return ret; +if (nb_numa_nodes >1 ) { + ret =spapr_fixup_cpu_numa_dt (fdt, offset, cpu); +if (ret <0 ) { +return ret; + } } ret =spapr_fixup_cpu_smt_dt (fdt, offset, cpu, compat_smt);@@ -538,7 +534,9 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset,_FDT ((fdt_setprop (fdt, offset,"ibm,pft-size" , pft_size_prop,sizeof (pft_size_prop)))); -_FDT (spapr_fixup_cpu_numa_dt (fdt, offset, cs)); +if (nb_numa_nodes >1 ) { +_FDT (spapr_fixup_cpu_numa_dt (fdt, offset, cpu)); + }_FDT (spapr_fixup_cpu_smt_dt (fdt, offset, cpu, compat_smt));
Re: [Qemu-arm] [Qemu-ppc] [PATCH v3 6/7] spapr: cleanup spapr_fixup_cpu_numa_dt() usage
Quoted 8 lines · Greg Kurz
Quoted 3 lines · On Tue, 30 May 2017 18:24:01 +0200 Igor Mammedov <[email protected]> wrote:
even though
spapr_fixup_cpu_numa_dt()has no effect on FDT if numa is disabled, don't call it uselessly. It makes it obvious at call sites that function is need only when numas/need/needed
Fixed while applying the patch. Thanks!
Quoted 8 lines
Quoted 5 lines
is enabled.
Signed-off-by Igor Mammedov <[email protected]>---
Reviewed-by Greg Kurz <[email protected]>
Signature · 1 line
Eduardo
PATCH v3 7/7 numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
In reply to Igor MammedovCalculating default node-ids for CPUs in possible_cpu_arch_ids() is rather fragile since defaults calculation uses nb_numa_nodes but callback might be potentially called early before all -numa CLI options are parsed, which would lead to cpus assigned only upto nb_numa_nodes at the time possible_cpu_arch_ids() is called.
Issue was introduced by
(7c88e65 numa: mirror cpu to node mapping in MachineState::possible_cpus) and for example CLI:
-smp 4 -numa node,cpus=0 -numa node
would set props.node-id in possible_cpus array for every non explicitly mapped CPU to the first node.
Issue is not visible to guest nor to mgmt interface due to
1) implictly mapped cpus are forced to the first node in case of partial mapping
2) in case of default mapping possible_cpu_arch_ids() is called after all -numa options are parsed (resulting in correct mapping).
However it's fragile to rely on late execution of possible_cpu_arch_ids(), therefore add machine specific callback that returns node-id for CPU and use it to calculate/ set defaults at machine_numa_finish_init() time when all -numa options are parsed.
--- include/hw/boards.h | 3 +++ include/sysemu/numa.h | 9 +++++++++ hw/arm/virt.c | 16 ++++++++-------- hw/core/machine.c | 1 + hw/i386/pc.c | 21 ++++++++++++--------- hw/ppc/spapr.c | 16 +++++++--------- 6 files changed, 40 insertions(+), 26 deletions(-)
include/hw/boards.h +3 -0
@@ -94,6 +94,8 @@ typedef struct {* Returns an array of @CPUArchId architecture-dependent CPU IDs * which includes CPU IDs for present and possible to hotplug CPUs. * Caller is responsible for freeing returned list. +* @get_default_cpu_node_id: +* returns default board specific node_id value for CPU * @has_hotpluggable_cpus: * If true, board supports CPUs creation with -device/device_add. * @minimum_page_bits:
@@ -151,6 +153,7 @@ struct MachineClass {CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,unsigned cpu_index);const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); +int64_t (*get_default_cpu_node_id)(const MachineState *ms,int idx); };/**
include/sysemu/numa.h +9 -0
@@ -36,4 +36,13 @@ void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,void numa_default_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size);void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp); + +static inline void assert_nb_numa_nodes_change (void ) +{ +static int saved_nb_numa_nodes; +assert (nb_numa_nodes); +assert (saved_nb_numa_nodes ==0 || saved_nb_numa_nodes == nb_numa_nodes); + saved_nb_numa_nodes = nb_numa_nodes; +} +#endif
hw/arm/virt.c +8 -8
@@ -1553,6 +1553,13 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t virt_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +assert (nb_numa_nodes); +assert_nb_numa_nodes_change (); +return idx % nb_numa_nodes; +} +static const CPUArchIdList *virt_possible_cpu_arch_ids (MachineState *ms) {int n;
@@ -1571,14 +1578,6 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)virt_cpu_mp_affinity (vms, n); ms->possible_cpus->cpus[n].props.has_thread_id = true; ms->possible_cpus->cpus[n].props.thread_id = n; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - ms->possible_cpus->cpus[n].props.node_id = n % nb_numa_nodes; - } }return ms->possible_cpus; }
@@ -1601,6 +1600,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) mc->minimum_page_bits =12 ; mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; mc->cpu_index_to_instance_props = virt_cpu_index_to_props; + mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; }static const TypeInfo virt_machine_info = {
hw/core/machine.c +1 -0
@@ -723,6 +723,7 @@ static void machine_numa_finish_init(MachineState *machine)/* fetch default mapping from board and enable it */ CpuInstanceProperties props = cpu_slot->props; + props.node_id = mc->get_default_cpu_node_id (machine, i);if (!default_mapping) {/* record slots with not set mapping, * TODO: make it hard error in future */
hw/i386/pc.c +12 -9
@@ -2253,6 +2253,17 @@ pc_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t pc_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +X86CPUTopoInfo topo; + +assert_nb_numa_nodes_change (); +assert (ms->possible_cpus && (idx < ms->possible_cpus->len)); +x86_topo_ids_from_apicid (ms->possible_cpus->cpus[idx].arch_id, + smp_cores, smp_threads, &topo); +return topo.pkg_id % nb_numa_nodes; +} +static const CPUArchIdList *pc_possible_cpu_arch_ids (MachineState *ms) {int i;
@@ -2282,15 +2293,6 @@ static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms) ms->possible_cpus->cpus[i].props.core_id = topo.core_id; ms->possible_cpus->cpus[i].props.has_thread_id = true; ms->possible_cpus->cpus[i].props.thread_id = topo.smt_id; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - ms->possible_cpus->cpus[i].props.node_id = - topo.pkg_id % nb_numa_nodes; - } }return ms->possible_cpus; }
@@ -2335,6 +2337,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->linuxboot_dma_enabled = true; mc->get_hotplug_handler = pc_get_hotpug_handler; mc->cpu_index_to_instance_props = pc_cpu_index_to_props; + mc->get_default_cpu_node_id = pc_get_default_cpu_node_id; mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids; mc->has_hotpluggable_cpus = true; mc->default_boot_order ="cad" ;
hw/ppc/spapr.c +7 -9
@@ -3002,6 +3002,12 @@ spapr_cpu_index_to_props(MachineState *machine, unsigned cpu_index)return core_slot->props; } +static int64_t spapr_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +assert_nb_numa_nodes_change (); +return idx / smp_cores % nb_numa_nodes; +} +static const CPUArchIdList *spapr_possible_cpu_arch_ids (MachineState *machine) {int i;
@@ -3026,15 +3032,6 @@ static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *machine) machine->possible_cpus->cpus[i].arch_id = core_id; machine->possible_cpus->cpus[i].props.has_core_id = true; machine->possible_cpus->cpus[i].props.core_id = core_id; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - machine->possible_cpus->cpus[i].props.node_id = - core_id / smp_threads / smp_cores % nb_numa_nodes; - } }return machine->possible_cpus; }
@@ -3160,6 +3157,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_instance_props = spapr_cpu_index_to_props; + mc->get_default_cpu_node_id = spapr_get_default_cpu_node_id; mc->possible_cpu_arch_ids = spapr_possible_cpu_arch_ids; hc->unplug_request = spapr_machine_device_unplug_request;
Signature · 1 line
2.7.4
Re: [Qemu-arm] [PATCH v3 7/7] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
Quoted 51 lines · Igor Mammedov
Calculating default node-ids for CPUs in
possible_cpu_arch_ids()is rather fragile since defaults calculation usesnb_numa_nodesbut callback might be potentially called early before all -numa CLI options are parsed, which would lead to cpus assigned only uptonb_numa_nodesat the timepossible_cpu_arch_ids()is called.Issue was introduced by
(7c88e65 numa: mirror cpu to node mapping inMachineState::possible_cpus) and for example CLI:
-smp 4 -numa node,cpus=0 -numa node
would set props.node-id inpossible_cpusarray for every non explicitly mapped CPU to the first node.Issue is not visible to guest nor to mgmt interface due to
1) implictly mapped cpus are forced to the first node in case of partial mapping
2) in case of default mappingpossible_cpu_arch_ids()is called after all -numa options are parsed (resulting in correct mapping).However it's fragile to rely on late execution of
possible_cpu_arch_ids(), therefore add machine specific callback that returns node-id for CPU and use it to calculate/ set defaults atmachine_numa_finish_init()time when all -numa options are parsed.Reported-by Eduardo Habkost <[email protected]>Signed-off-by Igor Mammedov <[email protected]>--- include/hw/boards.h | 3 +++ include/sysemu/numa.h | 9 +++++++++ hw/arm/virt.c | 16 ++++++++-------- hw/core/machine.c | 1 + hw/i386/pc.c | 21 ++++++++++++--------- hw/ppc/spapr.c | 16 +++++++--------- 6 files changed, 40 insertions(+), 26 deletions(-)include/hw/boards.h +2
-0@@ -94,6 +94,8 @@ typedef struct {* Returns an array of @CPUArchId architecture-dependent CPU IDs * which includes CPU IDs for present and possible to hotplug CPUs. * Caller is responsible for freeing returned list. +* @get_default_cpu_node_id: +* returns default board specific node_id value for CPU * @has_hotpluggable_cpus: * If true, board supports CPUs creation with -device/device_add. * @minimum_page_bits:
include/hw/boards.h struct MachineClass { · line 156
Quoted 4 lines
include/hw/boards.h +1
-0@@ -151,6 +153,7 @@ struct MachineClass {CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,unsigned cpu_index);const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); +int64_t (*get_default_cpu_node_id)(const MachineState *ms,int idx);
Aren't we trying to move away from cpu_index-based CPU identification? Shouldn't we make this get a CPUArchId argument?
include/sysemu/numa.h void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, · line 40
Quoted 13 lines
include/hw/boards.h +0
-0};/** include/sysemu/numa.h +2
-0@@ -36,4 +36,13 @@ void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,void numa_default_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size);void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp); + +static inline void assert_nb_numa_nodes_change (void )
Can you document the purpose of this function?
Quoted 13 lines
include/sysemu/numa.h +7
-0+{ +static int saved_nb_numa_nodes; +assert (nb_numa_nodes); +assert (saved_nb_numa_nodes ==0 || saved_nb_numa_nodes == nb_numa_nodes); + saved_nb_numa_nodes = nb_numa_nodes; +} +#endif hw/arm/virt.c +0
-0
hw/arm/virt.c virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index) · line 1559
Quoted 7 lines
hw/arm/virt.c +4
-0@@ -1553,6 +1553,13 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t virt_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +assert (nb_numa_nodes); +assert_nb_numa_nodes_change ();
I would move this assert to common code instead of copying it to all implementations.
A machine_get_default_cpu_node_id() wrapper that calls assert_nb_numa_nodes_change() and mc->get_default_cpu_node_id() would be enough, and it wouldn't even need to be declared in a header as the only caller would be at hw/core/machine.c.
(Or, if you prefer to simply drop the assert(), I think that would be OK too.)
Quoted 131 lines
hw/arm/virt.c +4
-8+return idx % nb_numa_nodes; +} +static const CPUArchIdList *virt_possible_cpu_arch_ids (MachineState *ms) {int n;@@ -1571,14 +1578,6 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)virt_cpu_mp_affinity (vms, n); ms->possible_cpus->cpus[n].props.has_thread_id = true; ms->possible_cpus->cpus[n].props.thread_id = n; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - ms->possible_cpus->cpus[n].props.node_id = n % nb_numa_nodes; - } }return ms->possible_cpus; }@@ -1601,6 +1600,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) mc->minimum_page_bits =12 ; mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; mc->cpu_index_to_instance_props = virt_cpu_index_to_props; + mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; }static const TypeInfo virt_machine_info = {hw/core/machine.c +1
-0@@ -723,6 +723,7 @@ static void machine_numa_finish_init(MachineState *machine)/* fetch default mapping from board and enable it */ CpuInstanceProperties props = cpu_slot->props; + props.node_id = mc->get_default_cpu_node_id (machine, i);if (!default_mapping) {/* record slots with not set mapping, * TODO: make it hard error in future */ hw/i386/pc.c +12
-9@@ -2253,6 +2253,17 @@ pc_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t pc_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +X86CPUTopoInfo topo; + +assert_nb_numa_nodes_change (); +assert (ms->possible_cpus && (idx < ms->possible_cpus->len)); +x86_topo_ids_from_apicid (ms->possible_cpus->cpus[idx].arch_id, + smp_cores, smp_threads, &topo); +return topo.pkg_id % nb_numa_nodes; +} +static const CPUArchIdList *pc_possible_cpu_arch_ids (MachineState *ms) {int i;@@ -2282,15 +2293,6 @@ static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms) ms->possible_cpus->cpus[i].props.core_id = topo.core_id; ms->possible_cpus->cpus[i].props.has_thread_id = true; ms->possible_cpus->cpus[i].props.thread_id = topo.smt_id; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - ms->possible_cpus->cpus[i].props.node_id = - topo.pkg_id % nb_numa_nodes; - } }return ms->possible_cpus; }@@ -2335,6 +2337,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->linuxboot_dma_enabled = true; mc->get_hotplug_handler = pc_get_hotpug_handler; mc->cpu_index_to_instance_props = pc_cpu_index_to_props; + mc->get_default_cpu_node_id = pc_get_default_cpu_node_id; mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids; mc->has_hotpluggable_cpus = true; mc->default_boot_order ="cad" ;hw/ppc/spapr.c +7
-9@@ -3002,6 +3002,12 @@ spapr_cpu_index_to_props(MachineState *machine, unsigned cpu_index)return core_slot->props; } +static int64_t spapr_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +assert_nb_numa_nodes_change (); +return idx / smp_cores % nb_numa_nodes; +} +static const CPUArchIdList *spapr_possible_cpu_arch_ids (MachineState *machine) {int i;@@ -3026,15 +3032,6 @@ static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *machine) machine->possible_cpus->cpus[i].arch_id = core_id; machine->possible_cpus->cpus[i].props.has_core_id = true; machine->possible_cpus->cpus[i].props.core_id = core_id; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - machine->possible_cpus->cpus[i].props.node_id = - core_id / smp_threads / smp_cores % nb_numa_nodes; - } }return machine->possible_cpus; }@@ -3160,6 +3157,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_instance_props = spapr_cpu_index_to_props; + mc->get_default_cpu_node_id = spapr_get_default_cpu_node_id; mc->possible_cpu_arch_ids = spapr_possible_cpu_arch_ids; hc->unplug_request = spapr_machine_device_unplug_request;Signature · 1 line
2.7.4
Signature · 1 line
Eduardo
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 7/7] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
Quoted 1 line · On Tue, 30 May 2017 17:03:32 -0300 Eduardo Habkost <[email protected]> wrote:
On Tue, May 30, 2017 at 06:24:02PM +0200, Igor Mammedov wrote:
[...]
Quoted 13 lines
Quoted 13 lines
include/hw/boards.h +2
-0@@ -94,6 +94,8 @@ typedef struct {* Returns an array of @CPUArchId architecture-dependent CPU IDs * which includes CPU IDs for present and possible to hotplug CPUs. * Caller is responsible for freeing returned list. +* @get_default_cpu_node_id: +* returns default board specific node_id value for CPU * @has_hotpluggable_cpus: * If true, board supports CPUs creation with -device/device_add. * @minimum_page_bits:
Quoted 8 lines
include/hw/boards.h struct MachineClass { · line 156
Quoted 5 lines
include/hw/boards.h +1
-0@@ -151,6 +153,7 @@ struct MachineClass {CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,unsigned cpu_index);const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); +int64_t (*get_default_cpu_node_id)(const MachineState *ms,int idx);Aren't we trying to move away from cpu_index-based CPU identification? Shouldn't we make this get a CPUArchId argument?
it's not cpu-index but index in possible_cpus[],
it's possible to pass in CPUArchId argument and then in callbacks compute it's index in possible_cpus[] but that seems
a bit unnecessary and would complicate callback impl.
Probably I should add doc comment explaining 'idx' meaning.
Quoted 40 lines
include/sysemu/numa.h void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, · line 40
Quoted 13 lines
include/hw/boards.h +0
-0};/** include/sysemu/numa.h +2
-0@@ -36,4 +36,13 @@ void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,void numa_default_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size);void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp); + +static inline void assert_nb_numa_nodes_change (void )Can you document the purpose of this function?
Quoted 13 lines
include/sysemu/numa.h +7
-0+{ +static int saved_nb_numa_nodes; +assert (nb_numa_nodes); +assert (saved_nb_numa_nodes ==0 || saved_nb_numa_nodes == nb_numa_nodes); + saved_nb_numa_nodes = nb_numa_nodes; +} +#endif hw/arm/virt.c +0
-0hw/arm/virt.c virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index) · line 1559
Quoted 7 lines
hw/arm/virt.c +4
-0@@ -1553,6 +1553,13 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t virt_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +assert (nb_numa_nodes); +assert_nb_numa_nodes_change ();I would move this assert to common code instead of copying it to all implementations.
Quoted 7 lines
A
machine_get_default_cpu_node_id()wrapper that callsassert_nb_numa_nodes_change()andmc->get_default_cpu_node_id()would be enough, and it wouldn't even need to be declared in a header as the only caller would be athw/core/machine.c.(Or, if you prefer to simply drop the
assert(), I think that would be OK too.)
Callbacks are 'public' API and potentially could be called from anywhere. Putting asserts inside of callbacks instead of the current single call site should help to catch errors/wrong usage in future if callback were called from elsewhere.
So I'd prefer to keep it where it's now or drop it altogether as it's not much of use at the current call site.
Quoted 6 lines
Quoted 6 lines
hw/arm/virt.c +3
-0+return idx % nb_numa_nodes; +} +static const CPUArchIdList *virt_possible_cpu_arch_ids (MachineState *ms) {int n;
[...]
Re: [Qemu-arm] [Qemu-devel] [PATCH v3 7/7] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
Quoted 73 lines · Igor Mammedov
Quoted 1 line · On Tue, 30 May 2017 17:03:32 -0300 Eduardo Habkost <[email protected]> wrote:
On Tue, May 30, 2017 at 06:24:02PM +0200, Igor Mammedov wrote:
[...]
Quoted 13 lines
Quoted 13 lines
include/hw/boards.h +2
-0@@ -94,6 +94,8 @@ typedef struct {* Returns an array of @CPUArchId architecture-dependent CPU IDs * which includes CPU IDs for present and possible to hotplug CPUs. * Caller is responsible for freeing returned list. +* @get_default_cpu_node_id: +* returns default board specific node_id value for CPU * @has_hotpluggable_cpus: * If true, board supports CPUs creation with -device/device_add. * @minimum_page_bits: Quoted 8 lines
include/hw/boards.h struct MachineClass { · line 156
Quoted 5 lines
include/hw/boards.h +1
-0@@ -151,6 +153,7 @@ struct MachineClass {CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,unsigned cpu_index);const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); +int64_t (*get_default_cpu_node_id)(const MachineState *ms,int idx);Aren't we trying to move away from cpu_index-based CPU identification? Shouldn't we make this get a CPUArchId argument?
it's not cpu-index but index in possible_cpus[],
it's possible to pass in CPUArchId argument and then in callbacks compute it's index in possible_cpus[] but that seems
a bit unnecessary and would complicate callback impl.Probably I should add doc comment explaining 'idx' meaning.
Quoted 40 lines
include/sysemu/numa.h void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes, · line 40
Quoted 13 lines
include/hw/boards.h +0
-0};/** include/sysemu/numa.h +2
-0@@ -36,4 +36,13 @@ void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,void numa_default_auto_assign_ram (MachineClass *mc,NodeInfo *nodes,int nb_nodes,ram_addr_t size);void numa_cpu_pre_plug (const CPUArchId *slot,DeviceState *dev,Error **errp); + +static inline void assert_nb_numa_nodes_change (void )Can you document the purpose of this function?
Quoted 13 lines
include/sysemu/numa.h +7
-0+{ +static int saved_nb_numa_nodes; +assert (nb_numa_nodes); +assert (saved_nb_numa_nodes ==0 || saved_nb_numa_nodes == nb_numa_nodes); + saved_nb_numa_nodes = nb_numa_nodes; +} +#endif hw/arm/virt.c +0
-0hw/arm/virt.c virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index) · line 1559
Quoted 7 lines
hw/arm/virt.c +4
-0@@ -1553,6 +1553,13 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t virt_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +assert (nb_numa_nodes); +assert_nb_numa_nodes_change ();I would move this assert to common code instead of copying it to all implementations.
Quoted 8 lines
Quoted 7 lines
A
machine_get_default_cpu_node_id()wrapper that callsassert_nb_numa_nodes_change()andmc->get_default_cpu_node_id()would be enough, and it wouldn't even need to be declared in a header as the only caller would be athw/core/machine.c.(Or, if you prefer to simply drop the
assert(), I think that would be OK too.)Callbacks are 'public' API and potentially could be called from anywhere.
I don't think that's true. Just like some struct fields aren't supposed to be touched by other code, a callback can be considered private and not supposed to be called from other code.
e.g.: it is invalid to call DeviceClass::realize directly outside device_set_realized(), or to call MachineClass::init outside machine_run_board_init().
Quoted 6 lines
Putting asserts inside of callbacks instead of the current single call site should help to catch errors/wrong usage in future if callback were called from elsewhere.
So I'd prefer to keep it where it's now or drop it altogether as it's not much of use at the current call site.
I think it's unnecessary complexity. But if you insist, I won't mind as long as you document the purpose of assert_nb_numa_nodes_change() clearly.
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
hw/arm/virt.c +3
-0+return idx % nb_numa_nodes; +} +static const CPUArchIdList *virt_possible_cpu_arch_ids (MachineState *ms) {int n;[...]
Signature · 1 line
Eduardo
PATCH v4 7/7 numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
Calculating default node-ids for CPUs in possible_cpu_arch_ids() is rather fragile since defaults calculation uses nb_numa_nodes but callback might be potentially called early before all -numa CLI options are parsed, which would lead to cpus assigned only upto nb_numa_nodes at the time possible_cpu_arch_ids() is called.
Issue was introduced by
(7c88e65 numa: mirror cpu to node mapping in MachineState::possible_cpus) and for example CLI:
-smp 4 -numa node,cpus=0 -numa node
would set props.node-id in possible_cpus array for every non explicitly mapped CPU to the first node.
Issue is not visible to guest nor to mgmt interface due to
1) implictly mapped cpus are forced to the first node in case of partial mapping
2) in case of default mapping possible_cpu_arch_ids() is called after all -numa options are parsed (resulting in correct mapping).
However it's fragile to rely on late execution of possible_cpu_arch_ids(), therefore add machine specific callback that returns node-id for CPU and use it to calculate/ set defaults at machine_numa_finish_init() time when all -numa options are parsed.
---
v4:
(Eduardo)
- drop most of asserts
- document agrguments of get_default_cpu_node_id() callback
--- include/hw/boards.h | 4 ++++ hw/arm/virt.c | 14 ++++++-------- hw/core/machine.c | 1 + hw/i386/pc.c | 20 +++++++++++--------- hw/ppc/spapr.c | 15 ++++++--------- 5 files changed, 28 insertions(+), 26 deletions(-)
include/hw/boards.h +4 -0
@@ -94,6 +94,9 @@ typedef struct {* Returns an array of @CPUArchId architecture-dependent CPU IDs * which includes CPU IDs for present and possible to hotplug CPUs. * Caller is responsible for freeing returned list. +* @get_default_cpu_node_id: +* returns default board specific node_id value for CPU slot specified by +* index @idx in @ms->possible_cpus[] * @has_hotpluggable_cpus: * If true, board supports CPUs creation with -device/device_add. * @minimum_page_bits:
@@ -151,6 +154,7 @@ struct MachineClass {CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,unsigned cpu_index);const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine); +int64_t (*get_default_cpu_node_id)(const MachineState *ms,int idx); };/**
hw/arm/virt.c +6 -8
@@ -1553,6 +1553,11 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t virt_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +return idx % nb_numa_nodes; +} +static const CPUArchIdList *virt_possible_cpu_arch_ids (MachineState *ms) {int n;
@@ -1571,14 +1576,6 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)virt_cpu_mp_affinity (vms, n); ms->possible_cpus->cpus[n].props.has_thread_id = true; ms->possible_cpus->cpus[n].props.thread_id = n; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - ms->possible_cpus->cpus[n].props.node_id = n % nb_numa_nodes; - } }return ms->possible_cpus; }
@@ -1601,6 +1598,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) mc->minimum_page_bits =12 ; mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids; mc->cpu_index_to_instance_props = virt_cpu_index_to_props; + mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; }static const TypeInfo virt_machine_info = {
hw/core/machine.c +1 -0
@@ -723,6 +723,7 @@ static void machine_numa_finish_init(MachineState *machine)/* fetch default mapping from board and enable it */ CpuInstanceProperties props = cpu_slot->props; + props.node_id = mc->get_default_cpu_node_id (machine, i);if (!default_mapping) {/* record slots with not set mapping, * TODO: make it hard error in future */
hw/i386/pc.c +11 -9
@@ -2253,6 +2253,16 @@ pc_cpu_index_to_props(MachineState *ms, unsigned cpu_index)return possible_cpus->cpus[cpu_index].props; } +static int64_t pc_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +X86CPUTopoInfo topo; + +assert (idx < ms->possible_cpus->len); +x86_topo_ids_from_apicid (ms->possible_cpus->cpus[idx].arch_id, + smp_cores, smp_threads, &topo); +return topo.pkg_id % nb_numa_nodes; +} +static const CPUArchIdList *pc_possible_cpu_arch_ids (MachineState *ms) {int i;
@@ -2282,15 +2292,6 @@ static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms) ms->possible_cpus->cpus[i].props.core_id = topo.core_id; ms->possible_cpus->cpus[i].props.has_thread_id = true; ms->possible_cpus->cpus[i].props.thread_id = topo.smt_id; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - ms->possible_cpus->cpus[i].props.node_id = - topo.pkg_id % nb_numa_nodes; - } }return ms->possible_cpus; }
@@ -2335,6 +2336,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->linuxboot_dma_enabled = true; mc->get_hotplug_handler = pc_get_hotpug_handler; mc->cpu_index_to_instance_props = pc_cpu_index_to_props; + mc->get_default_cpu_node_id = pc_get_default_cpu_node_id; mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids; mc->has_hotpluggable_cpus = true; mc->default_boot_order ="cad" ;
hw/ppc/spapr.c +6 -9
@@ -3002,6 +3002,11 @@ spapr_cpu_index_to_props(MachineState *machine, unsigned cpu_index)return core_slot->props; } +static int64_t spapr_get_default_cpu_node_id (const MachineState *ms,int idx) +{ +return idx / smp_cores % nb_numa_nodes; +} +static const CPUArchIdList *spapr_possible_cpu_arch_ids (MachineState *machine) {int i;
@@ -3026,15 +3031,6 @@ static const CPUArchIdList *spapr_possible_cpu_arch_ids(MachineState *machine) machine->possible_cpus->cpus[i].arch_id = core_id; machine->possible_cpus->cpus[i].props.has_core_id = true; machine->possible_cpus->cpus[i].props.core_id = core_id; - -/* default distribution of CPUs over NUMA nodes */ -if (nb_numa_nodes) { -/* preset values but do not enable them i.e. 'has_node_id = false', -* numa init code will enable them later if manual mapping wasn't -* present on CLI */ - machine->possible_cpus->cpus[i].props.node_id = - core_id / smp_threads / smp_cores % nb_numa_nodes; - } }return machine->possible_cpus; }
@@ -3160,6 +3156,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_instance_props = spapr_cpu_index_to_props; + mc->get_default_cpu_node_id = spapr_get_default_cpu_node_id; mc->possible_cpu_arch_ids = spapr_possible_cpu_arch_ids; hc->unplug_request = spapr_machine_device_unplug_request;
Signature · 1 line
2.7.4
Re: [Qemu-arm] [PATCH v4 7/7] numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed
Quoted 20 lines · Igor Mammedov
Calculating default node-ids for CPUs in
possible_cpu_arch_ids()is rather fragile since defaults calculation usesnb_numa_nodesbut callback might be potentially called early before all -numa CLI options are parsed, which would lead to cpus assigned only uptonb_numa_nodesat the timepossible_cpu_arch_ids()is called.Issue was introduced by
(7c88e65 numa: mirror cpu to node mapping inMachineState::possible_cpus) and for example CLI:
-smp 4 -numa node,cpus=0 -numa node
would set props.node-id inpossible_cpusarray for every non explicitly mapped CPU to the first node.Issue is not visible to guest nor to mgmt interface due to
1) implictly mapped cpus are forced to the first node in case of partial mapping
2) in case of default mappingpossible_cpu_arch_ids()is called after all -numa options are parsed (resulting in correct mapping).
Quoted 8 lines
However it's fragile to rely on late execution of
possible_cpu_arch_ids(), therefore add machine specific callback that returns node-id for CPU and use it to calculate/ set defaults atmachine_numa_finish_init()time when all -numa options are parsed.Reported-by Eduardo Habkost <[email protected]>Signed-off-by Igor Mammedov <[email protected]>
Queued on numa-next. Thanks!
Signature · 1 line
Eduardo
This series seems to have some coding style problems. See output below for more information:
Hi,
This series seems to have some coding style problems. See output below for more information:
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v3 0/7] numa: code consolidation and fixes
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
9136a97 numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed 4d75574 spapr: cleanup spapr_fixup_cpu_numa_dt() usage
b946845 numa: move numa_node from CPUState into target specific classes 609347e numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result 9d2b597 numa: make sure that all cpus have has_node_id set if numa is enabled c0d1aad numa: move default mapping init to machine
6c6afbf numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
=== OUTPUT BEGIN ===
Checking PATCH 1/7: numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr...
ERROR: suspect code indent for conditional statements (4, 9)
#144: FILE: numa.c:546:
+ if (!slot->props.has_node_id) {
+ mapped_node_id = 0;
total: 1 errors, 0 warnings, 123 lines checked
Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
Checking PATCH 2/7: numa: move default mapping init to machine...
Checking PATCH 3/7: numa: make sure that all cpus have has_node_id set if numa is enabled... Checking PATCH 4/7: numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result... Checking PATCH 5/7: numa: move numa_node from CPUState into target specific classes... Checking PATCH 6/7: spapr: cleanup spapr_fixup_cpu_numa_dt() usage...
Checking PATCH 7/7: numa: cpu: calculate/set default node-ids after all -numa CLI options are parsed... === OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 30 lines · Igor Mammedov
changelog since v2:
(Eduardo)
- keep original logic in when moving numa part into helper
numa: consolidatecpu_preplugfixups/checks for pc/arm/spapr
- drop "numa: fallback to default NUMA node instead of node 0"
- split out monitor hunk into separate patch
- split outspapr_fixup_cpu_numa_dtrefactoring into separate patch
- add extra patch to make default node-id calculation more robust
changelog since v1:
(Eduardo)
- usererror_abortinnuma_cpu_pre_plug()
- makedefault_mappingboolean
- redo default mapping detection loop as a combo of for/if
- return back lost TODO comment
- new patch removingnuma_nodefrom generic CPUState
- drop silence test patch as it's already in pull req on list
- new patch [3/5] to fix missing _PXM/fdt nodes for implicitly mapped CPUs
- new patch dropping fallback to node 0git repo for testing:
https://github.com/imammedo/qemu.gitcphp_numa_cfg_follow_up_v3_cleanups_v3CC Eduardo Habkost <[email protected]>CC David Gibson <[email protected]>CC Andrew Jones <[email protected]>
Quoted 10 lines
Igor Mammedov (7):
numa: consolidatecpu_preplugfixups/checks for pc/arm/spapr
numa: move default mapping init to machine
numa: make sure that all cpus havehas_node_idset if numa is enabled
numa: make hmp 'info numa' fetch numa nodes fromqmp_query_cpus()
result
numa: movenuma_nodefrom CPUState into target specific classes
spapr: cleanupspapr_fixup_cpu_numa_dt()usage
numa: cpu: calculate/set default node-ids after all -numa CLI options
are parsed
Patches 1-6 queued on numa-next. Thanks.
Signature · 1 line
Eduardo