From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrucB-0005o5-N7 for qemu-devel@nongnu.org; Sat, 14 Dec 2013 14:11:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vruc4-0007dq-9S for qemu-devel@nongnu.org; Sat, 14 Dec 2013 14:11:03 -0500 Received: from mail-pb0-f51.google.com ([209.85.160.51]:41348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vruc4-0007dN-3C for qemu-devel@nongnu.org; Sat, 14 Dec 2013 14:10:56 -0500 Received: by mail-pb0-f51.google.com with SMTP id up15so3899523pbc.10 for ; Sat, 14 Dec 2013 11:10:55 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <52AC939E.9060706@gmail.com> References: <52A9FC0C.3040509@gmail.com> <52AC939E.9060706@gmail.com> From: Peter Maydell Date: Sat, 14 Dec 2013 19:10:35 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2, cores=3, threads=2" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: lijun Cc: QEMU Developers , Anthony Liguori On 14 December 2013 17:21, lijun wrote: > Hi all, > As qemu core dump cause by "sockets=2,cores=3,threads=2", so add this > patch to check whether cores and threads is a power of 2. > The following is the realization of apicid_from_topo_ids function in > file target-i386/topology.h. It uses shift to get the values of pkg_id and > core_id. nr_cores and nr_threads is related to this shift. > static inline apic_id_t apicid_from_topo_ids(unsigned nr_cores, > unsigned nr_threads, > unsigned pkg_id, > unsigned core_id, > unsigned smt_id) > { > return (pkg_id << apicid_pkg_offset(nr_cores, nr_threads)) | > (core_id << apicid_core_offset(nr_cores, nr_threads)) | > smt_id; > } > ---- > So should add a check for smp_cores and smp_threads in smp_parse function in > file vl.c. Check whether smp_cores and smp_threads is a power of 2, so > nr_cores and nr_threads is a power of 2. When return from > apicid_from_topo_ids function, apic_id and id could get the correct > values(apic_id is in file "hw/i386/acpi-build.c" and id is in file > "hw/acpi/piix4.c") . vl.c is cross platform code so I'm not sure it's the right place to make this check. x86 ACPI may not be able to handle a non-power-of-2 number of cores in a socket, but it's a v alid ARM SMP configuration, for instance. thanks -- PMM