Skip to content

Commit

Permalink
xen-netback: notify immediately after pushing Tx response.
Browse files Browse the repository at this point in the history
This fixes a performance regression introduced by
7fbb9d8 (xen-netback: release pending
index before pushing Tx responses)

Moving the notify outside of the spin locks means it can be delayed a
long time (if the dealloc thread is descheduled or there is an
interrupt or softirq).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Zoltan Kiss <zoltan.kiss@linaro.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David Vrabel authored and David S. Miller committed Mar 12, 2015
1 parent b1cb59c commit c8a4d29
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
static void make_tx_response(struct xenvif_queue *queue,
struct xen_netif_tx_request *txp,
s8 st);
static void push_tx_responses(struct xenvif_queue *queue);

static inline int tx_work_todo(struct xenvif_queue *queue);

Expand Down Expand Up @@ -655,15 +656,10 @@ static void xenvif_tx_err(struct xenvif_queue *queue,
unsigned long flags;

do {
int notify;

spin_lock_irqsave(&queue->response_lock, flags);
make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR);
RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
push_tx_responses(queue);
spin_unlock_irqrestore(&queue->response_lock, flags);
if (notify)
notify_remote_via_irq(queue->tx_irq);

if (cons == end)
break;
txp = RING_GET_REQUEST(&queue->tx, cons++);
Expand Down Expand Up @@ -1657,7 +1653,6 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
{
struct pending_tx_info *pending_tx_info;
pending_ring_idx_t index;
int notify;
unsigned long flags;

pending_tx_info = &queue->pending_tx_info[pending_idx];
Expand All @@ -1673,12 +1668,9 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
index = pending_index(queue->pending_prod++);
queue->pending_ring[index] = pending_idx;

RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
push_tx_responses(queue);

spin_unlock_irqrestore(&queue->response_lock, flags);

if (notify)
notify_remote_via_irq(queue->tx_irq);
}


Expand All @@ -1699,6 +1691,15 @@ static void make_tx_response(struct xenvif_queue *queue,
queue->tx.rsp_prod_pvt = ++i;
}

static void push_tx_responses(struct xenvif_queue *queue)
{
int notify;

RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
if (notify)
notify_remote_via_irq(queue->tx_irq);
}

static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue,
u16 id,
s8 st,
Expand Down

0 comments on commit c8a4d29

Please sign in to comment.