]>
Commit | Line | Data |
---|---|---|
cc90b958 BS |
1 | From: jbeulich@novell.com |
2 | Subject: netback: use multicall for send multiple notifications | |
3 | Patch-mainline: obsolete | |
4 | ||
5 | This also does a small fairness improvement since now notifications | |
6 | get sent in the order requests came in rather than in the inverse one. | |
7 | ||
8 | Index: head-2008-12-01/drivers/xen/core/evtchn.c | |
9 | =================================================================== | |
10 | --- head-2008-12-01.orig/drivers/xen/core/evtchn.c 2008-12-03 15:54:25.000000000 +0100 | |
11 | +++ head-2008-12-01/drivers/xen/core/evtchn.c 2008-12-03 15:54:45.000000000 +0100 | |
12 | @@ -1270,6 +1270,21 @@ void notify_remote_via_irq(int irq) | |
13 | } | |
14 | EXPORT_SYMBOL_GPL(notify_remote_via_irq); | |
15 | ||
16 | +int multi_notify_remote_via_irq(multicall_entry_t *mcl, int irq) | |
17 | +{ | |
18 | + int evtchn = evtchn_from_irq(irq); | |
19 | + | |
20 | + BUG_ON(type_from_irq(irq) == IRQT_VIRQ); | |
21 | + BUG_IF_IPI(irq); | |
22 | + | |
23 | + if (!VALID_EVTCHN(evtchn)) | |
24 | + return -EINVAL; | |
25 | + | |
26 | + multi_notify_remote_via_evtchn(mcl, evtchn); | |
27 | + return 0; | |
28 | +} | |
29 | +EXPORT_SYMBOL_GPL(multi_notify_remote_via_irq); | |
30 | + | |
31 | int irq_to_evtchn_port(int irq) | |
32 | { | |
33 | BUG_IF_VIRQ_PER_CPU(irq); | |
34 | Index: head-2008-12-01/drivers/xen/netback/netback.c | |
35 | =================================================================== | |
36 | --- head-2008-12-01.orig/drivers/xen/netback/netback.c 2008-12-01 12:10:26.000000000 +0100 | |
37 | +++ head-2008-12-01/drivers/xen/netback/netback.c 2008-12-01 12:10:27.000000000 +0100 | |
38 | @@ -732,10 +732,20 @@ static void net_rx_action(unsigned long | |
39 | npo.meta_cons += nr_frags + 1; | |
40 | } | |
41 | ||
42 | - while (notify_nr != 0) { | |
43 | - irq = notify_list[--notify_nr]; | |
44 | + if (notify_nr == 1) { | |
45 | + irq = *notify_list; | |
46 | __clear_bit(irq, rx_notify); | |
47 | notify_remote_via_irq(irq + DYNIRQ_BASE); | |
48 | + } else { | |
49 | + for (count = ret = 0; ret < notify_nr; ++ret) { | |
50 | + irq = notify_list[ret]; | |
51 | + __clear_bit(irq, rx_notify); | |
52 | + if (!multi_notify_remote_via_irq(rx_mcl + count, | |
53 | + irq + DYNIRQ_BASE)) | |
54 | + ++count; | |
55 | + } | |
56 | + if (HYPERVISOR_multicall(rx_mcl, count)) | |
57 | + BUG(); | |
58 | } | |
59 | ||
60 | /* More work to do? */ | |
61 | Index: head-2008-12-01/include/xen/evtchn.h | |
62 | =================================================================== | |
63 | --- head-2008-12-01.orig/include/xen/evtchn.h 2008-12-01 12:08:40.000000000 +0100 | |
64 | +++ head-2008-12-01/include/xen/evtchn.h 2008-12-01 12:10:27.000000000 +0100 | |
65 | @@ -179,6 +179,18 @@ static inline void notify_remote_via_evt | |
66 | VOID(HYPERVISOR_event_channel_op(EVTCHNOP_send, &send)); | |
67 | } | |
68 | ||
69 | +static inline void | |
70 | +multi_notify_remote_via_evtchn(multicall_entry_t *mcl, int port) | |
71 | +{ | |
72 | + struct evtchn_send *send = (void *)(mcl->args + 2); | |
73 | + | |
74 | + BUILD_BUG_ON(sizeof(*send) > sizeof(mcl->args) - 2 * sizeof(*mcl->args)); | |
75 | + send->port = port; | |
76 | + mcl->op = __HYPERVISOR_event_channel_op; | |
77 | + mcl->args[0] = EVTCHNOP_send; | |
78 | + mcl->args[1] = (unsigned long)send; | |
79 | +} | |
80 | + | |
81 | /* Clear an irq's pending state, in preparation for polling on it. */ | |
82 | void xen_clear_irq_pending(int irq); | |
83 | ||
84 | @@ -197,6 +209,7 @@ void xen_poll_irq(int irq); | |
85 | * by bind_*_to_irqhandler(). | |
86 | */ | |
87 | void notify_remote_via_irq(int irq); | |
88 | +int multi_notify_remote_via_irq(multicall_entry_t *, int irq); | |
89 | int irq_to_evtchn_port(int irq); | |
90 | ||
91 | #define PIRQ_SET_MAPPING 0x0 |