Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1250275ybl; Fri, 23 Aug 2019 16:11:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4gSno9hdkaYqp69NktrJAMX+DamwAXOCwgrvNRxDR5wlLuqcBY7+AHT/zlBb6FhpG4n8G X-Received: by 2002:a17:902:1c7:: with SMTP id b65mr7304400plb.313.1566601890801; Fri, 23 Aug 2019 16:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566601890; cv=none; d=google.com; s=arc-20160816; b=nqyxItUdSo0U3Ri28OMQllTsOTYkGnJApyWRwLUJQ1zTQMrMiP+YAScFaGzEzKejZs 5N9eOCh0nycWsRGv+0DkLMHvfGPtNjRnqmVrIw7YOcaViy5iNPCwjdh+zSoGUAQVY6MS MdwMboBl6CB5XVXLdlcqYEi+GJ7ky22uDiB0YK9/rydPEQqttWsPON+KEMIAFH/xIr1B i5HjJcedOQ4+k4+YKZXiyP53flvgdVjMRBIqC8MES6NjvoWnnv7T+MuBxdfHGcwWxcnW QjbFRNJ4F+qTgftMj3kEbWxX4HThHpazmDvjNpJDSGlY56F4hzyoDyCf/pYB8QzfWy0n Ot8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AtOl9JnKzsw0PVIFcNaIxTGS6/5Fr0wZUnvB5I+01zs=; b=hZDny8nzbDqUdh0bO6f90WlkHDXCBDUA8HhEAv5jOyAd/UkpKL4kM8igRTVKmGZGjr go1IaW/MqgU3SxXSvRji9OwJLVicZljOTboDJuSwaIcj8foV99xjgZ4JK0ZNb1BXjeND aWdObqLB+m+GfldSGA1H485MQ1riqb5bu572Hsb3Ly+/ZRqFo9lymWq4PJf2sgbc+3Xl AqCqF6RrR1asLDnJg8XPtgTvBYZ0ER5liKE6ZJ/8HXnoPLHO9BYP37FMiFL0PsvuA1hq iU2HLn3FNZ3BMnJXA7zEqJyTYo1tHKbmUKCoGwvTkGjcSOGTBrVWecZC13XxiiDCc2h9 Wt0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si3936357pfr.52.2019.08.23.16.11.16; Fri, 23 Aug 2019 16:11:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390820AbfHWMKv convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Aug 2019 08:10:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38842 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730989AbfHWMKu (ORCPT ); Fri, 23 Aug 2019 08:10:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 149C41801594; Fri, 23 Aug 2019 12:10:50 +0000 (UTC) Received: from [10.36.116.150] (ovpn-116-150.ams2.redhat.com [10.36.116.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FD2526377; Fri, 23 Aug 2019 12:10:47 +0000 (UTC) From: "Eelco Chaudron" To: "Ilya Maximets" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, "David S. Miller" , "=?utf-8?b?QmrDtnJuIFTDtnBlbA==?=" , "Magnus Karlsson" , "Jakub Kicinski" , "Alexei Starovoitov" , "Daniel Borkmann" , "Jeff Kirsher" , intel-wired-lan@lists.osuosl.org, "William Tu" , "Alexander Duyck" Subject: Re: [PATCH net v3] ixgbe: fix double clean of tx descriptors with xdp Date: Fri, 23 Aug 2019 14:10:45 +0200 Message-ID: <660415CE-6748-4749-84D6-7007F69D8EFB@redhat.com> In-Reply-To: <20190822171237.20798-1-i.maximets@samsung.com> References: <20190822171237.20798-1-i.maximets@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 23 Aug 2019 12:10:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22 Aug 2019, at 19:12, Ilya Maximets wrote: > Tx code doesn't clear the descriptors' status after cleaning. > So, if the budget is larger than number of used elems in a ring, some > descriptors will be accounted twice and xsk_umem_complete_tx will move > prod_tail far beyond the prod_head breaking the completion queue ring. > > Fix that by limiting the number of descriptors to clean by the number > of used descriptors in the tx ring. > > 'ixgbe_clean_xdp_tx_irq()' function refactored to look more like > 'ixgbe_xsk_clean_tx_ring()' since we're allowed to directly use > 'next_to_clean' and 'next_to_use' indexes. > > Fixes: 8221c5eba8c1 ("ixgbe: add AF_XDP zero-copy Tx support") > Signed-off-by: Ilya Maximets > --- > > Version 3: > * Reverted some refactoring made for v2. > * Eliminated 'budget' for tx clean. > * prefetch returned. > > Version 2: > * 'ixgbe_clean_xdp_tx_irq()' refactored to look more like > 'ixgbe_xsk_clean_tx_ring()'. > > drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 29 > ++++++++------------ > 1 file changed, 11 insertions(+), 18 deletions(-) > Did some test with and without the fix applied. For PVP the results are a little different depending on the packet size (note this is a single run, no deviation). For the same physical port in and out it’s faster! Note this was OVS AF_XDP using a XENA tester at 10G wire speed. +--------------------------------------------------------------------------------+ | Physical to Virtual to Physical test, L3 flows[port redirect] | +-----------------+--------------------------------------------------------------+ | | Packet size | +-----------------+--------+--------+--------+--------+--------+--------+--------+ | Number of flows | 64 | 128 | 256 | 512 | 768 | 1024 | 1514 | +-----------------+--------+--------+--------+--------+--------+--------+--------+ | [NO FIX] 1000 | 739161 | 700091 | 690034 | 659894 | 618128 | 594223 | 537504 | +-----------------+--------+--------+--------+--------+--------+--------+--------+ | [FIX] 1000 | 742317 | 708391 | 689952 | 658034 | 626056 | 587653 | 530885 | +-----------------+--------+--------+--------+--------+--------+--------+--------+ +--------------------------------------------------------------------------------------+ | Physical loopback test, L3 flows[port redirect] | +-----------------+--------------------------------------------------------------------+ | | Packet size | +-----------------+---------+---------+---------+---------+---------+---------+--------+ | Number of flows | 64 | 128 | 256 | 512 | 768 | 1024 | 1514 | +-----------------+---------+---------+---------+---------+---------+---------+--------+ | [NO FIX] 1000 | 2573298 | 2227578 | 2514318 | 2298204 | 1081861 | 1015173 | 788081 | +-----------------+---------+---------+---------+---------+---------+---------+--------+ | [FIX] 1000 | 3343188 | 3234993 | 3151833 | 2349597 | 1586276 | 1197304 | 814854 | +-----------------+---------+---------+---------+---------+---------+---------+--------+ Tested-by: Eelco Chaudron