From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTRK-0003Mb-8J for qemu-devel@nongnu.org; Fri, 12 Dec 2014 11:51:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzTRE-0005lI-49 for qemu-devel@nongnu.org; Fri, 12 Dec 2014 11:51:38 -0500 Message-ID: <548B1CDD.4030206@redhat.com> Date: Fri, 12 Dec 2014 17:50:37 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1418402316-31738-1-git-send-email-ehabkost@redhat.com> In-Reply-To: <1418402316-31738-1-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] acpi: Use apic_id_limit when calculating legacy ACPI table size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org, qemu-stable@nongnu.org Cc: Laszlo Ersek , "Michael S. Tsirkin" On 12/12/2014 17:38, Eduardo Habkost wrote: > The code that calculates the legacy ACPI table size for migration > compatibility uses max_cpus when calculating legacy_aml_len (the size of > the DSDT and SSDT tables). However, the SSDT grows according to APIC ID > limit, not max_cpus. > > The bug is not triggered very often because of the 4k alignment on the > table size. But it can be triggered if you are unlucky enough to cross a > 4k boundary. For example, using the following: > > $ qemu-system-x86_64 -machine pc-i440fx-2.0 -smp 99,sockets=3,cores=33,threads=1 > qemu-system-x86_64: Warning: migration may not work. > > Change the legacy_aml_len calculation to use apic_id_limit, to calculate > the right size. > > Signed-off-by: Eduardo Habkost > --- > hw/i386/acpi-build.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index a4d0c0c..359fb43 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -1675,7 +1675,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) > */ > int legacy_aml_len = > guest_info->legacy_acpi_table_size + > - ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus; > + ACPI_BUILD_LEGACY_CPU_AML_SIZE * guest_info->apic_id_limit; > int legacy_table_size = > ROUND_UP(tables->table_data->len - aml_len + legacy_aml_len, > ACPI_BUILD_ALIGN_SIZE); > Reviewed-by: Paolo Bonzini