Imported xen patches.
[people/pmueller/ipfire-2.x.git] / src / patches / 60056_xen-netback-nr-irqs.patch1
1 From: jbeulich@novell.com
2 Subject: netback: reduce overhead of IRQ recording
3 Patch-mainline: obsolete
4
5 Since both NR_PIRQS and NR_DYNIRQS are no longer hardcoded, the
6 (memory) overhead of tracking which ones to send notifications to can
7 be pretty unbounded. Also, store the dynirq rather than the raw irq
8 to push up the limit where the type of notify_list needs to become
9 'int' rather than 'u16'.
10
11 Index: head-2008-12-01/drivers/xen/netback/interface.c
12 ===================================================================
13 --- head-2008-12-01.orig/drivers/xen/netback/interface.c 2007-06-12 13:13:45.000000000 +0200
14 +++ head-2008-12-01/drivers/xen/netback/interface.c 2008-12-01 12:10:26.000000000 +0100
15 @@ -273,6 +273,7 @@ int netif_map(netif_t *netif, unsigned l
16 netif->dev->name, netif);
17 if (err < 0)
18 goto err_hypervisor;
19 + BUG_ON(err < DYNIRQ_BASE || err >= DYNIRQ_BASE + NR_DYNIRQS);
20 netif->irq = err;
21 disable_irq(netif->irq);
22
23 Index: head-2008-12-01/drivers/xen/netback/netback.c
24 ===================================================================
25 --- head-2008-12-01.orig/drivers/xen/netback/netback.c 2008-12-01 12:10:23.000000000 +0100
26 +++ head-2008-12-01/drivers/xen/netback/netback.c 2008-12-01 12:10:26.000000000 +0100
27 @@ -564,8 +564,12 @@ static void net_rx_action(unsigned long
28 static mmu_update_t rx_mmu[NET_RX_RING_SIZE];
29 static gnttab_transfer_t grant_trans_op[NET_RX_RING_SIZE];
30 static gnttab_copy_t grant_copy_op[NET_RX_RING_SIZE];
31 - static unsigned char rx_notify[NR_IRQS];
32 + static DECLARE_BITMAP(rx_notify, NR_DYNIRQS);
33 +#if NR_DYNIRQS <= 0x10000
34 static u16 notify_list[NET_RX_RING_SIZE];
35 +#else
36 + static int notify_list[NET_RX_RING_SIZE];
37 +#endif
38 static struct netbk_rx_meta meta[NET_RX_RING_SIZE];
39
40 struct netrx_pending_operations npo = {
41 @@ -714,11 +718,9 @@ static void net_rx_action(unsigned long
42 nr_frags);
43
44 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&netif->rx, ret);
45 - irq = netif->irq;
46 - if (ret && !rx_notify[irq]) {
47 - rx_notify[irq] = 1;
48 + irq = netif->irq - DYNIRQ_BASE;
49 + if (ret && !__test_and_set_bit(irq, rx_notify))
50 notify_list[notify_nr++] = irq;
51 - }
52
53 if (netif_queue_stopped(netif->dev) &&
54 netif_schedulable(netif) &&
55 @@ -732,8 +734,8 @@ static void net_rx_action(unsigned long
56
57 while (notify_nr != 0) {
58 irq = notify_list[--notify_nr];
59 - rx_notify[irq] = 0;
60 - notify_remote_via_irq(irq);
61 + __clear_bit(irq, rx_notify);
62 + notify_remote_via_irq(irq + DYNIRQ_BASE);
63 }
64
65 /* More work to do? */