From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5FOM-0000WN-Vx for qemu-devel@nongnu.org; Fri, 11 Nov 2016 12:13:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5FOJ-0001X3-0t for qemu-devel@nongnu.org; Fri, 11 Nov 2016 12:13:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56210) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c5FOI-0001Wb-S9 for qemu-devel@nongnu.org; Fri, 11 Nov 2016 12:13:26 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A403C04B321 for ; Fri, 11 Nov 2016 17:13:26 +0000 (UTC) Date: Fri, 11 Nov 2016 19:13:25 +0200 From: "Michael S. Tsirkin" Message-ID: <20161111191254-mutt-send-email-mst@kernel.org> References: <1478882742-14686-1-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478882742-14686-1-git-send-email-ehabkost@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] 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 Cc: qemu-devel@nongnu.org, Paolo Bonzini , Igor Mammedov On Fri, Nov 11, 2016 at 02:45:42PM -0200, 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. > > Change the legacy_aml_len calculation to use apic_id_limit, to calculate > the right size. > > Signed-off-by: Eduardo Habkost Does this affect migration in some way? > --- > This patch was submitted in 2014 and reviewed by Paolo. Only > today I noticed that it was never merged. > > Changes v1 -> v2: > * Use pcms->apic_id_limit, as guest_info doesn't exist anymore > --- > 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 c02f408..bb66446 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -2859,7 +2859,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) > */ > int legacy_aml_len = > pcmc->legacy_acpi_table_size + > - ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus; > + ACPI_BUILD_LEGACY_CPU_AML_SIZE * pcms->apic_id_limit; > int legacy_table_size = > ROUND_UP(tables_blob->len - aml_len + legacy_aml_len, > ACPI_BUILD_ALIGN_SIZE); > -- > 2.7.4