qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: imammedo@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 5/4] pc: introduce new ACPI table sizing algorithm
Date: Mon, 19 Jan 2015 17:33:50 +0200	[thread overview]
Message-ID: <20150119153350.GE5240@redhat.com> (raw)
In-Reply-To: <1419437261-21113-6-git-send-email-pbonzini@redhat.com>

On Wed, Dec 24, 2014 at 05:07:39PM +0100, Paolo Bonzini wrote:
> Add padding after the DSDT.  Tables that vary depending on the
> command-line arguments will have to be byte-equivalent across QEMU
> versions >= 2.2, while fixed tables (including the DSDT) can be
> changed freely.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/i386/acpi-build.c | 19 +++++++++++--------
>  hw/i386/pc_piix.c    |  5 +++++
>  include/hw/i386/pc.h |  2 ++
>  3 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 63f3d80..1bb3222 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -67,8 +67,6 @@
>  #define ACPI_BUILD_LEGACY_CPU_AML_SIZE    97
>  #define ACPI_BUILD_ALIGN_SIZE             0x1000
>  
> -#define ACPI_BUILD_TABLE_SIZE             0x20000
> -
>  /* #define DEBUG_ACPI_BUILD */
>  #ifdef DEBUG_ACPI_BUILD
>  #define ACPI_BUILD_DPRINTF(fmt, ...)        \
> @@ -1614,6 +1612,10 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
>      acpi_add_table(table_offsets, tables->table_data);
>      build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt);
>  
> +    if (guest_info->fixed_table_align) {
> +        acpi_align_size(tables->table_data, guest_info->fixed_table_align);
> +    }
> +
>      ssdt = tables->table_data->len;
>      acpi_add_table(table_offsets, tables->table_data);
>      build_ssdt(tables->table_data, tables->linker, &cpu, &pm, guest_info);
> @@ -1696,15 +1698,16 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
>          }
>          g_array_set_size(tables->table_data, legacy_table_size);
>      } else {
> -        /* Make sure we have a buffer in case we need to resize the tables. */
> -        if (tables->table_data->len > ACPI_BUILD_TABLE_SIZE / 2) {
> -            /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots.  */
> +        /* Suggest upgrading to the newer algorithm if close to the limit.
> +         * As of QEMU 2.1, this fired with 160 VCPUs and 255 memory slots.
> +         */
> +        if (!guest_info->fixed_table_align &&
> +            tables->table_data->len > guest_info->acpi_table_align / 2) {
>              error_report("Warning: ACPI tables are larger than 64k.");
>              error_report("Warning: migration may not work.");
> -            error_report("Warning: please remove CPUs, NUMA nodes, "
> -                         "memory slots or PCI bridges.");
> +            error_report("Warning: please upgrade to a newer machine type.");
>          }
> -        acpi_align_size(tables->table_data, ACPI_BUILD_TABLE_SIZE);
> +        acpi_align_size(tables->table_data, guest_info->acpi_table_align);
>      }
>  
>      acpi_align_size(tables->linker, ACPI_BUILD_ALIGN_SIZE);
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 220f741..16de5c9 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -61,6 +61,8 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
>  
>  static bool has_acpi_build = true;
>  static int legacy_acpi_table_size;
> +static int fixed_table_align = 0;
> +static int acpi_table_align = 131072;

I prefer hex please: 0x20000

>  static bool smbios_defaults = true;
>  static bool smbios_legacy_mode;
>  static bool smbios_uuid_encoded = true;
> @@ -165,6 +167,8 @@ static void pc_init1(MachineState *machine,
>  
>      guest_info->has_acpi_build = has_acpi_build;
>      guest_info->legacy_acpi_table_size = legacy_acpi_table_size;
> +    guest_info->fixed_table_align = fixed_table_align;
> +    guest_info->acpi_table_align = acpi_table_align;
>  
>      guest_info->isapc_ram_fw = !pci_enabled;
>      guest_info->has_reserved_memory = has_reserved_memory;
> @@ -362,6 +366,7 @@ static void pc_compat_2_0(MachineState *machine)
>       * QEMU 1.7 it is 6414.  For RHEL/CentOS 7.0 it is 6418.
>       */
>      legacy_acpi_table_size = 6652;
> +    acpi_table_align = 4096;
>      smbios_legacy_mode = true;
>      has_reserved_memory = false;
>      pc_set_legacy_acpi_data_size();
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index e475b92..70fb47c 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -102,6 +102,8 @@ struct PcGuestInfo {
>      uint64_t *node_cpu;
>      FWCfgState *fw_cfg;
>      int legacy_acpi_table_size;
> +    int fixed_table_align;
> +    int acpi_table_align;
>      bool has_acpi_build;
>      bool has_reserved_memory;
>  };
> -- 
> 1.8.3.1
> 
> 

  reply	other threads:[~2015-01-19 15:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-24 16:07 [Qemu-devel] [PATCH v2 0/4] acpi: move common parts of the SSDT to the DSDT (and preview of things to come) Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 1/4] pc: append ssdt-misc.dsl to the DSDT Paolo Bonzini
2015-01-19 15:15   ` Igor Mammedov
2015-01-19 15:41     ` Paolo Bonzini
2015-01-19 17:14       ` Igor Mammedov
2015-01-19 17:26         ` Paolo Bonzini
2015-01-19 19:29           ` Michael S. Tsirkin
2015-01-19 19:33             ` Michael S. Tsirkin
2015-01-19 19:57               ` Paolo Bonzini
2015-01-19 21:27                 ` Michael S. Tsirkin
2015-01-20  9:59             ` Igor Mammedov
2015-01-20 10:34               ` Paolo Bonzini
2015-01-20 10:35               ` Michael S. Tsirkin
2015-01-20 12:41                 ` Igor Mammedov
2015-01-20 12:56                   ` Michael S. Tsirkin
2015-01-19 15:31   ` Michael S. Tsirkin
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 2/4] pc: rename ssdt-misc to dsdt-common Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 3/4] pc: move common parts of the DSDT " Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 4/4] pc: merge DSDT common parts into acpi-dsdt-common.dsl Paolo Bonzini
2015-01-19 15:26   ` Michael S. Tsirkin
2015-01-19 15:33     ` Paolo Bonzini
2015-01-19 15:38       ` Michael S. Tsirkin
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 5/4] pc: introduce new ACPI table sizing algorithm Paolo Bonzini
2015-01-19 15:33   ` Michael S. Tsirkin [this message]
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 6/4] pc: clean up pre-2.1 compatibility code Paolo Bonzini
2014-12-24 16:07 ` [Qemu-devel] [PATCH v2 7/4] pc: go back to smaller ACPI tables Paolo Bonzini
2015-01-19 15:36   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150119153350.GE5240@redhat.com \
    --to=mst@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).