All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] x86/boot: enable NMIs after traps init
@ 2018-10-23 10:59 Sergey Dyasli
  2018-10-23 11:07 ` Andrew Cooper
  0 siblings, 1 reply; 10+ messages in thread
From: Sergey Dyasli @ 2018-10-23 10:59 UTC (permalink / raw)
  To: xen-devel; +Cc: Sergey Dyasli, Wei Liu, Jan Beulich, Andrew Cooper

In certain scenarios, NMIs might be disabled during Xen boot process.
Such situation will cause alternative_instructions() to:

    panic("Timed out waiting for alternatives self-NMI to hit");

This bug was originally seen when using Tboot to boot Xen.

To prevent this from happening, enable NMIs during cpu_init() and
during __start_xen() for BSP.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
---
v2:
- Added enable_nmis() to __start_xen() for BSP
- Added comments as per Andrew's suggestion

CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 xen/arch/x86/cpu/common.c | 3 +++
 xen/arch/x86/setup.c      | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 057859ab14..2d02335fef 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -819,6 +819,9 @@ void cpu_init(void)
 #define CD(register) asm volatile ( "mov %0,%%db" #register : : "r"(0UL) );
 	CD(0); CD(1); CD(2); CD(3); /* no db4 and db5 */; CD(6); CD(7);
 #undef CD
+
+	/* Enable NMIs in case our loader (e.g. Tboot) has left them disabled */
+	enable_nmis();
 }
 
 void cpu_uninit(unsigned int cpu)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 93b79c7c0c..194388ef47 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -708,6 +708,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     /* Full exception support from here on in. */
 
+    /* Re-enable NMIs in case our loader (e.g. Tboot) has left them disabled. */
+    enable_nmis();
+
     if ( pvh_boot )
     {
         /*
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-10-25 12:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23 10:59 [PATCH v2] x86/boot: enable NMIs after traps init Sergey Dyasli
2018-10-23 11:07 ` Andrew Cooper
2018-10-23 14:01   ` Jason Andryuk
2018-10-23 14:33     ` Andrew Cooper
2018-10-23 15:31       ` Jason Andryuk
2018-10-23 16:42         ` Ross Philipson
2018-10-23 16:58           ` Andrew Cooper
2018-10-23 22:01             ` Ross Philipson
2018-10-23 23:41               ` Andrew Cooper
2018-10-25 12:23       ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.