All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/boot: enable NMIs during cpu_init()
@ 2018-10-23 10:21 Sergey Dyasli
  2018-10-23 10:28 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Dyasli @ 2018-10-23 10:21 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().

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
---
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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 057859ab14..09fbd98764 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -819,6 +819,8 @@ 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();
 }
 
 void cpu_uninit(unsigned int cpu)
-- 
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] 2+ messages in thread

* Re: [PATCH] x86/boot: enable NMIs during cpu_init()
  2018-10-23 10:21 [PATCH] x86/boot: enable NMIs during cpu_init() Sergey Dyasli
@ 2018-10-23 10:28 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2018-10-23 10:28 UTC (permalink / raw
  To: Sergey Dyasli, xen-devel; +Cc: Wei Liu, Jan Beulich

On 23/10/18 11:21, Sergey Dyasli wrote:
> 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().
>
> Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
> ---
> 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 | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
> index 057859ab14..09fbd98764 100644
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -819,6 +819,8 @@ 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
> +

I'd add

/* Re-enable NMIs in case our loader (e.g. Tboot) has left them disabled. */

or there is a chance people might try and take these out again.

> +	enable_nmis();
>  }
>  
>  void cpu_uninit(unsigned int cpu)

This is actually very late in the BSP path.  I'd insert another one
immediately after /* Full exception support from here on in. */ in
__start_xen()

~Andrew

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

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-23 10:21 [PATCH] x86/boot: enable NMIs during cpu_init() Sergey Dyasli
2018-10-23 10:28 ` Andrew Cooper

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.