Skip to contentSkip to conversation

x86: machine_restart() must not call acpi_dmar_reinstate() twice

PATCH In review Jan Beulich 2 participants 2 messages Sep 13, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: machine_restart() must not call acpi_dmar_reinstate() twice

.. as that function is not idempotent (it always alters the table checksum). The (generally) duplicate call was a result from it being made before machine_restart() re-invoking itself on the boot CPU.

Considering that no problem arose so far from the table corruption I doubt that we need to restore the correct table signature on the reboot path in general. The only case I can see this as potentially necessary is the tboot one, hence do the call just in that case.

---
Note that this was found to be particularly an issue backporting 2ee9cbf9 ("ACPI: fix acpi_os_map_memory()") to 4.1.x: The first invocation would acquire the lock in acpi_os_map_memory(), and since the lock never gets released, the second invocation gets stuck.

xen/arch/x86/shutdown.c +3 -2
@@ -470,8 +470,6 @@ void machine_restart(unsigned int delay_
     console_start_sync();
     spin_debug_disable();
 
-    acpi_dmar_reinstate();
-
     local_irq_enable();
 
     /* Ensure we are the boot CPU. */
@@ -496,7 +494,10 @@ void machine_restart(unsigned int delay_
     mdelay(delay_millisecs);
 
     if ( tboot_in_measured_env() )
+    {
+        acpi_dmar_reinstate();
         tboot_shutdown(TB_SHUTDOWN_REBOOT);
+    }
 
     efi_reset_system(reboot_mode != 0);
 

x86: machine_restart() must not call acpi_dmar_reinstate() twice

.. as that function is not idempotent (it always alters the table checksum). The (generally) duplicate call was a result from it being made before machine_restart() re-invoking itself on the boot CPU.

Considering that no problem arose so far from the table corruption I doubt that we need to restore the correct table signature on the reboot path in general. The only case I can see this as potentially necessary is the tboot one, hence do the call just in that case.

---
Note that this was found to be particularly an issue backporting 2ee9cbf9 ("ACPI: fix acpi_os_map_memory()") to 4.1.x: The first invocation would acquire the lock in acpi_os_map_memory(), and since the lock never gets released, the second invocation gets stuck.

xen/arch/x86/shutdown.c +3 -2
@@ -470,8 +470,6 @@ void machine_restart(unsigned int delay_
     console_start_sync();
     spin_debug_disable();
 
-    acpi_dmar_reinstate();
-
     local_irq_enable();
 
     /* Ensure we are the boot CPU. */
@@ -496,7 +494,10 @@ void machine_restart(unsigned int delay_
     mdelay(delay_millisecs);
 
     if ( tboot_in_measured_env() )
+    {
+        acpi_dmar_reinstate();
         tboot_shutdown(TB_SHUTDOWN_REBOOT);
+    }
 
     efi_reset_system(reboot_mode != 0);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jan Beulich

.. as that function is not idempotent (it always alters the table checksum). The (generally) duplicate call was a result from it being made before machine_restart() re-invoking itself on the boot CPU.

Considering that no problem arose so far from the table corruption I doubt that we need to restore the correct table signature on the reboot path in general. The only case I can see this as potentially necessary is the tboot one, hence do the call just in that case.

Quoted 35 lines

---
Note that this was found to be particularly an issue backporting 2ee9cbf9 ("ACPI: fix acpi_os_map_memory()") to 4.1.x: The first invocation would acquire the lock in acpi_os_map_memory(), and since the lock never gets released, the second invocation gets stuck.

xen/arch/x86/shutdown.c +3 -2
@@ -470,8 +470,6 @@ void machine_restart(unsigned int delay_
     console_start_sync();
     spin_debug_disable();
 
-    acpi_dmar_reinstate();
-
     local_irq_enable();
 
     /* Ensure we are the boot CPU. */
@@ -496,7 +494,10 @@ void machine_restart(unsigned int delay_
     mdelay(delay_millisecs);
 
     if ( tboot_in_measured_env() )
+    {
+        acpi_dmar_reinstate();
         tboot_shutdown(TB_SHUTDOWN_REBOOT);
+    }
 
     efi_reset_system(reboot_mode != 0);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel