From: "Jan Beulich" Subject: [PATCH] x86: machine_restart() must not call acpi_dmar_reinstate() twice Date: Fri, 13 Sep 2013 09:07:43 +0100 Message-ID: <5232E3EF02000078000F2F35@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part10237DDF.0__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VKOPr-0001sR-3z for xen-devel@lists.xenproject.org; Fri, 13 Sep 2013 08:07:47 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part10237DDF.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline .. 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. Signed-off-by: Jan Beulich --- 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. --- a/xen/arch/x86/shutdown.c +++ b/xen/arch/x86/shutdown.c @@ -470,8 +470,6 @@ void machine_restart(unsigned int delay_ console_start_sync(); spin_debug_disable(); =20 - acpi_dmar_reinstate(); - local_irq_enable(); =20 /* Ensure we are the boot CPU. */ @@ -496,7 +494,10 @@ void machine_restart(unsigned int delay_ mdelay(delay_millisecs); =20 if ( tboot_in_measured_env() ) + { + acpi_dmar_reinstate(); tboot_shutdown(TB_SHUTDOWN_REBOOT); + } =20 efi_reset_system(reboot_mode !=3D 0); =20 --=__Part10237DDF.0__= Content-Type: text/plain; name="x86-restart-DMAR-reinstate.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-restart-DMAR-reinstate.patch" x86: machine_restart() must not call acpi_dmar_reinstate() twice=0A=0A.. = as that function is not idempotent (it always alters the table=0Achecksum).= The (generally) duplicate call was a result from it being=0Amade before = machine_restart() re-invoking itself on the boot CPU.=0A=0AConsidering = that no problem arose so far from the table corruption I=0Adoubt that we = need to restore the correct table signature on the=0Areboot path in = general. The only case I can see this as potentially=0Anecessary is the = tboot one, hence do the call just in that case.=0A=0ASigned-off-by: Jan = Beulich =0A---=0ANote that this was found to be = particularly an issue backporting=0A2ee9cbf9 ("ACPI: fix acpi_os_map_memory= ()") to 4.1.x: The first=0Ainvocation would acquire the lock in acpi_os_map= _memory(), and since=0Athe lock never gets released, the second invocation = gets stuck.=0A=0A--- a/xen/arch/x86/shutdown.c=0A+++ b/xen/arch/x86/shutdow= n.c=0A@@ -470,8 +470,6 @@ void machine_restart(unsigned int delay_=0A = console_start_sync();=0A spin_debug_disable();=0A =0A- acpi_dmar_rei= nstate();=0A-=0A local_irq_enable();=0A =0A /* Ensure we are the = boot CPU. */=0A@@ -496,7 +494,10 @@ void machine_restart(unsigned int = delay_=0A mdelay(delay_millisecs);=0A =0A if ( tboot_in_measured_en= v() )=0A+ {=0A+ acpi_dmar_reinstate();=0A tboot_shutdown(= TB_SHUTDOWN_REBOOT);=0A+ }=0A =0A efi_reset_system(reboot_mode !=3D = 0);=0A =0A --=__Part10237DDF.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part10237DDF.0__=--