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

[Xen-devel] [PATCH 08/13] xen: dynamically allocate cpu_evtchn_mask



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 drivers/xen/events.c |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 4820a52..30ca620 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -123,8 +123,7 @@ static int *evtchn_to_irq;
 static unsigned long *pirq_eoi_map;
 static bool (*pirq_needs_eoi)(unsigned irq);
 
-static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS_L2/BITS_PER_LONG],
-                     cpu_evtchn_mask);
+static DEFINE_PER_CPU(unsigned long *, cpu_evtchn_mask);
 
 /* Xen will never allocate port zero for any purpose. */
 #define VALID_EVTCHN(chn)      ((chn) != 0)
@@ -333,7 +332,8 @@ static void init_evtchn_cpu_bindings(void)
 
        for_each_possible_cpu(i)
                memset(per_cpu(cpu_evtchn_mask, i),
-                      (i == 0) ? ~0 : 0, sizeof(*per_cpu(cpu_evtchn_mask, i)));
+                      (i == 0) ? ~0 : 0,
+                      sizeof(unsigned long)*(nr_event_channels/BITS_PER_LONG));
 }
 
 static inline void clear_evtchn(int port)
@@ -1835,6 +1835,7 @@ void xen_callback_vector(void) {}
 void __init xen_init_IRQ(void)
 {
        int i, rc;
+       int cpu;
        struct shared_info *s = HYPERVISOR_shared_info;
 
        evtchn_pending = s->evtchn_pending;
@@ -1849,6 +1850,20 @@ void __init xen_init_IRQ(void)
        for (i = 0; i < nr_event_channels; i++)
                evtchn_to_irq[i] = -1;
 
+       for_each_possible_cpu(cpu) {
+               void *p;
+               unsigned int nr = nr_event_channels / BITS_PER_LONG;
+
+               p = kzalloc_node(sizeof(unsigned long) * nr,
+                                GFP_KERNEL,
+                                cpu_to_node(cpu));
+               if (!p)
+                       p = kzalloc(sizeof(unsigned long) * nr,
+                                   GFP_KERNEL);
+               BUG_ON(!p);
+               per_cpu(cpu_evtchn_mask, cpu) = p;
+       }
+
        init_evtchn_cpu_bindings();
 
        /* No event channels are 'live' right now. */
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.