From patchwork Fri Nov 1 08:54:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hu, Jiayu" X-Patchwork-Id: 62297 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B76C2A00BE; Fri, 1 Nov 2019 03:13:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1AD691D421; Fri, 1 Nov 2019 03:13:21 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 4FEFD1D41C for ; Fri, 1 Nov 2019 03:13:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Oct 2019 19:13:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,253,1569308400"; d="scan'208";a="212654578" Received: from npg_dpdk_virtio_jiayuhu_07.sh.intel.com ([10.67.119.35]) by orsmga002.jf.intel.com with ESMTP; 31 Oct 2019 19:13:16 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: tiwei.bie@intel.com, maxime.coquelin@redhat.com, zhihong.wang@intel.com, bruce.richardson@intel.com, Jiayu Hu Date: Fri, 1 Nov 2019 04:54:08 -0400 Message-Id: <1572598450-245091-1-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1569507973-247570-1-git-send-email-jiayu.hu@intel.com> References: <1569507973-247570-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [RFC v2 0/2] Add a PMD for DMA-accelerated vhost-user X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In vhost-user enqueue and dequeue operations, where data movement is heavily involved, performing large memory copies usually takes up a major part of CPU cycles and becomes the hot spot. To offload expensive memory operations from the CPU, this patch set proposes to leverage DMA engines, e.g., I/OAT, a DMA engine in the Intel's processor, to accelerate large copies for vhost-user. We implement a new PMD for the DMA accelerated vhost-user, called vhost-dma. This PMD leverages librte_vhost to handle vhost messages, but implements own vring's enqueue and dequeue operations. It offloads large memory copies to the DMA in an asynchronous mode; that is, the CPU just submits copy jobs to the DMA but without waiting for its completion. Thus, there is no CPU intervention during data transfer; we can save precious CPU cycles and improve the overall throughput for vhost-user based applications, like OVS. The PMD provides basic functionality of packet reception and transmission. During packet reception and transmission, it offloads large copies to the DMA and performs small copies by the CPU, due to startup overheads associated with the DMA. The PMD is able to support various DMA engines to accelrate data movements in enqueue and dequeue operations; currently, the supported DMA engine is I/OAT. The PMD just supports I/OAT acceleration in the PMD's transmit data path (i.e. vring's enqueue operation); it still uses the CPU to perform all copies in the PMD's receive data path (i.e. vring's dequeue operation). In addition, the PMD just supports split ring. Users can explicitly assign a DMA device to a TX queue by the parameter 'dmas'. But currently, one DMA device can only be used by one queue and a queue can use one DMA device at a time. In addition, the PMD supports multiqueue and both client and server modes. Users can specify the queue number and client/server mode by 'queues' and 'client' parameters. We measure the performance of vhost-dma in testpmd. With 1024 bytes packets, compared with vhost-user PMD, vhost-dma can improve the throughput for host testpmd around 20%~30% in the VM2VM and PVP cases; with larger packets, the throughput improvement will be higher. Change log ========== v2: - provide DMA-accelerated vhost-user PMD to support various DMA engines. Jiayu Hu (2): vhost: populate guest memory for DMA-accelerated vhost-user net/vhost_dma: add vHost DMA driver config/common_base | 2 + config/common_linux | 1 + drivers/Makefile | 2 +- drivers/net/Makefile | 1 + drivers/net/vhost_dma/Makefile | 31 + drivers/net/vhost_dma/eth_vhost.c | 1495 ++++++++++++++++++++ drivers/net/vhost_dma/eth_vhost.h | 264 ++++ drivers/net/vhost_dma/internal.h | 225 +++ .../net/vhost_dma/rte_pmd_vhost_dma_version.map | 4 + drivers/net/vhost_dma/virtio_net.c | 1234 ++++++++++++++++ lib/librte_vhost/rte_vhost.h | 1 + lib/librte_vhost/socket.c | 11 + lib/librte_vhost/vhost.h | 2 + lib/librte_vhost/vhost_user.c | 3 +- mk/rte.app.mk | 1 + 15 files changed, 3275 insertions(+), 2 deletions(-) create mode 100644 drivers/net/vhost_dma/Makefile create mode 100644 drivers/net/vhost_dma/eth_vhost.c create mode 100644 drivers/net/vhost_dma/eth_vhost.h create mode 100644 drivers/net/vhost_dma/internal.h create mode 100644 drivers/net/vhost_dma/rte_pmd_vhost_dma_version.map create mode 100644 drivers/net/vhost_dma/virtio_net.c