From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhihong Wang Subject: [PATCH v2 0/6] vhost: optimize enqueue Date: Thu, 18 Aug 2016 02:33:05 -0400 Message-ID: <1471501991-37257-1-git-send-email-zhihong.wang@intel.com> References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> Cc: maxime.coquelin@redhat.com, yuanhan.liu@linux.intel.com To: dev@dpdk.org Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 904CE5AA1 for ; Thu, 18 Aug 2016 15:41:08 +0200 (CEST) In-Reply-To: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch set optimizes the vhost enqueue function. It implements the vhost logic from scratch into a single function designed for high performance and good maintainability, and improves CPU efficiency significantly by optimizing cache access, which means: * For fast frontends (eg. DPDK virtio pmd), higher performance (maximum throughput) can be achieved. * For slow frontends (eg. kernel virtio-net), better scalability can be achieved, each vhost core can support more connections since it takes less cycles to handle each single frontend. The main optimization techniques are: 1. Reorder code to reduce CPU pipeline stall cycles. 2. Batch update the used ring for better efficiency. 3. Prefetch descriptor to hide cache latency. 4. Remove useless volatile attribute to allow compiler optimization. In the existing code there're 2 callbacks for vhost enqueue: * virtio_dev_merge_rx for mrg_rxbuf turned on cases. * virtio_dev_rx for mrg_rxbuf turned off cases. The performance of the existing code is not optimal, especially when the mrg_rxbuf feature turned on. Also, having 2 separated functions increases maintenance efforts. --- Changes in v2: 1. Split the big function into several small ones 2. Use multiple patches to explain each optimization 3. Add comments Zhihong Wang (6): vhost: rewrite enqueue vhost: remove obsolete vhost: remove useless volatile vhost: add desc prefetch vhost: batch update used ring vhost: optimize cache access lib/librte_vhost/vhost-net.h | 6 +- lib/librte_vhost/vhost_rxtx.c | 582 +++++++++++++++--------------------------- lib/librte_vhost/virtio-net.c | 15 +- 3 files changed, 228 insertions(+), 375 deletions(-) -- 2.7.4