Re: [PATCH v13 1/5] i386: Add support for CPUID_8000_001E for AMD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 04, 2020 at 09:06:27AM -0500, Babu Moger wrote:
> 
> 
> > -----Original Message-----
> > From: Eduardo Habkost <ehabkost@xxxxxxxxxx>
> > Sent: Tuesday, June 2, 2020 12:52 PM
> > To: Moger, Babu <Babu.Moger@xxxxxxx>
> > Cc: mst@xxxxxxxxxx; marcel.apfelbaum@xxxxxxxxx; pbonzini@xxxxxxxxxx;
> > rth@xxxxxxxxxxx; mtosatti@xxxxxxxxxx; qemu-devel@xxxxxxxxxx;
> > kvm@xxxxxxxxxxxxxxx; kash@xxxxxxxxxxxxxx; geoff@xxxxxxxxxxxxxxx; Dr. David
> > Alan Gilbert <dgilbert@xxxxxxxxxx>
> > Subject: Re: [PATCH v13 1/5] i386: Add support for CPUID_8000_001E for AMD
> > 
> > On Fri, Jun 08, 2018 at 06:56:17PM -0400, Babu Moger wrote:
> > > Add support for cpuid leaf CPUID_8000_001E. Build the config that closely
> > > match the underlying hardware. Please refer to the Processor Programming
> > > Reference (PPR) for AMD Family 17h Model for more details.
> > >
> > > Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
> > [...]
> > > +    case 0x8000001E:
> > > +        assert(cpu->core_id <= 255);
> > 
> > It is possible to trigger this assert using:
> > 
> > $ qemu-system-x86_64 -machine q35,accel=kvm,kernel-irqchip=split -device
> > intel-iommu,intremap=on,eim=on -smp
> > 1,maxcpus=258,cores=258,threads=1,sockets=1 -cpu
> > qemu64,xlevel=0x8000001e -device qemu64-x86_64-cpu,apic-id=257
> > qemu-system-x86_64: warning: Number of hotpluggable cpus requested (258)
> > exceeds the recommended cpus supported by KVM (240)
> > qemu-system-x86_64:
> > /home/ehabkost/rh/proj/virt/qemu/target/i386/cpu.c:5888: cpu_x86_cpuid:
> > Assertion `cpu->core_id <= 255' failed.
> > Aborted (core dumped)
> > 
> > See bug report and discussion at
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.
> > redhat.com%2Fshow_bug.cgi%3Fid%3D1834200&amp;data=02%7C01%7Cbabu.
> > moger%40amd.com%7C8a2724729b914bc9b53d08d8071db392%7C3dd8961fe4
> > 884e608e11a82d994e183d%7C0%7C0%7C637267171438806408&amp;sdata=ib
> > iGlF%2FF%2FVtYQLf7fe988kxFsLhj4GrRiTOq4LUuOT8%3D&amp;reserved=0
> > 
> > Also, it looks like encode_topo_cpuid8000001e() assumes core_id
> > has only 3 bits, so the existing assert() is not even sufficient.
> > We need to decide what to do if the user requests nr_cores > 8.
> > 
> > Probably omitting CPUID[0x8000001E] if the VCPU topology is
> > incompatible with encode_topo_cpuid8000001e() (and printing a
> > warning) is the safest thing to do right now.
> 
> Eduardo,  We need to generalize the encode_topo_cpuid8000001e decoding.
> We will have to remove 3 bit limitation there. It will not scale with
> latest configurations. I will take a look that.
> 
> For now, best option I think is to(like you mentioned in bug 1834200),
> declaring nr_cores > 256 as never supported (or deprecated); and throw
> warning.
> 
> What do you think?

I believe we can declare nr_cores > 256 as never supported to
address the assert failure.  Other CPUID functions also look
broken when nr_cores is too large: encode_cache_cpuid4() seems to
assume nr_cores is 128 or less.

But we still need to make nr_cores > 8 safe while
encode_topo_cpuid8000001e() is not generalized yet.

> > 
> > 
> > 
> > > +        encode_topo_cpuid8000001e(cs, cpu,
> > > +                                  eax, ebx, ecx, edx);
> > > +        break;
> > >      case 0xC0000000:
> > >          *eax = env->cpuid_xlevel2;
> > >          *ebx = 0;
> > > --
> > > 1.8.3.1
> > >
> > 
> > --
> > Eduardo
> 

-- 
Eduardo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux