From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [RFC PATCH V2 4/8] xen: dynamically allocate cpu_evtchn_mask Date: Mon, 21 Jan 2013 14:58:24 +0000 Message-ID: <1358780308-30425-5-git-send-email-wei.liu2@citrix.com> References: <1358780308-30425-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1358780308-30425-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: david.vrabel@citrix.com, Wei Liu , ian.campbell@citrix.com, jbeulich@suse.com, konrad.wilk@oracle.com List-Id: xen-devel@lists.xenproject.org Signed-off-by: Wei Liu --- drivers/xen/events.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 6c1917e..913ef0c 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c @@ -134,8 +134,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) @@ -1828,6 +1827,7 @@ static struct evtchn_ops evtchn_ops_l2 __read_mostly = { void __init xen_init_IRQ(void) { int i, rc; + int cpu; evtchn_level = 2; nr_event_channels = NR_EVENT_CHANNELS_L2; @@ -1837,6 +1837,21 @@ void __init xen_init_IRQ(void) evtchn_to_irq = kcalloc(nr_event_channels, sizeof(*evtchn_to_irq), GFP_KERNEL); BUG_ON(!evtchn_to_irq); + + 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; + } + for (i = 0; i < nr_event_channels; i++) evtchn_to_irq[i] = -1; -- 1.7.10.4