diff mbox

[v2,7/4] pc: go back to smaller ACPI tables

Message ID 1419437261-21113-8-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Dec. 24, 2014, 4:07 p.m. UTC
The new algorithm introduced by the previous patch lets us make tables
smaller and avoid migration bugs due to large tables.

Use it for 2.3+ machine types by tweaking the default fixed_table_align
and acpi_table_align values.  At the same time, preserve backwards-compatible
logic for pc-i440fx-2.2.

Without this patch:
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fdffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000007fe0000-0x0000000007ffffff] reserved
...
[    0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff] usable
[    0.000000] RAMDISK: [mem 0x07112000-0x07fdffff]

With this patch:
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007ffafff] usable
[    0.000000] BIOS-e820: [mem 0x0000000007ffb000-0x0000000007ffffff] reserved
...
[    0.000000] init_memory_mapping: [mem 0x07000000-0x07ffafff]
[    0.000000] RAMDISK: [mem 0x07122000-0x07feffff]

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/pc_piix.c | 6 ++++--
 hw/i386/pc_q35.c  | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Michael S. Tsirkin Jan. 19, 2015, 3:36 p.m. UTC | #1
On Wed, Dec 24, 2014 at 05:07:41PM +0100, Paolo Bonzini wrote:
> The new algorithm introduced by the previous patch lets us make tables
> smaller and avoid migration bugs due to large tables.
> 
> Use it for 2.3+ machine types by tweaking the default fixed_table_align
> and acpi_table_align values.  At the same time, preserve backwards-compatible
> logic for pc-i440fx-2.2.
> 
> Without this patch:
> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fdffff] usable
> [    0.000000] BIOS-e820: [mem 0x0000000007fe0000-0x0000000007ffffff] reserved
> ...
> [    0.000000] init_memory_mapping: [mem 0x07000000-0x07fdffff] usable
> [    0.000000] RAMDISK: [mem 0x07112000-0x07fdffff]
> 
> With this patch:
> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007ffafff] usable
> [    0.000000] BIOS-e820: [mem 0x0000000007ffb000-0x0000000007ffffff] reserved
> ...
> [    0.000000] init_memory_mapping: [mem 0x07000000-0x07ffafff]
> [    0.000000] RAMDISK: [mem 0x07122000-0x07feffff]
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/i386/pc_piix.c | 6 ++++--
>  hw/i386/pc_q35.c  | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 16de5c9..a5e36b9 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -61,8 +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;
> +static int fixed_table_align = 16384;
> +static int acpi_table_align = 4096;

same here - hex please.

>  static bool smbios_defaults = true;
>  static bool smbios_legacy_mode;
>  static bool smbios_uuid_encoded = true;
> @@ -332,6 +332,8 @@ static void pc_compat_2_2(MachineState *machine)
>      x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
>      x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
>      x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
> +    fixed_table_align = 0;
> +    acpi_table_align = 131072;
>  }
>  
>  static void pc_compat_2_1(MachineState *machine)
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 7ba0535..4fd9527 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -155,10 +155,12 @@ static void pc_q35_init(MachineState *machine)
>      guest_info->has_acpi_build = has_acpi_build;
>      guest_info->has_reserved_memory = has_reserved_memory;
>  
> -    /* Migration was not supported in 2.0 for Q35, so do not bother
> -     * with this hack (see hw/i386/acpi-build.c).
> +    /* Migration was not supported in 2.0 for Q35, so do not bother with
> +     * hacks around the ACPI table size (see hw/i386/acpi-build.c).
>       */
>      guest_info->legacy_acpi_table_size = 0;
> +    guest_info->fixed_table_align = 16384;
> +    guest_info->acpi_table_align = 4096;
>  
>      if (smbios_defaults) {
>          MachineClass *mc = MACHINE_GET_CLASS(machine);
diff mbox

Patch

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 16de5c9..a5e36b9 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -61,8 +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;
+static int fixed_table_align = 16384;
+static int acpi_table_align = 4096;
 static bool smbios_defaults = true;
 static bool smbios_legacy_mode;
 static bool smbios_uuid_encoded = true;
@@ -332,6 +332,8 @@  static void pc_compat_2_2(MachineState *machine)
     x86_cpu_compat_set_features("Haswell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
     x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_F16C);
     x86_cpu_compat_set_features("Broadwell", FEAT_1_ECX, 0, CPUID_EXT_RDRAND);
+    fixed_table_align = 0;
+    acpi_table_align = 131072;
 }
 
 static void pc_compat_2_1(MachineState *machine)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 7ba0535..4fd9527 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -155,10 +155,12 @@  static void pc_q35_init(MachineState *machine)
     guest_info->has_acpi_build = has_acpi_build;
     guest_info->has_reserved_memory = has_reserved_memory;
 
-    /* Migration was not supported in 2.0 for Q35, so do not bother
-     * with this hack (see hw/i386/acpi-build.c).
+    /* Migration was not supported in 2.0 for Q35, so do not bother with
+     * hacks around the ACPI table size (see hw/i386/acpi-build.c).
      */
     guest_info->legacy_acpi_table_size = 0;
+    guest_info->fixed_table_align = 16384;
+    guest_info->acpi_table_align = 4096;
 
     if (smbios_defaults) {
         MachineClass *mc = MACHINE_GET_CLASS(machine);