Skip to contentSkip to conversation

vhost: vhost injects interrupts to guest for each packet

PATCH Applied Huawei Xie 3 participants 5 messages Sep 21, 2015 – Sep 29, 2015

lore
Share & tools
lore

Huawei Xie

author
#0 lore raw

PATCH 1/1 vhost: vhost injects interrupts to guest for each packet

In merge-able RX path, vhost injects interrupts to guest for each packet. This should degrade performance a lot.
This patch fixes this issue by injecting one interrupt for a batch of packets.

---
 lib/librte_vhost/vhost_rxtx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_vhost/vhost_rxtx.c +5 -2
index 0d07338..9d3165a 100644
@@ -496,7 +496,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,
 						"to get enough desc from "
 						"vring\n",
 						dev->device_fh);
-					return pkt_idx;
+					goto merge_rx_exit;
 				} else {
 					update_secure_len(vq, res_cur_idx, &secure_len, &vec_idx);
 					res_cur_idx++;
@@ -523,7 +523,10 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,
 
 		*(volatile uint16_t *)&vq->used->idx += entry_success;
 		vq->last_used_idx = res_cur_idx;
+	}
 
+merge_rx_exit:
+	if (likely(pkt_idx)) {
 		/* flush used->idx update before we read avail->flags. */
 		rte_mb();
 
@@ -532,7 +535,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,
 			eventfd_write((int)vq->callfd, 1);
 	}
 
-	return count;
+	return pkt_idx;
 }
 
 uint16_t
Signature · 1 line
1.9.3
Acked-by on v1 1/1
#1 lore raw
Quoted 54 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Huawei Xie
Sent: Monday, September 21, 2015 4:16 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] vhost: vhost injects interrupts to guest for each packet

In merge-able RX path, vhost injects interrupts to guest for each packet. This should degrade performance a lot.
This patch fixes this issue by injecting one interrupt for a batch of packets.

---
 lib/librte_vhost/vhost_rxtx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
lib/librte_vhost/vhost_rxtx.c +1 -1
index 0d07338..9d3165a 100644
@@ -496,7 +496,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t
 queue_id,
 						"to get enough desc from "
 						"vring\n",
 						dev->device_fh);
-					return pkt_idx;
+					goto merge_rx_exit;
 				} else {
 					update_secure_len(vq, res_cur_idx,

&secure_len, &vec_idx);

lib/librte_vhost/vhost_rxtx.c +4 -1
 					res_cur_idx++;
@@ -523,7 +523,10 @@ virtio_dev_merge_rx(struct virtio_net *dev,
 uint16_t queue_id,
 
 		*(volatile uint16_t *)&vq->used->idx += entry_success;
 		vq->last_used_idx = res_cur_idx;
+	}
 
+merge_rx_exit:
+	if (likely(pkt_idx)) {
 		/* flush used->idx update before we read avail->flags. */
 		rte_mb();
@@ -532,7 +535,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t
 queue_id,
 			eventfd_write((int)vq->callfd, 1);
 	}
 
-	return count;
+	return pkt_idx;
 }
 
Quoted 2 lines

uint16_t
--

Quoted 1 line

1.9.3

#2 lore raw
In reply to Huawei Xie

Please reword the title (no need to re-send the patch), so that you describe what the patch do (batch interrupt).

2015-09-21 16:16, Huawei Xie:

Quoted 3 lines

In merge-able RX path, vhost injects interrupts to guest for each packet. This should degrade performance a lot.
This patch fixes this issue by injecting one interrupt for a batch of packets.

#3 lore raw
Quoted 8 lines · Thomas Monjalon

Please reword the title (no need to re-send the patch), so that you describe what the patch do (batch interrupt).

2015-09-21 16:16, Huawei Xie:

Quoted 3 lines

In merge-able RX path, vhost injects interrupts to guest for each packet. This should degrade performance a lot.
This patch fixes this issue by injecting one interrupt for a batch of packets.

Hi Thomas:
title:
vhost: inject one interrupt only for a batch of packets
Do you mean this?

#4 lore raw

2015-09-29 15:31, Xie, Huawei:

Quoted 5 lines · Thomas Monjalon
Quoted 4 lines

Please reword the title (no need to re-send the patch), so that you describe what the patch do (batch interrupt).

2015-09-21 16:16, Huawei Xie:

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

In merge-able RX path, vhost injects interrupts to guest for each packet. This should degrade performance a lot.
This patch fixes this issue by injecting one interrupt for a batch of packets.

Hi Thomas:
title:
vhost: inject one interrupt only for a batch of packets
Do you mean this?

Yes, or
"vhost: inject only one interrupt for a batch of packets"

Applied, thanks