]> xenbits.xensource.com Git - people/larsk/xen.git/commitdiff
x86/crash: force unlock console before printing on kexec crash
authorIgor Druzhinin <igor.druzhinin@citrix.com>
Tue, 1 Oct 2019 19:15:57 +0000 (20:15 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 2 Oct 2019 10:25:05 +0000 (11:25 +0100)
There is a small window where shootdown NMI might come to a CPU
(e.g. in serial interrupt handler) where console lock is taken. In order
not to leave following console prints waiting infinitely for shot down
CPUs to free the lock - force unlock the console.

The race has been frequently observed while crashing nested Xen in
an HVM domain.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/crash.c

index 6e1d3d3a84c491538b68bd2b6f7d8e9eb79f9203..450eecd46baf4c1777d949933b57e6724458cb51 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/io_apic.h>
 #include <xen/iommu.h>
 #include <asm/hpet.h>
+#include <xen/console.h>
 
 static cpumask_t waiting_to_crash;
 static unsigned int crashing_cpu;
@@ -154,6 +155,12 @@ static void nmi_shootdown_cpus(void)
         msecs--;
     }
 
+    /*
+     * We may have NMI'd another CPU while it was holding the console lock.
+     * It won't be in a position to release the lock...
+     */
+    console_force_unlock();
+
     /* Leave a hint of how well we did trying to shoot down the other cpus */
     if ( cpumask_empty(&waiting_to_crash) )
         printk("Shot down all CPUs\n");