* [PATCH net] xen-netback: move netif_napi_add before binding interrupt
@ 2014-08-25 15:44 Wei Liu
2014-08-26 0:32 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wei Liu @ 2014-08-25 15:44 UTC (permalink / raw)
To: xen-devel, netdev; +Cc: talex5, Wei Liu, Ian Campbell
Interrupt is enabled when bind_interdomain_evtchn_to_irqhandler returns.
If there's interrupt pending interrupt handler is invoked.
NAPI needs to be initialised before binding interrupt otherwise the
interrupt handler will try to scheduling a NAPI instance that is not
initialised yet, resulting in kernel OOPS.
This fixes a regression introduced in ea2c5e13 ("xen-netback: move NAPI
add/remove calls").
Ideally function calls to create kthreads should also be moved before
binding but I intent to fix this regression with minimal changes and
refactor the code with another patch.
Reported-by: Thomas Leonard <talex5@gmail.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
---
drivers/net/xen-netback/interface.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index e29e15d..f379689 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -576,6 +576,9 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
init_waitqueue_head(&queue->dealloc_wq);
atomic_set(&queue->inflight_packets, 0);
+ netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
+ XENVIF_NAPI_WEIGHT);
+
if (tx_evtchn == rx_evtchn) {
/* feature-split-event-channels == 0 */
err = bind_interdomain_evtchn_to_irqhandler(
@@ -629,9 +632,6 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
wake_up_process(queue->task);
wake_up_process(queue->dealloc_task);
- netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll,
- XENVIF_NAPI_WEIGHT);
-
return 0;
err_rx_unbind:
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] xen-netback: move netif_napi_add before binding interrupt
2014-08-25 15:44 [PATCH net] xen-netback: move netif_napi_add before binding interrupt Wei Liu
@ 2014-08-26 0:32 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-08-26 0:32 UTC (permalink / raw)
To: wei.liu2; +Cc: xen-devel, netdev, talex5, ian.campbell
From: Wei Liu <wei.liu2@citrix.com>
Date: Mon, 25 Aug 2014 16:44:00 +0100
> Interrupt is enabled when bind_interdomain_evtchn_to_irqhandler returns.
> If there's interrupt pending interrupt handler is invoked.
>
> NAPI needs to be initialised before binding interrupt otherwise the
> interrupt handler will try to scheduling a NAPI instance that is not
> initialised yet, resulting in kernel OOPS.
>
> This fixes a regression introduced in ea2c5e13 ("xen-netback: move NAPI
> add/remove calls").
>
> Ideally function calls to create kthreads should also be moved before
> binding but I intent to fix this regression with minimal changes and
> refactor the code with another patch.
>
> Reported-by: Thomas Leonard <talex5@gmail.com>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-26 0:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 15:44 [PATCH net] xen-netback: move netif_napi_add before binding interrupt Wei Liu
2014-08-26 0:32 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).