Hi, It looks like this series breaks -device and CPU hotplug:
On Wed, Mar 11, 2020 at 05:53:34PM -0500, Babu Moger wrote: > These functions add support for building EPYC mode topology given the smp > details like numa nodes, cores, threads and sockets. > > The new apic id decoding is mostly similar to current apic id decoding > except that it adds a new field node_id when numa configured. Removes all > the hardcoded values. Subsequent patches will use these functions to build > the topology. > > Following functions are added. > apicid_llc_width_epyc > apicid_llc_offset_epyc > apicid_pkg_offset_epyc > apicid_from_topo_ids_epyc > x86_topo_ids_from_idx_epyc > x86_topo_ids_from_apicid_epyc > x86_apicid_from_cpu_idx_epyc > > The topology details are available in Processor Programming Reference (PPR) > for AMD Family 17h Model 01h, Revision B1 Processors. The revision guides are > available from the bugzilla Link below. > Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 > > Signed-off-by: Babu Moger <babu.mo...@amd.com> > Acked-by: Igor Mammedov <imamm...@redhat.com> > Acked-by: Michael S. Tsirkin <m...@redhat.com> > --- [...] > typedef struct X86CPUTopoIDs { > unsigned pkg_id; > + unsigned node_id; You have added a new field here. > unsigned die_id; > unsigned core_id; > unsigned smt_id; [...] > +static inline apic_id_t > +x86_apicid_from_topo_ids_epyc(X86CPUTopoInfo *topo_info, > + const X86CPUTopoIDs *topo_ids) > +{ > + return (topo_ids->pkg_id << apicid_pkg_offset_epyc(topo_info)) | > + (topo_ids->node_id << apicid_node_offset_epyc(topo_info)) | You are using the new field here. > + (topo_ids->die_id << apicid_die_offset(topo_info)) | > + (topo_ids->core_id << apicid_core_offset(topo_info)) | > + topo_ids->smt_id; > +} But you are not initializing node_id in one caller of apicid_from_topo_ids(): static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { [...] X86CPUTopoIDs topo_ids; [...] if (cpu->apic_id == UNASSIGNED_APIC_ID) { [...] topo_ids.pkg_id = cpu->socket_id; topo_ids.die_id = cpu->die_id; topo_ids.core_id = cpu->core_id; topo_ids.smt_id = cpu->thread_id; cpu->apic_id = x86ms->apicid_from_topo_ids(&topo_info, &topo_ids); } [...] } Result: -device is broken when using -cpu EPYC: $ qemu-system-x86_64 -machine q35,accel=kvm -smp 1,maxcpus=2,cores=1,threads=1,sockets=2 -cpu EPYC -device EPYC-x86_64-cpu,core-id=0,socket-id=1,thread-id=0 qemu-system-x86_64: -device EPYC-x86_64-cpu,core-id=0,socket-id=1,thread-id=0: Invalid CPU [socket: 21855, die: 0, core: 0, thread: 0] with APIC ID 21855, valid index range 0:1 This happens because APIC ID is calculated using uninitialized memory. -- Eduardo