Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp451149pxb; Thu, 9 Sep 2021 04:54:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOsxgVs0gqseZjNjJhSf5kX4Z2dNIsXiY0tKEZU9SJ9teUmEbx12bTAxHZSG0WZ9trsWmV X-Received: by 2002:a05:6e02:1112:: with SMTP id u18mr2074066ilk.75.1631188481935; Thu, 09 Sep 2021 04:54:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188481; cv=none; d=google.com; s=arc-20160816; b=0oHQnOqGImhlzqiFDCts/oUGurT5/RL3i3gDyN4KPDdNcaaLKLLauFWjGOxWByGc9q i6h/6KoUvBMabQbCx7iEcN9zzYwKAWL2U0U5P+novx2l3qloKlExpBjt9xWzYBnE6pwM Ar6o9XMKyGqOFDIzdwXnc9Nw6VaAK/2rev2yiOes2FWJAuZDjPOOKlMNwBbcyScO9OHz W0r9tIuc3tM4knWeBSS50NM3UxTvk1N/cAWIPS1u1NwXPMqVFyRPbroMdzwoOsg9iqjS YFpcotNdzCV8Fbz3KtLkeAgkq+/iIGis4mmCSGWiGT6l6gyePk67ip21io39eVO7xe8O /1NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:to :subject:cc:from:dkim-signature; bh=RKfLJTAdYC2Y9GCkgvCCUXZUeq0mgeJOjy8yY6oupzQ=; b=L/xkY8BnVKSj3yvBcDi0wB08UCRvCSLoEtDYZpPgM1lNjbyuftkw0o1WVmUaEkcoEu +TF7fm+pgqBTPyyPFkYnD/DbC48wpf6NpqEMXGRgDRAIrgGxLpgyXO8E5vqDvygy2ifi SlHbD16YVQZ9Rf7Q010K5UvhbvD5HXZ+lIpS/Z0teJ5vkh1B6Y5NwCrX8n89X7Btuwwk 14tvF0dg8H4qgFj8uR/Hr39bX4gz7R9nyrwNEa9SnEQdIHoMDmR+eZ3Bvt1o/M+A+kag WDaSJl7sdyTWaVxug+E23jV37NvxjzwfvkdSFN8+HkCCyHbXBT0mnsaLdZT2eRxUfJkG aOvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UW6AKKbb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si1541425ioc.87.2021.09.09.04.54.30; Thu, 09 Sep 2021 04:54:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UW6AKKbb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239704AbhIILyE (ORCPT + 99 others); Thu, 9 Sep 2021 07:54:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37719 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237988AbhIILvK (ORCPT ); Thu, 9 Sep 2021 07:51:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631188200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RKfLJTAdYC2Y9GCkgvCCUXZUeq0mgeJOjy8yY6oupzQ=; b=UW6AKKbbUFLu7KJnjtdZoYnQPfHeJy5+sqEaCNp2H7o78x0cJWRhZBbUYCRtyoEa3U3ZHQ RLb1/+VhJYmVgn1kKrUY5ZsJp3zZ6wUo9j5uvFY6jYD1CmACEaes+1KXCFycSI5BBndIHP Pst+DKVLDlUcvSqNuN+D0Henh64uPTw= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-67hduSuBPCyQdVD5rR39jw-1; Thu, 09 Sep 2021 07:49:59 -0400 X-MC-Unique: 67hduSuBPCyQdVD5rR39jw-1 Received: by mail-lj1-f200.google.com with SMTP id w22-20020a2e9596000000b001ba46d9e54cso634693ljh.3 for ; Thu, 09 Sep 2021 04:49:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:cc:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RKfLJTAdYC2Y9GCkgvCCUXZUeq0mgeJOjy8yY6oupzQ=; b=SuLAMEW9BPvy/rXcp8s350NKMwGcy/bfzME18yvvxRm7ZeBMrYpx+dy0bTKCcvozyd T4p+8zt9qa/1+p0dxyctPeJV+8oJ+vizR80PTHfGph3dgLbm852SPwkPHnaFEbCdcllf KU3kQL5SmNLb4e5TfxFCQw9MgKYpD28nKsMZXc+SzkeTzH4d0ml0lBazA9hBy1iB2LCw mXYfmeF8ZPjF+gTRu36JdCdhT5usXYClv0ekOj366FWVRl3Iac4zpLaJuB2OGdKhb3xR UJ7T2UHnRI0swvr3WIHNYHMglo08++lGN89JYE9OuMrCExNIL71Cr9XRQIbNStbwTSKW X51A== X-Gm-Message-State: AOAM532HRda6XaWZ+IWIau9pDgPRVDgqtL3tRHGQSgsM0l/SeDBcDYlS x2t56adl9IsxnyDY9uvyllZeHNw/28bMRogcpPtCOBXk6/+5jFk07oCwTiZP8Cpjj03BbjayeNI 77edA/xbjtjVXvsXH/laxYxfk X-Received: by 2002:a2e:22c1:: with SMTP id i184mr1949070lji.89.1631188197671; Thu, 09 Sep 2021 04:49:57 -0700 (PDT) X-Received: by 2002:a2e:22c1:: with SMTP id i184mr1949056lji.89.1631188197447; Thu, 09 Sep 2021 04:49:57 -0700 (PDT) Received: from [192.168.42.238] (87-59-106-155-cable.dk.customer.tdc.net. [87.59.106.155]) by smtp.gmail.com with ESMTPSA id t30sm173712lfg.289.2021.09.09.04.49.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Sep 2021 04:49:56 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Cc: brouer@redhat.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH net 0/2] sfc: fallback for lack of xdp tx queues To: =?UTF-8?B?w43DsWlnbyBIdWd1ZXQ=?= , ecree.xilinx@gmail.com, habetsm.xilinx@gmail.com, davem@davemloft.net, kuba@kernel.org, Ivan Babrou , Marek Majkowski , Jakub Sitnicki , Toke Hoiland Jorgensen , Freysteinn Alfredsson References: <20210909092846.18217-1-ihuguet@redhat.com> Message-ID: Date: Thu, 9 Sep 2021 13:49:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210909092846.18217-1-ihuguet@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Great work Huguet, patches LGTM, I would ACK but they have already been applied: Here is the summary with links: - [net,1/2] sfc: fallback for lack of xdp tx queues https://git.kernel.org/netdev/net/c/415446185b93 - [net,2/2] sfc: last resort fallback for lack of xdp tx queues https://git.kernel.org/netdev/net/c/6215b608a8c4 Cloudflare (cc) heads-up for these improvements. And heads-up to Toke and Frey on patch 2/2, as it creates push-back via TX queue stop/restart logic (see kernel API netif_tx_queue_stopped). XDP currently doesn't handle this well, but I hope to see XDP queueing work from your side to improve the situation ;-) On 09/09/2021 11.28, Íñigo Huguet wrote: > If there are not enough hardware resources to allocate one tx queue per > CPU for XDP, XDP_TX and XDP_REDIRECT actions were unavailable, and using > them resulted each time with the packet being drop and this message in > the logs: XDP TX failed (-22) > > These patches implement 2 fallback solutions for 2 different situations > that might happen: > 1. There are not enough free resources for all the tx queues, but there > are some free resources available > 2. There are not enough free resources at all for tx queues. > > Both solutions are based in sharing tx queues, using __netif_tx_lock for > synchronization. In the second case, as there are not XDP TX queues to > share, network stack queues are used instead, but since we're taking > __netif_tx_lock, concurrent access to the queues is correctly protected. > > The solution for this second case might affect performance both of XDP > traffic and normal traffice due to lock contention if both are used > intensively. That's why I call it a "last resort" fallback: it's not a > desirable situation, but at least we have XDP TX working. > > Some tests has shown good results and indicate that the non-fallback > case is not being damaged by this changes. They are also promising for > the fallback cases. This is the test: > 1. From another machine, send high amount of packets with pktgen, script > samples/pktgen/pktgen_sample04_many_flows.sh > 2. In the tested machine, run samples/bpf/xdp_rxq_info with arguments > "-a XDP_TX --swapmac" and see the results > 3. In the tested machine, run also pktgen_sample04 to create high TX > normal traffic, and see how xdp_rxq_info results vary > > Note that this test doesn't check the worst situations for the fallback > solutions because XDP_TX will only be executed from the same CPUs that > are processed by sfc, and not from every CPU in the system, so the > performance drop due to the highest locking contention doesn't happen. > I'd like to test that, as well, but I don't have access right now to a > proper environment. > > Test results: > > Without doing TX: > Before changes: ~2,900,000 pps > After changes, 1 queues/core: ~2,900,000 pps > After changes, 2 queues/core: ~2,900,000 pps > After changes, 8 queues/core: ~2,900,000 pps > After changes, borrowing from network stack: ~2,900,000 pps > > With multiflow TX at the same time: > Before changes: ~1,700,000 - 2,900,000 pps > After changes, 1 queues/core: ~1,700,000 - 2,900,000 pps > After changes, 2 queues/core: ~1,700,000 pps > After changes, 8 queues/core: ~1,700,000 pps > After changes, borrowing from network stack: 1,150,000 pps > > Sporadic "XDP TX failed (-5)" warnings are shown when running xdp program > and pktgen simultaneously. This was expected because XDP doesn't have any > buffering system if the NIC is under very high pressure. Thousands of > these warnings are shown in the case of borrowing net stack queues. As I > said before, this was also expected. > > > Íñigo Huguet (2): > sfc: fallback for lack of xdp tx queues > sfc: last resort fallback for lack of xdp tx queues > > drivers/net/ethernet/sfc/efx_channels.c | 98 ++++++++++++++++++------- > drivers/net/ethernet/sfc/net_driver.h | 8 ++ > drivers/net/ethernet/sfc/tx.c | 29 ++++++-- > 3 files changed, 99 insertions(+), 36 deletions(-) >