Skip to contentSkip to conversation

Enable CPU hotplug when running under Xen

PATCH New Anthony PERARD 1 participant 3 messages Sep 10, 2013

lore
Share & tools
lore
#0 lore raw

v4 cover Enable CPU hotplug when running under Xen

First patch fix a bug that would be otherwise trigger when we'll hotplug a CPU.

Second patch does enable CPU hotplug on the xenfv qemu machine so a default installation of Xen 4.3+ can use the cpu-hotplug capability of QEMU.

Anthony PERARD (2):
xen: Fix vcpu initialization.
xen: Enable cpu-hotplug on xenfv machine.

 hw/i386/pc_piix.c | 1 +
 xen-all.c         | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
Anthony PERARD
#1 lore raw

PATCH v4 1/2 xen: Fix vcpu initialization.

Each vcpu need a evtchn binded in qemu, even those that are offline at QEMU initialisation.

---
 xen-all.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
xen-all.c +4 -4
index eb13111..f4c3ffa 100644
@@ -612,13 +612,13 @@ static ioreq_t *cpu_get_ioreq(XenIOState *state)
     }
 
     if (port != -1) {
-        for (i = 0; i < smp_cpus; i++) {
+        for (i = 0; i < max_cpus; i++) {
             if (state->ioreq_local_port[i] == port) {
                 break;
             }
         }
 
-        if (i == smp_cpus) {
+        if (i == max_cpus) {
             hw_error("Fatal error while trying to get io event!\n");
         }
 
@@ -1105,10 +1105,10 @@ int xen_hvm_init(void)
         hw_error("map buffered IO page returned error %d", errno);
     }
 
-    state->ioreq_local_port = g_malloc0(smp_cpus * sizeof (evtchn_port_t));
+    state->ioreq_local_port = g_malloc0(max_cpus * sizeof (evtchn_port_t));
 
     /* FIXME: how about if we overflow the page here? */
-    for (i = 0; i < smp_cpus; i++) {
+    for (i = 0; i < max_cpus; i++) {
         rc = xc_evtchn_bind_interdomain(state->xce_handle, xen_domid,
                                         xen_vcpu_eport(state->shared_page, i));
         if (rc == -1) {
Signature · 1 line
Anthony PERARD
#2 lore raw

PATCH v4 2/2 xen: Enable cpu-hotplug on xenfv machine.

In reply to Anthony PERARD
---
 hw/i386/pc_piix.c | 1 +
 1 file changed, 1 insertion(+)
hw/i386/pc_piix.c +1 -0
index 275e395..5d43663 100644
@@ -730,6 +730,7 @@ static QEMUMachine xenfv_machine = {
     .init = pc_xen_hvm_init,
     .max_cpus = HVM_MAX_VCPUS,
     .default_machine_opts = "accel=xen",
+    .hot_add_cpu = pc_hot_add_cpu,
 };
 #endif
 
Signature · 1 line
Anthony PERARD