]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
xen/intr: balance dinamic interrupts across available vCPUs
authorRoger Pau Monne <roger.pau@citrix.com>
Tue, 21 Oct 2014 15:00:57 +0000 (17:00 +0200)
committerJulien Grall <julien.grall@linaro.org>
Sun, 12 Apr 2015 11:07:59 +0000 (12:07 +0100)
By default Xen binds all event channels to vCPU#0, and FreeBSD only shuffles
the interrupt sources once, at the end of the boot process. Since new event
channels might be created after this point (because new devices or backends
are added), try to automatically shuffle them at creation time.

This does not affect VIRQ or IPI event channels, that are already bound to a
specific vCPU as requested by the caller.

Sponsored by: Citrix Systems R&D

sys/x86/xen/xen_intr.c

index 64979b136eaded5989f389d79256951f09780936..75521486e24389211cd52ddf71666b78ebff056f 100644 (file)
@@ -1179,6 +1179,13 @@ xen_intr_bind_local_port(device_t dev, evtchn_port_t local_port,
        if (error != 0)
                return (error);
 
+       /*
+        * By default all interrupts are assigned to vCPU#0
+        * unless specified otherwise, so shuffle them to balance
+        * the interrupt load.
+        */
+       xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu());
+
        /*
         * The Event Channel API didn't open this port, so it is not
         * responsible for closing it automatically on unbind.
@@ -1218,6 +1225,13 @@ xen_intr_alloc_and_bind_local_port(device_t dev, u_int remote_domain,
                return (error);
        }
 
+       /*
+        * By default all interrupts are assigned to vCPU#0
+        * unless specified otherwise, so shuffle them to balance
+        * the interrupt load.
+        */
+       xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu());
+
        isrc->xi_close = 1;
        return (0);
 }
@@ -1253,6 +1267,13 @@ xen_intr_bind_remote_port(device_t dev, u_int remote_domain,
                return (error);
        }
 
+       /*
+        * By default all interrupts are assigned to vCPU#0
+        * unless specified otherwise, so shuffle them to balance
+        * the interrupt load.
+        */
+       xen_intr_assign_cpu(&isrc->xi_intsrc, intr_next_cpu());
+
        /*
         * The Event Channel API opened this port, so it is
         * responsible for closing it automatically on unbind.