[kvm-unit-tests PATCH 02/14] x86: smp: allow multiple init for smp setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
---
 lib/x86/smp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/x86/smp.c b/lib/x86/smp.c
index 1eb49f2..bb74087 100644
--- a/lib/x86/smp.c
+++ b/lib/x86/smp.c
@@ -111,8 +111,13 @@ void on_cpu_async(int cpu, void (*function)(void *data), void *data)
 void smp_init(void)
 {
     int i;
+    bool smp_inited = false;
     void ipi_entry(void);
 
+    if (smp_inited) {
+        return;
+    }
+
     _cpu_count = fwcfg_get_nb_cpus();
 
     setup_idt();
@@ -122,4 +127,5 @@ void smp_init(void)
     for (i = 1; i < cpu_count(); ++i)
         on_cpu(i, setup_smp_id, 0);
 
+    smp_inited = true;
 }
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux