From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [PATCH 1/2] net/virtio: fix performance regression due to TSO enabling Date: Wed, 11 Jan 2017 09:22:53 +0100 Message-ID: <20170111092253.559b688f@glumotte.dev.6wind.com> References: <1484108832-19907-1-git-send-email-yuanhan.liu@linux.intel.com> <1484108832-19907-2-git-send-email-yuanhan.liu@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Yuanhan Liu , dev@dpdk.org, Tan Jianfeng , Wang Zhihong , Olivier Matz , "Michael S. Tsirkin" , stable@dpdk.org To: Maxime Coquelin Return-path: Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by dpdk.org (Postfix) with ESMTP id 3FBC4592C for ; Wed, 11 Jan 2017 09:23:01 +0100 (CET) Received: by mail-wm0-f46.google.com with SMTP id r126so5535842wmr.0 for ; Wed, 11 Jan 2017 00:23:01 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Yuanhan, Thanks for the fix. On Wed, 11 Jan 2017 08:59:28 +0100, Maxime Coquelin wrote: > On 01/11/2017 05:27 AM, Yuanhan Liu wrote: > > TSO is now enabled, but it's not actually being used by default in a > > simple L2 forward mode. In such case, we have to zero the virtio net > > headers, to inform the vhost backend that no offload is being used: > > > > hdr->csum_start = 0; > > hdr->csum_offset = 0; > > hdr->flags = 0; > > > > hdr->gso_type = 0; > > hdr->gso_size = 0; > > hdr->hdr_len = 0; > > > > Such writes could be very costly; it introduces severe cache issues: > > The above operations introduce cache write for each packet, which > > stalls the read operation from the vhost backend. > > > > The fact that virtio net header is initiated to zero in PMD driver > > init stage means that these costly writes are unnecessary and could > > be avoided: > > > > if (hdr->csum_start != 0) > > hdr->csum_start = 0; > > > > And that's what the macro ASSIGN_UNLESS_EQUAL does. With this, the > > performance drop introduced by TSO enabling is recovered: it could > > be up to 20% in micro benchmarking. > Very nice! Yep, I'm also impressed by the result. I would have think this is something already done by the hardware and transparent to the software. > > > > > Fixes: 58169a9c8153 ("net/virtio: support Tx checksum offload") > > Fixes: 696573046e9e ("net/virtio: support TSO") > > > > Cc: Olivier Matz > > Cc: Maxime Coquelin > > Cc: Michael S. Tsirkin > > Cc: stable@dpdk.org > > Signed-off-by: Yuanhan Liu > > [...] > > Reviewed-by: Maxime Coquelin Reviewed-by: Olivier Matz