Skip to contentSkip to conversation

ACPI: x86: Call acpi_boot_table_init() after acpi_table_upgrade()

PATCH In review Rafael J. Wysocki 5 participants 9 messages Apr 13, 2021 – Apr 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: x86: Call acpi_boot_table_init() after acpi_table_upgrade()

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
 arch/x86/kernel/setup.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/setup.c +2 -3
Index: linux-pm/arch/x86/kernel/setup.c
===================================================================
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
 	cleanup_highmap();
 
-	/* Look for ACPI tables and reserve memory occupied by them. */
-	acpi_boot_table_init();
-
 	memblock_set_current_limit(ISA_END_ADDRESS);
 	e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
 	reserve_initrd();
 
 	acpi_table_upgrade();
+	/* Look for ACPI tables and reserve memory occupied by them. */
+	acpi_boot_table_init();
 
 	vsmp_init();
 
#1 lore raw
Quoted 39 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
  arch/x86/kernel/setup.c |    5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +0 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
  	cleanup_highmap();
 
-	/* Look for ACPI tables and reserve memory occupied by them. */
-	acpi_boot_table_init();
-
  	memblock_set_current_limit(ISA_END_ADDRESS);
  	e820__memblock_setup();
 

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 1135

Quoted 7 lines
arch/x86/kernel/setup.c +2 -0
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
  	reserve_initrd();
 
  	acpi_table_upgrade();
+	/* Look for ACPI tables and reserve memory occupied by them. */
+	acpi_boot_table_init();
 
  	vsmp_init();

This is fairly late; especially, it's after actual allocations -- see e820__memblock_alloc_reserved_mpc_new().

Can't the table upgrade mechanism fix up when adjusting something? Some details on what actually breaks would be helpful.

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 47 lines · David Hildenbrand
Quoted 45 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
  arch/x86/kernel/setup.c |    5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +2 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
      cleanup_highmap();
 
-     /* Look for ACPI tables and reserve memory occupied by them. */
-     acpi_boot_table_init();
-
      memblock_set_current_limit(ISA_END_ADDRESS);
      e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
      reserve_initrd();
 
      acpi_table_upgrade();
+     /* Look for ACPI tables and reserve memory occupied by them. */
+     acpi_boot_table_init();
 
Quoted 6 lines

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 1135

Quoted 1 line
arch/x86/kernel/setup.c +0 -0
      vsmp_init();

This is fairly late; especially, it's after actual allocations -- see e820__memblock_alloc_reserved_mpc_new().

Can't the table upgrade mechanism fix up when adjusting something?

Not at this point of the cycle I'm afraid.

Quoted 1 line

Some details on what actually breaks would be helpful.

Generally speaking, the table overrides that come from the initrd are not taken into account if acpi_boot_table_init() runs before acpi_table_upgrade() and the latter cannot run before reserve_initrd().

Honestly, I'm not sure how much effort it would take to untangle this ATM.

#3 lore raw
Quoted 55 lines · Rafael J. Wysocki
Quoted 47 lines · David Hildenbrand
Quoted 45 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
   arch/x86/kernel/setup.c |    5 ++---
   1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +2 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
       cleanup_highmap();
 
-     /* Look for ACPI tables and reserve memory occupied by them. */
-     acpi_boot_table_init();
-
       memblock_set_current_limit(ISA_END_ADDRESS);
       e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
       reserve_initrd();
 
       acpi_table_upgrade();
+     /* Look for ACPI tables and reserve memory occupied by them. */
+     acpi_boot_table_init();
 
Quoted 6 lines

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 1135

Quoted 1 line
arch/x86/kernel/setup.c +0 -0
       vsmp_init();

This is fairly late; especially, it's after actual allocations -- see e820__memblock_alloc_reserved_mpc_new().

Can't the table upgrade mechanism fix up when adjusting something?

Quoted 8 lines

Not at this point of the cycle I'm afraid.

Quoted 1 line

Some details on what actually breaks would be helpful.

Generally speaking, the table overrides that come from the initrd are not taken into account if acpi_boot_table_init() runs before acpi_table_upgrade() and the latter cannot run before reserve_initrd().

I see. (looking at Documentation/acpi/initrd_table_override.txt I understand what acpi table overrides are for :) )

Quoted 2 lines

Honestly, I'm not sure how much effort it would take to untangle this ATM.

Also true; ideally, we wouldn't have any allocations (find+reserve) before ordinary reservations are done.

However, I have no idea if we can move e820__memblock_alloc_reserved_mpc_new() and reserve_real_mode() around easily. Also, reserve_initrd()->relocate_initrd() does allocations.

This is a mess.

Signature · 3 lines
Thanks,

David / dhildenb
#4 lore raw
Quoted 69 lines · David Hildenbrand
Quoted 55 lines · Rafael J. Wysocki
Quoted 47 lines · David Hildenbrand
Quoted 45 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
   arch/x86/kernel/setup.c |    5 ++---
   1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +2 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
       cleanup_highmap();
 
-     /* Look for ACPI tables and reserve memory occupied by them. */
-     acpi_boot_table_init();
-
       memblock_set_current_limit(ISA_END_ADDRESS);
       e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
       reserve_initrd();
 
       acpi_table_upgrade();
+     /* Look for ACPI tables and reserve memory occupied by them. */
+     acpi_boot_table_init();
 
Quoted 6 lines

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 1135

Quoted 1 line
arch/x86/kernel/setup.c +0 -0
       vsmp_init();

This is fairly late; especially, it's after actual allocations -- see e820__memblock_alloc_reserved_mpc_new().

Can't the table upgrade mechanism fix up when adjusting something?

Quoted 8 lines

Not at this point of the cycle I'm afraid.

Quoted 1 line

Some details on what actually breaks would be helpful.

Generally speaking, the table overrides that come from the initrd are not taken into account if acpi_boot_table_init() runs before acpi_table_upgrade() and the latter cannot run before reserve_initrd().

I see. (looking at Documentation/acpi/initrd_table_override.txt I understand what acpi table overrides are for :) )

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Honestly, I'm not sure how much effort it would take to untangle this ATM.

Also true; ideally, we wouldn't have any allocations (find+reserve) before ordinary reservations are done.

However, I have no idea if we can move e820__memblock_alloc_reserved_mpc_new() and reserve_real_mode() around easily. Also, reserve_initrd()->relocate_initrd() does allocations.

Even if we can move e820__memblock_alloc_reserved_mpc_new() and reserve_real_mode(), the allocation in reserve_initrd() has to be before the tables override, we would only reduce the probability of allocating an ACPI page.

I think what we can do is to override the ACPI tables separately from their initial parsing. Rafael, what do you say?

Quoted 1 line

This is a mess.

True :(

Signature · 2 lines
Sincerely yours,
Mike.
#5 lore raw
Quoted 80 lines · Mike Rapoport
Quoted 69 lines · David Hildenbrand
Quoted 55 lines · Rafael J. Wysocki
Quoted 47 lines · David Hildenbrand
Quoted 45 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
   arch/x86/kernel/setup.c |    5 ++---
   1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +2 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
       cleanup_highmap();
 
-     /* Look for ACPI tables and reserve memory occupied by them. */
-     acpi_boot_table_init();
-
       memblock_set_current_limit(ISA_END_ADDRESS);
       e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
       reserve_initrd();
 
       acpi_table_upgrade();
+     /* Look for ACPI tables and reserve memory occupied by them. */
+     acpi_boot_table_init();
 
Quoted 6 lines

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 1135

Quoted 1 line
arch/x86/kernel/setup.c +0 -0
       vsmp_init();

This is fairly late; especially, it's after actual allocations -- see e820__memblock_alloc_reserved_mpc_new().

Can't the table upgrade mechanism fix up when adjusting something?

Quoted 8 lines

Not at this point of the cycle I'm afraid.

Quoted 1 line

Some details on what actually breaks would be helpful.

Generally speaking, the table overrides that come from the initrd are not taken into account if acpi_boot_table_init() runs before acpi_table_upgrade() and the latter cannot run before reserve_initrd().

I see. (looking at Documentation/acpi/initrd_table_override.txt I understand what acpi table overrides are for :) )

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Honestly, I'm not sure how much effort it would take to untangle this ATM.

Also true; ideally, we wouldn't have any allocations (find+reserve) before ordinary reservations are done.

However, I have no idea if we can move e820__memblock_alloc_reserved_mpc_new() and reserve_real_mode() around easily. Also, reserve_initrd()->relocate_initrd() does allocations.

Quoted 7 lines

Even if we can move e820__memblock_alloc_reserved_mpc_new() and reserve_real_mode(), the allocation in reserve_initrd() has to be before the tables override, we would only reduce the probability of allocating an ACPI page.

I think what we can do is to override the ACPI tables separately from their initial parsing. Rafael, what do you say?

Well, possibly. With one caveat that parsing a table that's going to be overridden subsequently may not be a good idea.

Anyway, things like that can only be done in the next cycle or later.

#6 lore raw
In reply to Rafael J. Wysocki
Quoted 11 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Quoted 8 lines
Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

Will do.

George

Quoted 31 lines
---
  arch/x86/kernel/setup.c |    5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +2 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
  	cleanup_highmap();
 
-	/* Look for ACPI tables and reserve memory occupied by them. */
-	acpi_boot_table_init();
-
  	memblock_set_current_limit(ISA_END_ADDRESS);
  	e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
  	reserve_initrd();
 
  	acpi_table_upgrade();
+	/* Look for ACPI tables and reserve memory occupied by them. */
+	acpi_boot_table_init();
 
  	vsmp_init();
 
#7 lore raw
In reply to Rafael J. Wysocki

Rafael & Mike,

Do you still need this patch tested in the failing scenario?

Have not seen any recent activity on this.

Thank you,
George

Quoted 50 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Commit 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables") attempted to address an issue with reserving the memory occupied by ACPI tables, but it broke the initrd-based table override mechanism relied on by multiple users.

To restore the initrd-based ACPI table override functionality, move the acpi_boot_table_init() invocation in setup_arch() on x86 after the acpi_table_upgrade() one.

Fixes 1a1c130ab757 ("ACPI: tables: x86: Reserve memory occupied by ACPI tables")

---

George, can you please check if this reintroduces the issue addressed by the above commit for you?

---
  arch/x86/kernel/setup.c |    5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/arch/x86/kernel/setup.c
===================================================================

arch/x86/kernel/setup.c +2 -3
@@ -1045,9 +1045,6 @@ void __init setup_arch(char **cmdline_p)
 
  	cleanup_highmap();
 
-	/* Look for ACPI tables and reserve memory occupied by them. */
-	acpi_boot_table_init();
-
  	memblock_set_current_limit(ISA_END_ADDRESS);
  	e820__memblock_setup();
 
@@ -1132,6 +1129,8 @@ void __init setup_arch(char **cmdline_p)
  	reserve_initrd();
 
  	acpi_table_upgrade();
+	/* Look for ACPI tables and reserve memory occupied by them. */
+	acpi_boot_table_init();
 
  	vsmp_init();
 
#8 lore raw
Quoted 4 lines · George Kennedy

Rafael & Mike,

Do you still need this patch tested in the failing scenario?

Well, it's been merged into the mainline, so please test 5.12.

Thanks!