From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C455F5592 for ; Wed, 17 Aug 2016 04:29:46 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 16 Aug 2016 19:29:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,529,1464678000"; d="scan'208";a="1036855845" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 16 Aug 2016 19:29:44 -0700 Date: Wed, 17 Aug 2016 10:38:25 +0800 From: Yuanhan Liu To: "Wang, Zhihong" Cc: Maxime Coquelin , "dev@dpdk.org" Message-ID: <20160817023825.GO30752@yliu-dev.sh.intel.com> References: <1471319402-112998-1-git-send-email-zhihong.wang@intel.com> <8F6C2BD409508844A0EFC19955BE09411077206B@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8F6C2BD409508844A0EFC19955BE09411077206B@SHSMSX103.ccr.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] optimize vhost enqueue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 02:29:47 -0000 On Wed, Aug 17, 2016 at 01:45:26AM +0000, Wang, Zhihong wrote: > > > > -----Original Message----- > > From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com] > > Sent: Tuesday, August 16, 2016 10:00 PM > > To: Wang, Zhihong ; dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH] optimize vhost enqueue > > > > Hi Zhihong, > > > > On 08/16/2016 05:50 AM, Zhihong Wang wrote: > > > This patch optimizes the vhost enqueue function: rte_vhost_enqueue_burst. > > > > > > Currently 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 virtio_dev_merge_rx doesn't provide optimal performance, also it is > > > reported having compatibility issue working with Windows VMs. > > Could you tell us more please about this compatibility issue? > > > For example, when you have testpmd in the host and Window VM as the guest, > with mrg_rxbuf turned on, the guest will hang once there's packets enqueued > by virtio_dev_merge_rx. You should put it into commit log. > Let me know if you see the same issue. > > > > > > > > > > Besides, having 2 separated functions increases maintenance efforts. > > > > > > This patch uses a single function logic to replace the current 2 for > > > better maintainability, and provides better performance by optimizing > > > caching behavior especially for mrg_rxbuf turned on cases. Here, here sounds two parts to me: - one to unite mergeable and non-mergeable Rx - another one to optimize the mergeable path That means you should do it in two patches, with that we can have clear understanding what changes the performance boost. It also helps review. > > Do you have some benchmark comparison before and after your change? > > > > Also, for maintainability, I would suggest the that the enqueue > > function be split. Because vhost_enqueue_burst becomes very long (220 > > LoC), and max level of indentation is too high (6). > > > > It makes the code hard to understand, and prone to miss bugs during > > review and maintenance. Agreed. > > This is something I've thought about while writing the code, the reason I > keep it as one function body is that: > > 1. This function is very performance sensitive, and we need full control of > code ordering (You can compare with the current performance with the > mrg_rxbuf feature turned on to see the difference). Will inline functions help? > 2. I somehow find that a single function logic makes it easier to understand, > surely I can add comments to make it easiler to read for . > > Please let me know if you still insist, we can discuss more on it. I am personally not a fan of huge function; I would try hard to avoid too many levels of indentation as well. > > > > > > > > > It also fixes the issue working with Windows VMs. > > Ideally, the fix should be sent separately, before the rework. > > Indeed, we might want to have the fix in the stable branch, without > > picking the optimization. Agreed. > > > > > > > > Signed-off-by: Zhihong Wang > > > --- > > > lib/librte_vhost/vhost-net.h | 6 +- > > > lib/librte_vhost/vhost_rxtx.c | 582 ++++++++++++++---------------------------- > > > lib/librte_vhost/virtio-net.c | 15 +- > > > 3 files changed, 208 insertions(+), 395 deletions(-) > > 582 lines changed is a huge patch. > > If possible, it would be better splitting it in incremental changes, > > making the review process easier. > > > It looks like a huge patch, but it simply deletes the current implementation > and add the new code. I think perhaps split it into 2, 1st one to replace > just the rte_vhost_enqueue_burst, 2nd one to delete all the obsolete functions. > It should make the patch clear, how do you think? :) Nope, it's not working in that way. It should be: - one patch to fix the hang issue for windows guest Please cc it to stable@dpdk.org as well so that we could pick it for v16.07 stable release. - one patch to unite the two different Rx code path - another patch to optimize mergeable code path --yliu