1 From: jbeulich@novell.com
2 Subject: netback: use multicall for send multiple notifications
3 Patch-mainline: obsolete
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.
8 --- sle11-2009-03-24.orig/drivers/xen/core/evtchn.c 2009-03-31 13:36:56.000000000 +0200
9 +++ sle11-2009-03-24/drivers/xen/core/evtchn.c 2009-03-31 13:37:08.000000000 +0200
10 @@ -1294,6 +1294,21 @@ void notify_remote_via_irq(int irq)
12 EXPORT_SYMBOL_GPL(notify_remote_via_irq);
14 +int multi_notify_remote_via_irq(multicall_entry_t *mcl, int irq)
16 + int evtchn = evtchn_from_irq(irq);
18 + BUG_ON(type_from_irq(irq) == IRQT_VIRQ);
21 + if (!VALID_EVTCHN(evtchn))
24 + multi_notify_remote_via_evtchn(mcl, evtchn);
27 +EXPORT_SYMBOL_GPL(multi_notify_remote_via_irq);
29 int irq_to_evtchn_port(int irq)
31 BUG_IF_VIRQ_PER_CPU(irq);
32 --- sle11-2009-03-24.orig/drivers/xen/netback/netback.c 2008-12-23 09:35:42.000000000 +0100
33 +++ sle11-2009-03-24/drivers/xen/netback/netback.c 2008-12-23 09:35:48.000000000 +0100
34 @@ -748,10 +748,20 @@ static void net_rx_action(unsigned long
35 npo.meta_cons += nr_frags + 1;
38 - while (notify_nr != 0) {
39 - irq = notify_list[--notify_nr];
40 + if (notify_nr == 1) {
42 __clear_bit(irq, rx_notify);
43 notify_remote_via_irq(irq + DYNIRQ_BASE);
45 + for (count = ret = 0; ret < notify_nr; ++ret) {
46 + irq = notify_list[ret];
47 + __clear_bit(irq, rx_notify);
48 + if (!multi_notify_remote_via_irq(rx_mcl + count,
52 + if (HYPERVISOR_multicall(rx_mcl, count))
56 /* More work to do? */
57 --- sle11-2009-03-24.orig/include/xen/evtchn.h 2009-03-04 11:38:25.000000000 +0100
58 +++ sle11-2009-03-24/include/xen/evtchn.h 2008-12-01 12:10:27.000000000 +0100
59 @@ -179,6 +179,18 @@ static inline void notify_remote_via_evt
60 VOID(HYPERVISOR_event_channel_op(EVTCHNOP_send, &send));
64 +multi_notify_remote_via_evtchn(multicall_entry_t *mcl, int port)
66 + struct evtchn_send *send = (void *)(mcl->args + 2);
68 + BUILD_BUG_ON(sizeof(*send) > sizeof(mcl->args) - 2 * sizeof(*mcl->args));
70 + mcl->op = __HYPERVISOR_event_channel_op;
71 + mcl->args[0] = EVTCHNOP_send;
72 + mcl->args[1] = (unsigned long)send;
75 /* Clear an irq's pending state, in preparation for polling on it. */
76 void xen_clear_irq_pending(int irq);
78 @@ -197,6 +209,7 @@ void xen_poll_irq(int irq);
79 * by bind_*_to_irqhandler().
81 void notify_remote_via_irq(int irq);
82 +int multi_notify_remote_via_irq(multicall_entry_t *, int irq);
83 int irq_to_evtchn_port(int irq);
85 #define PIRQ_SET_MAPPING 0x0