ACPICA: Tables: Add mechanism to control early table checksum verification.
Subsystems (3)
PATCH 1/2 ACPICA: Tables: Add mechanism to control early table checksum verification.
The following regression is reported when the table length is very large:
WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:136 __early_ioremap+0x11f/0x1f2() Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00017-g86dfc6f3-dirty #298 Hardware name: Intel Corporation S2600CP/S2600CP, BIOS SE5C600.86B.99.99.x036.091920111209 09/19/2011 0000000000000009 ffffffff81b75c40 ffffffff817c627b 0000000000000000 ffffffff81b75c78 ffffffff81067b5d 000000000000007b 8000000000000563 00000000b96b20dc 0000000000000001 ffffffffff300e0c ffffffff81b75c88 Call Trace: [<ffffffff817c627b>] dump_stack+0x45/0x56 [<ffffffff81067b5d>] warn_slowpath_common+0x7d/0xa0 [<ffffffff81067c3a>] warn_slowpath_null+0x1a/0x20 [<ffffffff81d4b9d5>] __early_ioremap+0x11f/0x1f2 [<ffffffff81d4bc5b>] early_ioremap+0x13/0x15 [<ffffffff81d2b8f3>] __acpi_map_table+0x13/0x18 [<ffffffff817b8d1a>] acpi_os_map_memory+0x26/0x14e [<ffffffff813ff018>] acpi_tb_acquire_table+0x42/0x70 [<ffffffff813ff086>] acpi_tb_validate_table+0x27/0x37 [<ffffffff813ff0e5>] acpi_tb_verify_table+0x22/0xd8 [<ffffffff813ff6a8>] acpi_tb_install_non_fixed_table+0x60/0x1c9 [<ffffffff81d61024>] acpi_tb_parse_root_table+0x218/0x26a [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d610cd>] acpi_initialize_tables+0x57/0x59 [<ffffffff81d5f25d>] acpi_table_init+0x1b/0x99 [<ffffffff81d2bca0>] acpi_boot_table_init+0x1e/0x85 [<ffffffff81d23043>] setup_arch+0x99d/0xcc6 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1bbbe>] start_kernel+0x8b/0x415 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1b5ee>] x86_64_start_reservations+0x2a/0x2c [<ffffffff81d1b72e>] x86_64_start_kernel+0x13e/0x14d ---[ end trace 11ae599a1898f4e7 ]---
This is due to the size limitation of the x86 early IO mapping.
There is a large SSDT table on such platform that exceeds this limitation:
ACPI: SSDT 0x00000000B9638018 07A0C4 (v02 INTEL S2600CP 00004000 INTL 20100331)
It sounds strange that in the 64-bit virtual memory address space, we cannot map a single ACPI table to do checksum verification. The root cause is:
1. ACPICA doesn't split IO memory mapping and table mapping;
2. Linux x86 OSL implements acpi_os_map_memory() using a size limited fix-map mechanism during early boot stage, which is more suitable for only IO mappings.
ACPICA originally only mapped table header for signature validation, and this header mapping is required by OSL override mechanism. There was no checksum verification because we could not map the whole table using this OSL. While the following ACPICA commit enforces checksum verification by mapping the whole table during Linux boot stage and it finally triggers this issue on some platforms:
Commit: 86dfc6f339886559d80ee0d4bd20fe5ee90450f0
Subject: ACPICA: Tables: Fix table checksums verification before installation.
Before doing further cleanups for the OSL table mapping and override implementation, this patch introduces an option for such OSPMs to temporarily discard the checksum verification feature. It then can be re-enabled easily when the ACPICA and the underlying OSL is ready.
This patch also deletes a comment around the limitation of mappings because it is not correct. The limitation is not how many times we can map in the early stage, but the OSL mapping facility may not be suitable for mapping the ACPI tables and thus may complain us the size limitation.
The acpi_tb_verify_table() is renamed to acpi_tb_verify_temp_table() due to the work around added, it now only applies to the table descriptor that hasn't been installed and cannot be used in other cases. Lv Zheng.
--- drivers/acpi/acpica/actables.h | 8 +++-- drivers/acpi/acpica/tbdata.c | 67 +++++++++++++++++++++++++++++++--------- drivers/acpi/acpica/tbinstal.c | 8 ++--- drivers/acpi/acpica/tbutils.c | 4 --- include/acpi/acpixf.h | 8 +++++ 5 files changed, 69 insertions(+), 26 deletions(-)
drivers/acpi/acpica/actables.h +5 -3
@@ -69,6 +69,11 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,void acpi_tb_release_temp_table (struct acpi_table_desc *table_desc); +acpi_status acpi_tb_validate_temp_table (struct acpi_table_desc *table_desc); + +acpi_status +acpi_tb_verify_temp_table (struct acpi_table_desc *table_desc,char *signature); +u8 acpi_tb_is_table_loaded (u32 table_index);void acpi_tb_set_table_loaded_flag (u32 table_index,u8 is_loaded);
@@ -96,9 +101,6 @@ acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc);void acpi_tb_invalidate_table (struct acpi_table_desc *table_desc); -acpi_status -acpi_tb_verify_table (struct acpi_table_desc *table_desc,char *signature); -void acpi_tb_override_table (struct acpi_table_desc *old_table_desc); acpi_status
drivers/acpi/acpica/tbdata.c +52 -15
91 lines not on this page · raw message
drivers/acpi/acpica/tbinstal.c +4 -4
@@ -194,7 +194,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address,/* Validate and verify a table before installation */ - status =acpi_tb_verify_table (&new_table_desc, signature); + status =acpi_tb_verify_temp_table (&new_table_desc, signature);if (ACPI_FAILURE (status)) { goto release_and_exit; }
@@ -266,7 +266,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,/* Validate and verify a table before installation */ - status =acpi_tb_verify_table (&new_table_desc,NULL ); + status =acpi_tb_verify_temp_table (&new_table_desc,NULL );if (ACPI_FAILURE (status)) { goto release_and_exit; }
@@ -424,7 +424,7 @@ finish_override:/* Validate and verify a table before overriding */ - status =acpi_tb_verify_table (&new_table_desc,NULL ); + status =acpi_tb_verify_temp_table (&new_table_desc,NULL );if (ACPI_FAILURE (status)) {return ; }
@@ -446,7 +446,7 @@ finish_override:acpi_tb_init_table_descriptor (old_table_desc, new_table_desc.address, new_table_desc.flags, new_table_desc.pointer); -acpi_tb_validate_table (old_table_desc); +acpi_tb_validate_temp_table (old_table_desc);/* Release the temporary table descriptor */
drivers/acpi/acpica/tbutils.c +0 -4
@@ -395,10 +395,6 @@ next_table: table_entry += table_entry_size; } -/* -* It is not possible to map more than one entry in some environments, -* so unmap the root table here before mapping other tables -*/ acpi_os_unmap_memory (table, length);return_ACPI_STATUS (AE_OK );
include/acpi/acpixf.h +8 -0
@@ -162,6 +162,14 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);ACPI_INIT_GLOBAL (u8, acpi_gbl_use_default_register_widths, TRUE);/* +* Optionally verify the table checksum before installation. Set this to +* TRUE to verify the table checksum before install it to the table +* manager. Note that some OSPMs cannot do large mappings during the +* certain stages. Default is behavior is to do such verification. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_verify_table_checksum, TRUE); + +/* * Optionally enable output from the AML Debug Object. */ ACPI_INIT_GLOBAL (u8, acpi_gbl_enable_aml_debug_object, FALSE);
Signature · 1 line
1.7.10
PATCH 2/2 ACPI: Fix regressions that x86 Linux kernel suffers from early mapping size limitation.
The following regression is reported when the table length is very large:
WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:136 __early_ioremap+0x11f/0x1f2() Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00017-g86dfc6f3-dirty #298 Hardware name: Intel Corporation S2600CP/S2600CP, BIOS SE5C600.86B.99.99.x036.091920111209 09/19/2011 0000000000000009 ffffffff81b75c40 ffffffff817c627b 0000000000000000 ffffffff81b75c78 ffffffff81067b5d 000000000000007b 8000000000000563 00000000b96b20dc 0000000000000001 ffffffffff300e0c ffffffff81b75c88 Call Trace: [<ffffffff817c627b>] dump_stack+0x45/0x56 [<ffffffff81067b5d>] warn_slowpath_common+0x7d/0xa0 [<ffffffff81067c3a>] warn_slowpath_null+0x1a/0x20 [<ffffffff81d4b9d5>] __early_ioremap+0x11f/0x1f2 [<ffffffff81d4bc5b>] early_ioremap+0x13/0x15 [<ffffffff81d2b8f3>] __acpi_map_table+0x13/0x18 [<ffffffff817b8d1a>] acpi_os_map_memory+0x26/0x14e [<ffffffff813ff018>] acpi_tb_acquire_table+0x42/0x70 [<ffffffff813ff086>] acpi_tb_validate_table+0x27/0x37 [<ffffffff813ff0e5>] acpi_tb_verify_table+0x22/0xd8 [<ffffffff813ff6a8>] acpi_tb_install_non_fixed_table+0x60/0x1c9 [<ffffffff81d61024>] acpi_tb_parse_root_table+0x218/0x26a [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d610cd>] acpi_initialize_tables+0x57/0x59 [<ffffffff81d5f25d>] acpi_table_init+0x1b/0x99 [<ffffffff81d2bca0>] acpi_boot_table_init+0x1e/0x85 [<ffffffff81d23043>] setup_arch+0x99d/0xcc6 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1bbbe>] start_kernel+0x8b/0x415 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1b5ee>] x86_64_start_reservations+0x2a/0x2c [<ffffffff81d1b72e>] x86_64_start_kernel+0x13e/0x14d ---[ end trace 11ae599a1898f4e7 ]---
This is due to the size limitation of the x86 early IO mapping.
This patch fixes this issue by utilizing acpi_gbl_verify_table_checksum to disable table mapping during early stage and enabling it again for the late stage. In this way, the normal code path is not affected.
A new boot parameter - acpi_force_verify_table is introduced for platforms that require checksum verification to stop loading bad tables.
--- Documentation/kernel-parameters.txt | 5 +++++ drivers/acpi/bus.c | 3 +++ drivers/acpi/tables.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+)
Documentation/kernel-parameters.txt +5 -0
@@ -214,6 +214,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. unusable. The "log_buf_len" parameter may be useful if you need to capture more output. + acpi_force_verify_table [HW,ACPI] + Enable table checksum verification during early stage. + By default, this is disabled due to x86 early mapping + size limitation. + acpi_irq_balance [HW,ACPI] ACPI will balance active IRQs default in APIC mode
drivers/acpi/bus.c +3 -0
@@ -489,6 +489,9 @@ void __init acpi_early_init(void) printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); +/* It's safe to verify table checksums during late stage */ + acpi_gbl_verify_table_checksum = TRUE; +/* enable workarounds, unless strict ACPI spec. compliance */ if (!acpi_strict) acpi_gbl_enable_interpreter_slack = TRUE;
drivers/acpi/tables.c +23 -0
@@ -44,6 +44,12 @@ static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;static int acpi_apic_instance__initdata ; +/* +* Disable table checksum verification for the early stage due to the size +* limitation of the current x86 early mapping implementation. +*/ +static bool acpi_verify_table_checksum__initdata = false; +void acpi_table_print_madt_entry (struct acpi_subtable_header *header) {if (!header)
@@ -333,6 +339,14 @@ int __init acpi_table_init(void) {acpi_status status; +if (!acpi_verify_table_checksum) { +pr_info ("Early table checksum verification disabled\n" ); + acpi_gbl_verify_table_checksum = FALSE; + }else { +pr_info ("Early table checksum verification enabled\n" ); + acpi_gbl_verify_table_checksum = TRUE; + } + status =acpi_initialize_tables (initial_tables,ACPI_MAX_TABLES ,0 );if (ACPI_FAILURE (status))return -EINVAL ;
@@ -354,3 +368,12 @@ static int __init acpi_parse_apic_instance(char *str) }early_param ("acpi_apic_instance" , acpi_parse_apic_instance); + +static int __init acpi_force_verify_table_setup (char *s) +{ + acpi_verify_table_checksum = true; + +return 0 ; +} + +early_param ("acpi_force_verify_table" , acpi_force_verify_table_setup);
Signature · 1 line
1.7.10
Re: [PATCH 2/2] ACPI: Fix regressions that x86 Linux kernel suffers from early mapping size limitation.
Quoted 56 lines · Lv Zheng
The following regression is reported when the table length is very large:
WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:136 __early_ioremap+0x11f/0x1f2() Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00017-g86dfc6f3-dirty #298 Hardware name: Intel Corporation S2600CP/S2600CP, BIOS SE5C600.86B.99.99.x036.091920111209 09/19/2011 0000000000000009 ffffffff81b75c40 ffffffff817c627b 0000000000000000 ffffffff81b75c78 ffffffff81067b5d 000000000000007b 8000000000000563 00000000b96b20dc 0000000000000001 ffffffffff300e0c ffffffff81b75c88 Call Trace: [<ffffffff817c627b>] dump_stack+0x45/0x56 [<ffffffff81067b5d>] warn_slowpath_common+0x7d/0xa0 [<ffffffff81067c3a>] warn_slowpath_null+0x1a/0x20 [<ffffffff81d4b9d5>] __early_ioremap+0x11f/0x1f2 [<ffffffff81d4bc5b>] early_ioremap+0x13/0x15 [<ffffffff81d2b8f3>] __acpi_map_table+0x13/0x18 [<ffffffff817b8d1a>] acpi_os_map_memory+0x26/0x14e [<ffffffff813ff018>] acpi_tb_acquire_table+0x42/0x70 [<ffffffff813ff086>] acpi_tb_validate_table+0x27/0x37 [<ffffffff813ff0e5>] acpi_tb_verify_table+0x22/0xd8 [<ffffffff813ff6a8>] acpi_tb_install_non_fixed_table+0x60/0x1c9 [<ffffffff81d61024>] acpi_tb_parse_root_table+0x218/0x26a [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d610cd>] acpi_initialize_tables+0x57/0x59 [<ffffffff81d5f25d>] acpi_table_init+0x1b/0x99 [<ffffffff81d2bca0>] acpi_boot_table_init+0x1e/0x85 [<ffffffff81d23043>] setup_arch+0x99d/0xcc6 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1bbbe>] start_kernel+0x8b/0x415 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1b5ee>] x86_64_start_reservations+0x2a/0x2c [<ffffffff81d1b72e>] x86_64_start_kernel+0x13e/0x14d ---[ end trace 11ae599a1898f4e7 ]---This is due to the size limitation of the x86 early IO mapping.
This patch fixes this issue by utilizing
acpi_gbl_verify_table_checksumto disable table mapping during early stage and enabling it again for the late stage. In this way, the normal code path is not affected.A new boot parameter -
acpi_force_verify_tableis introduced for platforms that require checksum verification to stop loading bad tables.Signed-off-by Lv Zheng <[email protected]>Reported-and-tested-by Yuanhan Liu <[email protected]>Cc <[email protected]>Cc <[email protected]>--- Documentation/kernel-parameters.txt | 5 +++++ drivers/acpi/bus.c | 3 +++ drivers/acpi/tables.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+)Documentation/kernel-parameters.txt +0
-0
Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 217
Quoted 4 lines
Documentation/kernel-parameters.txt +1
-0@@ -214,6 +214,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. unusable. The "log_buf_len" parameter may be useful if you need to capture more output. + acpi_force_verify_table [HW,ACPI]
What about acpi_force_table_verification?
Quoted 39 lines
Documentation/kernel-parameters.txt +4
-0+ Enable table checksum verification during early stage. + By default, this is disabled due to x86 early mapping + size limitation. + acpi_irq_balance [HW,ACPI] ACPI will balance active IRQs default in APIC modedrivers/acpi/bus.c +3
-0@@ -489,6 +489,9 @@ void __init acpi_early_init(void) printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); +/* It's safe to verify table checksums during late stage */ + acpi_gbl_verify_table_checksum = TRUE; +/* enable workarounds, unless strict ACPI spec. compliance */ if (!acpi_strict) acpi_gbl_enable_interpreter_slack = TRUE;drivers/acpi/tables.c +6
-0@@ -44,6 +44,12 @@ static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;static int acpi_apic_instance__initdata ; +/* +* Disable table checksum verification for the early stage due to the size +* limitation of the current x86 early mapping implementation. +*/ +static bool acpi_verify_table_checksum__initdata = false; +void acpi_table_print_madt_entry (struct acpi_subtable_header *header) {if (!header)
drivers/acpi/tables.c int __init acpi_table_init(void) · line 348
Quoted 10 lines
drivers/acpi/tables.c +7
-0@@ -333,6 +339,14 @@ int __init acpi_table_init(void) {acpi_status status; +if (!acpi_verify_table_checksum) { +pr_info ("Early table checksum verification disabled\n" ); + acpi_gbl_verify_table_checksum = FALSE; + }else { +pr_info ("Early table checksum verification enabled\n" ); + acpi_gbl_verify_table_checksum = TRUE; + }
It's better to write this condition as
if (acpi_verify_table_checksum) {
pr_info("Early table checksum verification enabled\n");
acpi_gbl_verify_table_checksum = TRUE;
} else {
pr_info("Early table checksum verification disabled\n");
acpi_gbl_verify_table_checksum = FALSE;
}Quoted 8 lines
drivers/acpi/tables.c +1
-0+ status =acpi_initialize_tables (initial_tables,ACPI_MAX_TABLES ,0 );if (ACPI_FAILURE (status))return -EINVAL ;@@ -354,3 +368,12 @@ static int __init acpi_parse_apic_instance(char *str) }
drivers/acpi/tables.c static int __init acpi_parse_apic_instance(char *str) · line 379
Quoted 10 lines
drivers/acpi/tables.c +9
-0early_param ("acpi_apic_instance" , acpi_parse_apic_instance); + +static int __init acpi_force_verify_table_setup (char *s) +{ + acpi_verify_table_checksum = true; + +return 0 ; +} + +early_param ("acpi_force_verify_table" , acpi_force_verify_table_setup);
Thanks!
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
On Friday, May 30, 2014 10:07:31 AM Lv Zheng wrote:
[cut]
include/acpi/acpixf.h ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); · line 165
Quoted 9 lines
include/acpi/acpixf.h +1
-0@@ -162,6 +162,14 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);ACPI_INIT_GLOBAL (u8, acpi_gbl_use_default_register_widths, TRUE);/* +* Optionally verify the table checksum before installation. Set this to
What about "Whether or not to verify ..." instead of "Optionally verify ..."?
include/acpi/acpixf.h ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);
Quoted 3 lines
include/acpi/acpixf.h +3
-0+* TRUE to verify the table checksum before install it to the table +* manager. Note that some OSPMs cannot do large mappings during the +* certain stages.
The "Note that ..." thing is completely unuseful here, because it is not particularly clear why being unable to use large mappings is related to this option (I know it is, but a casual reader may not know that).
What about "Note that enabling this option causes errors to happen in some OSPMs during early initialization stages" instead?
Quoted 2 lines
Default is behavior is to do such verification.
+ */
Please fix the double "is".
Thanks!
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
v2 cover ACPI: Fix a regression of the table checksum verification.
In reply to Lv ZhengFrom: Lv Zheng <[email protected]>
There is a warning message triggered by the early table chekcusm verification during boot. Large tables cannot be installed on x86 platforms due to this failure. The root cause is the size limitation of the current x86 early mapping implementation, it's thus not suitable to be used to map ACPI tables.
This patchset fixes this regression by stopping verifying table checksums during the early boot stage.
Lv Zheng (2):
ACPICA: Tables: Add mechanism to control early table checksum
verification.
ACPI: Fix regressions that x86 Linux kernel suffers from early
mapping size limitation.
Documentation/kernel-parameters.txt | 5 +++ drivers/acpi/acpica/actables.h | 8 +++-- drivers/acpi/acpica/tbdata.c | 67 +++++++++++++++++++++++++++-------- drivers/acpi/acpica/tbinstal.c | 8 ++--- drivers/acpi/acpica/tbutils.c | 4 --- drivers/acpi/bus.c | 3 ++ drivers/acpi/tables.c | 23 ++++++++++++ include/acpi/acpixf.h | 9 +++++ 8 files changed, 101 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.10
PATCH v2 1/2 ACPICA: Tables: Add mechanism to control early table checksum verification.
From: Lv Zheng <[email protected]>
It is reported that Linux x86 kernel cannot map large tables. The following large SSDT table on such platform fails to pass checksum verification and cannot be installed:
ACPI: SSDT 0x00000000B9638018 07A0C4 (v02 INTEL S2600CP 00004000 INTL 20100331)
It sounds strange that in the 64-bit virtual memory address space, we cannot map a single ACPI table to do checksum verification. The root cause is:
1. ACPICA doesn't split IO memory mapping and table mapping;
2. Linux x86 OSL implements acpi_os_map_memory() using a size limited fix-map mechanism during early boot stage, which is more suitable for only IO mappings.
ACPICA originally only mapped table header for signature validation, and this header mapping is required by OSL override mechanism. There was no checksum verification because we could not map the whole table using this OSL. While the following ACPICA commit enforces checksum verification by mapping the whole table during Linux boot stage and it finally triggers this issue on some platforms:
Commit: 86dfc6f339886559d80ee0d4bd20fe5ee90450f0
Subject: ACPICA: Tables: Fix table checksums verification before installation.
Before doing further cleanups for the OSL table mapping and override implementation, this patch introduces an option for such OSPMs to temporarily discard the checksum verification feature. It then can be re-enabled easily when the ACPICA and the underlying OSL is ready.
This patch also deletes a comment around the limitation of mappings because it is not correct. The limitation is not how many times we can map in the early stage, but the OSL mapping facility may not be suitable for mapping the ACPI tables and thus may complain us the size limitation.
The acpi_tb_verify_table() is renamed to acpi_tb_verify_temp_table() due to the work around added, it now only applies to the table descriptor that hasn't been installed and cannot be used in other cases. Lv Zheng.
--- drivers/acpi/acpica/actables.h | 8 +++-- drivers/acpi/acpica/tbdata.c | 67 +++++++++++++++++++++++++++++++--------- drivers/acpi/acpica/tbinstal.c | 8 ++--- drivers/acpi/acpica/tbutils.c | 4 --- include/acpi/acpixf.h | 9 ++++++ 5 files changed, 70 insertions(+), 26 deletions(-)
drivers/acpi/acpica/actables.h +5 -3
@@ -69,6 +69,11 @@ acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,void acpi_tb_release_temp_table (struct acpi_table_desc *table_desc); +acpi_status acpi_tb_validate_temp_table (struct acpi_table_desc *table_desc); + +acpi_status +acpi_tb_verify_temp_table (struct acpi_table_desc *table_desc,char *signature); +u8 acpi_tb_is_table_loaded (u32 table_index);void acpi_tb_set_table_loaded_flag (u32 table_index,u8 is_loaded);
@@ -96,9 +101,6 @@ acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc);void acpi_tb_invalidate_table (struct acpi_table_desc *table_desc); -acpi_status -acpi_tb_verify_table (struct acpi_table_desc *table_desc,char *signature); -void acpi_tb_override_table (struct acpi_table_desc *old_table_desc); acpi_status
drivers/acpi/acpica/tbdata.c +52 -15
91 lines not on this page · raw message
drivers/acpi/acpica/tbinstal.c +4 -4
@@ -194,7 +194,7 @@ acpi_tb_install_fixed_table(acpi_physical_address address,/* Validate and verify a table before installation */ - status =acpi_tb_verify_table (&new_table_desc, signature); + status =acpi_tb_verify_temp_table (&new_table_desc, signature);if (ACPI_FAILURE (status)) { goto release_and_exit; }
@@ -266,7 +266,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,/* Validate and verify a table before installation */ - status =acpi_tb_verify_table (&new_table_desc,NULL ); + status =acpi_tb_verify_temp_table (&new_table_desc,NULL );if (ACPI_FAILURE (status)) { goto release_and_exit; }
@@ -424,7 +424,7 @@ finish_override:/* Validate and verify a table before overriding */ - status =acpi_tb_verify_table (&new_table_desc,NULL ); + status =acpi_tb_verify_temp_table (&new_table_desc,NULL );if (ACPI_FAILURE (status)) {return ; }
@@ -446,7 +446,7 @@ finish_override:acpi_tb_init_table_descriptor (old_table_desc, new_table_desc.address, new_table_desc.flags, new_table_desc.pointer); -acpi_tb_validate_table (old_table_desc); +acpi_tb_validate_temp_table (old_table_desc);/* Release the temporary table descriptor */
drivers/acpi/acpica/tbutils.c +0 -4
@@ -395,10 +395,6 @@ next_table: table_entry += table_entry_size; } -/* -* It is not possible to map more than one entry in some environments, -* so unmap the root table here before mapping other tables -*/ acpi_os_unmap_memory (table, length);return_ACPI_STATUS (AE_OK );
include/acpi/acpixf.h +9 -0
@@ -162,6 +162,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);ACPI_INIT_GLOBAL (u8, acpi_gbl_use_default_register_widths, TRUE);/* +* Whether or not to verify the table checksum before installation. Set +* this to TRUE to verify the table checksum before install it to the table +* manager. Note that enabling this option causes errors to happen in some +* OSPMs during early initialization stages. Default behavior is to do such +* verification. +*/ +ACPI_INIT_GLOBAL (u8, acpi_gbl_verify_table_checksum, TRUE); + +/* * Optionally enable output from the AML Debug Object. */ ACPI_INIT_GLOBAL (u8, acpi_gbl_enable_aml_debug_object, FALSE);
Signature · 1 line
1.7.10
PATCH v2 2/2 ACPI: Fix regressions that x86 Linux kernel suffers from early mapping size limitation.
In reply to Lv ZhengFrom: Lv Zheng <[email protected]>
The following warning message is triggered:
WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:136 __early_ioremap+0x11f/0x1f2() Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00017-g86dfc6f3-dirty #298 Hardware name: Intel Corporation S2600CP/S2600CP, BIOS SE5C600.86B.99.99.x036.091920111209 09/19/2011 0000000000000009 ffffffff81b75c40 ffffffff817c627b 0000000000000000 ffffffff81b75c78 ffffffff81067b5d 000000000000007b 8000000000000563 00000000b96b20dc 0000000000000001 ffffffffff300e0c ffffffff81b75c88 Call Trace: [<ffffffff817c627b>] dump_stack+0x45/0x56 [<ffffffff81067b5d>] warn_slowpath_common+0x7d/0xa0 [<ffffffff81067c3a>] warn_slowpath_null+0x1a/0x20 [<ffffffff81d4b9d5>] __early_ioremap+0x11f/0x1f2 [<ffffffff81d4bc5b>] early_ioremap+0x13/0x15 [<ffffffff81d2b8f3>] __acpi_map_table+0x13/0x18 [<ffffffff817b8d1a>] acpi_os_map_memory+0x26/0x14e [<ffffffff813ff018>] acpi_tb_acquire_table+0x42/0x70 [<ffffffff813ff086>] acpi_tb_validate_table+0x27/0x37 [<ffffffff813ff0e5>] acpi_tb_verify_table+0x22/0xd8 [<ffffffff813ff6a8>] acpi_tb_install_non_fixed_table+0x60/0x1c9 [<ffffffff81d61024>] acpi_tb_parse_root_table+0x218/0x26a [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d610cd>] acpi_initialize_tables+0x57/0x59 [<ffffffff81d5f25d>] acpi_table_init+0x1b/0x99 [<ffffffff81d2bca0>] acpi_boot_table_init+0x1e/0x85 [<ffffffff81d23043>] setup_arch+0x99d/0xcc6 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1bbbe>] start_kernel+0x8b/0x415 [<ffffffff81d1b120>] ? early_idt_handlers+0x120/0x120 [<ffffffff81d1b5ee>] x86_64_start_reservations+0x2a/0x2c [<ffffffff81d1b72e>] x86_64_start_kernel+0x13e/0x14d ---[ end trace 11ae599a1898f4e7 ]---
when installing the following table during early stage:
ACPI: SSDT 0x00000000B9638018 07A0C4 (v02 INTEL S2600CP 00004000 INTL 20100331)
The regression is caused by the size limitation of the x86 early IO mapping.
The root cause is:
1. ACPICA doesn't split IO memory mapping and table mapping;
2. Linux x86 OSL implements acpi_os_map_memory() using a size limited fix-map mechanism during early boot stage, which is more suitable for only IO mappings.
This patch fixes this issue by utilizing acpi_gbl_verify_table_checksum to disable the table mapping during early stage and enabling it again for the late stage. In this way, the normal code path is not affected. Then after the code related to the root cause is cleaned up, the early checksum verification can be easily re-enabled.
A new boot parameter - acpi_force_table_verification is introduced for the platforms that require the checksum verification to stop loading bad tables.
This fix also covers the checksum verification for the table overrides. Now large tables can also be overridden using the initrd override mechanism.
--- Documentation/kernel-parameters.txt | 5 +++++ drivers/acpi/bus.c | 3 +++ drivers/acpi/tables.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+)
Documentation/kernel-parameters.txt +5 -0
@@ -214,6 +214,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. unusable. The "log_buf_len" parameter may be useful if you need to capture more output. + acpi_force_table_verification [HW,ACPI] + Enable table checksum verification during early stage. + By default, this is disabled due to x86 early mapping + size limitation. + acpi_irq_balance [HW,ACPI] ACPI will balance active IRQs default in APIC mode
drivers/acpi/bus.c +3 -0
@@ -489,6 +489,9 @@ void __init acpi_early_init(void) printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); +/* It's safe to verify table checksums during late stage */ + acpi_gbl_verify_table_checksum = TRUE; +/* enable workarounds, unless strict ACPI spec. compliance */ if (!acpi_strict) acpi_gbl_enable_interpreter_slack = TRUE;
drivers/acpi/tables.c +23 -0
@@ -44,6 +44,12 @@ static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;static int acpi_apic_instance__initdata ; +/* +* Disable table checksum verification for the early stage due to the size +* limitation of the current x86 early mapping implementation. +*/ +static bool acpi_verify_table_checksum__initdata = false; +void acpi_table_print_madt_entry (struct acpi_subtable_header *header) {if (!header)
@@ -333,6 +339,14 @@ int __init acpi_table_init(void) {acpi_status status; +if (acpi_verify_table_checksum) { +pr_info ("Early table checksum verification enabled\n" ); + acpi_gbl_verify_table_checksum = TRUE; + }else { +pr_info ("Early table checksum verification disabled\n" ); + acpi_gbl_verify_table_checksum = FALSE; + } + status =acpi_initialize_tables (initial_tables,ACPI_MAX_TABLES ,0 );if (ACPI_FAILURE (status))return -EINVAL ;
@@ -354,3 +368,12 @@ static int __init acpi_parse_apic_instance(char *str) }early_param ("acpi_apic_instance" , acpi_parse_apic_instance); + +static int __init acpi_force_table_verification_setup (char *s) +{ + acpi_verify_table_checksum = true; + +return 0 ; +} + +early_param ("acpi_force_table_verification" , acpi_force_table_verification_setup);
Signature · 1 line
1.7.10
Re: [PATCH v2 0/2] ACPI: Fix a regression of the table checksum verification.
In reply to Lv ZhengQuoted 10 lines · Lv Zheng
From: Lv Zheng <[email protected]>
There is a warning message triggered by the early table chekcusm verification during boot. Large tables cannot be installed on x86 platforms due to this failure. The root cause is the size limitation of the current x86 early mapping implementation, it's thus not suitable to be used to map ACPI tables.
This patchset fixes this regression by stopping verifying table checksums during the early boot stage.
Both queued up for 3.16.
If they are needed in -stable, please take care of sending an appropriate inclusion request to [email protected] after they have been merged into the Linus' tree.
Thanks!
Quoted 17 lines
Lv Zheng (2):
ACPICA: Tables: Add mechanism to control early table checksum
verification.
ACPI: Fix regressions that x86 Linux kernel suffers from early
mapping size limitation.Documentation/kernel-parameters.txt | 5 +++ drivers/acpi/acpica/actables.h | 8 +++-- drivers/acpi/acpica/tbdata.c | 67 +++++++++++++++++++++++++++-------- drivers/acpi/acpica/tbinstal.c | 8 ++--- drivers/acpi/acpica/tbutils.c | 4 --- drivers/acpi/bus.c | 3 ++ drivers/acpi/tables.c | 23 ++++++++++++ include/acpi/acpixf.h | 9 +++++ 8 files changed, 101 insertions(+), 26 deletions(-)
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
RE: [PATCH v2 0/2] ACPI: Fix a regression of the table checksum verification.
Hi, Rafael
Quoted 12 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Sunday, June 01, 2014 6:50 AMQuoted 8 lines · Lv Zheng
From: Lv Zheng <[email protected]>
There is a warning message triggered by the early table chekcusm verification during boot. Large tables cannot be installed on x86 platforms due to this failure. The root cause is the size limitation of the current x86 early mapping implementation, it's thus not suitable to be used to map ACPI tables.
Quoted 8 lines
Quoted 2 lines
This patchset fixes this regression by stopping verifying table checksums during the early boot stage.
Both queued up for 3.16.
If they are needed in -stable, please take care of sending an appropriate inclusion request to [email protected] after they have been merged into the Linus' tree.
I checked.
The affected code can only be found in linux-pm.git/linux-next. So they are not needed in -stable.
Thanks and best regards
-Lv
Quoted 24 lines
Thanks!
Quoted 6 lines
Lv Zheng (2):
ACPICA: Tables: Add mechanism to control early table checksum
verification.
ACPI: Fix regressions that x86 Linux kernel suffers from early
mapping size limitation.Quoted 11 lines
Documentation/kernel-parameters.txt | 5 +++ drivers/acpi/acpica/actables.h | 8 +++-- drivers/acpi/acpica/tbdata.c | 67 +++++++++++++++++++++++++++-------- drivers/acpi/acpica/tbinstal.c | 8 ++--- drivers/acpi/acpica/tbutils.c | 4 --- drivers/acpi/bus.c | 3 ++ drivers/acpi/tables.c | 23 ++++++++++++ include/acpi/acpixf.h | 9 +++++ 8 files changed, 101 insertions(+), 26 deletions(-)--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH v2 0/2] ACPI: Fix a regression of the table checksum verification.
Quoted 16 lines · Lv
Hi, Rafael
Quoted 14 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Sunday, June 01, 2014 6:50 AMQuoted 10 lines · Lv Zheng
From: Lv Zheng <[email protected]>
There is a warning message triggered by the early table chekcusm verification during boot. Large tables cannot be installed on x86 platforms due to this failure. The root cause is the size limitation of the current x86 early mapping implementation, it's thus not suitable to be used to map ACPI tables.
This patchset fixes this regression by stopping verifying table checksums during the early boot stage.
Quoted 8 lines
Quoted 5 lines
Both queued up for 3.16.
If they are needed in -stable, please take care of sending an appropriate inclusion request to [email protected] after they have been merged into the Linus' tree.
I checked.
The affected code can only be found in linux-pm.git/linux-next. So they are not needed in -stable.
Thanks for checking!
Rafael