netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv1 net] xen-netback: notify immediately after pushing Tx response.
@ 2015-03-11 15:27 David Vrabel
  2015-03-11 17:09 ` [Xen-devel] " Zoltan Kiss
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Vrabel @ 2015-03-11 15:27 UTC (permalink / raw)
  To: netdev; +Cc: David Vrabel, xen-devel, Ian Campbell, Wei Liu

This fixes a performance regression introduced by
7fbb9d8415d4a51cf542e87cf3a717a9f7e6aedc (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>
---
 drivers/net/xen-netback/netback.c |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index c4d68d7..7f8a466 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -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);
 
@@ -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++);
@@ -1655,7 +1651,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];
@@ -1671,12 +1666,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);
 }
 
 
@@ -1697,6 +1689,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,
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCHv1 net] xen-netback: notify immediately after pushing Tx response.
  2015-03-11 15:27 [PATCHv1 net] xen-netback: notify immediately after pushing Tx response David Vrabel
@ 2015-03-11 17:09 ` Zoltan Kiss
  2015-03-11 17:44 ` Wei Liu
  2015-03-12  3:31 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Zoltan Kiss @ 2015-03-11 17:09 UTC (permalink / raw)
  To: David Vrabel, netdev; +Cc: xen-devel, Wei Liu, Ian Campbell



On 11/03/15 15:27, David Vrabel wrote:
> This fixes a performance regression introduced by
> 7fbb9d8415d4a51cf542e87cf3a717a9f7e6aedc (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>
> ---
>   drivers/net/xen-netback/netback.c |   23 ++++++++++++-----------
>   1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index c4d68d7..7f8a466 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -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);
>
> @@ -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++);
> @@ -1655,7 +1651,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];
> @@ -1671,12 +1666,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);
>   }
>
>
> @@ -1697,6 +1689,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,
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv1 net] xen-netback: notify immediately after pushing Tx response.
  2015-03-11 15:27 [PATCHv1 net] xen-netback: notify immediately after pushing Tx response David Vrabel
  2015-03-11 17:09 ` [Xen-devel] " Zoltan Kiss
@ 2015-03-11 17:44 ` Wei Liu
  2015-03-12  3:31 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2015-03-11 17:44 UTC (permalink / raw)
  To: David Vrabel; +Cc: netdev, xen-devel, Ian Campbell, Wei Liu

On Wed, Mar 11, 2015 at 03:27:59PM +0000, David Vrabel wrote:
> This fixes a performance regression introduced by
> 7fbb9d8415d4a51cf542e87cf3a717a9f7e6aedc (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>

Acked-by: Wei Liu <wei.liu2@citrix.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv1 net] xen-netback: notify immediately after pushing Tx response.
  2015-03-11 15:27 [PATCHv1 net] xen-netback: notify immediately after pushing Tx response David Vrabel
  2015-03-11 17:09 ` [Xen-devel] " Zoltan Kiss
  2015-03-11 17:44 ` Wei Liu
@ 2015-03-12  3:31 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-12  3:31 UTC (permalink / raw)
  To: david.vrabel; +Cc: netdev, xen-devel, ian.campbell, wei.liu2

From: David Vrabel <david.vrabel@citrix.com>
Date: Wed, 11 Mar 2015 15:27:59 +0000

> This fixes a performance regression introduced by
> 7fbb9d8415d4a51cf542e87cf3a717a9f7e6aedc (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>

Applied, thanks David.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-12  3:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11 15:27 [PATCHv1 net] xen-netback: notify immediately after pushing Tx response David Vrabel
2015-03-11 17:09 ` [Xen-devel] " Zoltan Kiss
2015-03-11 17:44 ` Wei Liu
2015-03-12  3:31 ` 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).