Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2982938pxv; Mon, 12 Jul 2021 06:41:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiCQj3Q77xr4aDRhMNGGDnfhEkFVNnzywzu9vtNo+Ck1WZqfzqGalSfsBVgLTx7UkZ/z5H X-Received: by 2002:a05:6402:1242:: with SMTP id l2mr272138edw.97.1626097316080; Mon, 12 Jul 2021 06:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626097316; cv=none; d=google.com; s=arc-20160816; b=V1U/KJAy1+nfPujsucseN/CFuoCwyC6/0NO0gKYnAfSWcnpT8dTD9En+f84Bf+oZ8B 6h5EoXQn/ZzniBaVQjQhSaBdIEIFY+d7bMNnAwxv3aYB3kSF43fsqx3XFg4LzYT55LO5 TZxwlQtfC7jyehvJvasDt8Ywjet4+Q9YCaC7pVA0+C/zz9Bor8UbcnpqWn0RtpgeZhn0 DdNgj1H2wpiH9AIpEzhdVUaWNtoPOvxkxepN3dIsiaiGgcLJ88ozJxIwjChy+QT0m/ql OXlsFt0T1cjEeutJ6BNVsetO97oU8yaZ86lysnwHFocV5Wq+GvxRvtHtT/PilIvxkE+o Bq1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=7j3Zqroi+dqqNki2TrXDNIqb1hRewMOgWdvC95TlAw4=; b=TMW4vdvdfNrKAQraeFx8t2NIo3AWjg5a6n4yP3XgxKX9PeLM5LtYfP0EZSPZX3KzFy iq1rkO4eQeHxU9ORSSoPXj5mX0cp4WL19Uu9GnX+2Fafr4B0TdmjNbBZAnRu/GYvEG+0 ExHn4bAcRLwbYm9hPzIbwxhzmdLz7as3D327NpsTie+sPHbEvzZ0ziIrbOE55m8HGu6b zM2iGMTmwz8T7ulxOGz1+Xn+vZX1VBJ3R9PqXBbHtgvO5JdQ9r4q1k51Ii0SnqYc+IzQ wAfvBT74bmFgYvAeotoAQntQvD7vntsd+IcV1hm11loA+6/IgP7wmklNphkaTtorIZBc E6WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UvpVkaAv; 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 r20si16931314edd.90.2021.07.12.06.41.33; Mon, 12 Jul 2021 06:41:56 -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=UvpVkaAv; 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 S234677AbhGLNnU (ORCPT + 99 others); Mon, 12 Jul 2021 09:43:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26466 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234464AbhGLNnS (ORCPT ); Mon, 12 Jul 2021 09:43:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626097229; 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=7j3Zqroi+dqqNki2TrXDNIqb1hRewMOgWdvC95TlAw4=; b=UvpVkaAvYItzA9SOOv0Au3xabLo2+b03ed0JF9qglgEbVT7Z7ozlFEMKOa+elPVDIY8QiD iqoMu33tighbH+5fbD3drU6+8xYgvKAh/p0DQoMcSbjWbcJJJ8DtA17do+CEwsIkwiecJu uPAqSHmlp/WWpoqctsl3ucB7S7YeMdc= Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-468-Uz_gX2JyPMiGotl6U1OwMQ-1; Mon, 12 Jul 2021 09:40:28 -0400 X-MC-Unique: Uz_gX2JyPMiGotl6U1OwMQ-1 Received: by mail-io1-f69.google.com with SMTP id m14-20020a5d898e0000b02904f7957d92b5so11820556iol.21 for ; Mon, 12 Jul 2021 06:40:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=7j3Zqroi+dqqNki2TrXDNIqb1hRewMOgWdvC95TlAw4=; b=Gp2lwqhlypwx7p3AZklgrGSxtPTCe2JG25c1IWDmKQ3A6taQGAnUlwMQ4W/+Pp95sa k1B40VVRQruYy14wrNAeC/ZslGhRBtCGwvbrXkw3H9bZ1aWir0urXxF2Jt/9h95+USu4 PS+GkfXvByKlHtBHZbgbIQ3tWqoJpJZFfFTmI7G5yGOpUPvII8UHbXMrxMc5FY8U3bkU uk2LkM0fEQBvR6gX46YEz0p4nu4kFclnX4Q7G4Y7axXgfaC/VDxPy6YxxrddiqkKji7w CiN/JuBjNaVSWXitRULBIDyy6UrJN0gN8jLHQ2rAUVGfh8/dUyfR6GVBIHZ8dzsgp1wL K9Gg== X-Gm-Message-State: AOAM530watmotS4TnGQHQwj/3QJXEcZuD/F4Enn0oi2CZxe3U9z4n13h Cym/Vb62VO38ys5o8iAQ21PTr4HCSOCAgIYUTORp2gLofMrXf6YeaMsJKfAz0DkhFFZyaXjsGF7 3keWogWMBUcof2q4SvV4febE13LfFwn/rA1z58m6W X-Received: by 2002:a92:260f:: with SMTP id n15mr8265677ile.143.1626097227980; Mon, 12 Jul 2021 06:40:27 -0700 (PDT) X-Received: by 2002:a92:260f:: with SMTP id n15mr8265657ile.143.1626097227727; Mon, 12 Jul 2021 06:40:27 -0700 (PDT) MIME-Version: 1.0 References: <20210707081642.95365-1-ihuguet@redhat.com> <0e6a7c74-96f6-686f-5cf5-cd30e6ca25f8@gmail.com> <20210707130140.rgbbhvboozzvfoe3@gmail.com> <4189ac6d-94c9-5818-ae9b-ef22dfbdeb27@redhat.com> In-Reply-To: <4189ac6d-94c9-5818-ae9b-ef22dfbdeb27@redhat.com> From: =?UTF-8?B?w43DsWlnbyBIdWd1ZXQ=?= Date: Mon, 12 Jul 2021 15:40:16 +0200 Message-ID: Subject: Re: [PATCH 1/3] sfc: revert "reduce the number of requested xdp ev queues" To: Jesper Dangaard Brouer Cc: Edward Cree , "David S. Miller" , Jakub Kicinski , ivan@cloudflare.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, brouer@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 9, 2021 at 5:07 PM Jesper Dangaard Brouer wrote: > > I think it's less about that and more about avoiding lock contention. > > If two sources (XDP and the regular stack) are both trying to use a TXQ= , > > and contending for a lock, it's possible that the resulting total > > throughput could be far less than either source alone would get if it > > had exclusive use of a queue. > > There don't really seem to be any good answers to this; any CPU in the > > system can initiate an XDP_REDIRECT at any time and if they can't eac= h > > get a queue to themselves then I don't see how the arbitration can be > > performant. (There is the middle-ground possibility of TXQs shared b= y > > multiple XDP CPUs but not shared with the regular stack, in which cas= e > > if only a subset of CPUs are actually handling RX on the device(s) wi= th > > an XDP_REDIRECTing program it may be possible to avoid contention if > > the core-to-XDP-TXQ mapping can be carefully configured.) > > Yes, I prefer the 'middle-ground' fallback you describe. XDP gets it's > own set of TXQ-queues, and when driver detect TXQ's are less than CPUs > that can redirect packets it uses an ndo_xdp_xmit function that takes a > (hashed) lock (happens per packet burst (max 16)). That's a good idea, which in fact I had already considered, but I had (almost) discarded because I still see there 2 problems: 1. If there are no free MSI-X vectors remaining at all, XDP_TX/REDIRECT will still be disabled. 2. If the amount of free MSI-X vectors is little. Then, many CPUs will be contending for very few queues/locks, not for normal traffic but yes for XDP traffic. If someone wants to intensively use XDP_TX/REDIRECT will get a very poor performance, with no option to get a better tradeoff between normal and XDP traffic. We have to consider that both scenarios are very feasible because this problem appears on machines with a high number of CPUs. Even if support for more channels and queues per channel is added, who knows what crazy numbers for CPU cores we will be using in a few years? And we also have to consider VFs, which usually have much less MSI-X vectors available, and can be assigned to many different configurations of virtual machines. So I think that we still need a last resort fallback of sharing TXQs with network stack: 1. If there are enough resources: 1 queue per CPU for XDP 2. If there are not enough resources, but still a fair amount: many queues dedicated only to XDP, with (hashed) locking contention 3. If there are not free resources, or there are very few: TXQs shared for network core and XDP Of course, there is always the option of tweaking driver and hardware parameters to, for example, increase the amount of resources available. But if the user doesn't use it I think we should give them a good enough tradeoff. If the user doesn't use XDP, it won't be noticeable at all. If he/she intensively uses it and doesn't get the desired performance, he/she will have to tweak parameters. Jesper has tomorrow a workshop in netdevconf where they will speak about this topic. Please let us know if you come up with any good new idea. Regards --=20 =C3=8D=C3=B1igo Huguet