Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp378175pxt; Wed, 4 Aug 2021 13:40:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWku9oDSjF3A9iPbR1DNKmHo/5mJyyWjCQlPgQIwAuSMQAn6S83NmGqPI96IPV27DADLjN X-Received: by 2002:a17:907:3e1b:: with SMTP id hp27mr1053465ejc.116.1628109627575; Wed, 04 Aug 2021 13:40:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628109627; cv=none; d=google.com; s=arc-20160816; b=zEMN99spyS8v/yx3OANjLVBLaMKvka7GRTo4o5VDqdoQvtjF/GDF3Hq5x5tYAvKptM dqjnMlMqZymXYPfFsC+Veb/6n9rC68g6dt0yB45hSyq42NrmahB6fjMm5z4vRn8Xs8ZD EyVv6YvoFkhbuCRrLdbmSQ9YSs3xIg7Den2c0YPv4YonKfrV02u1rc6s4gFS+Z9ctFOQ 9qtGBynJ/BdXcIpZofLGXiO3CBjFxIBhDVOA09DoQvzhiD42tmmJyxE5tWHEALsUzbSr bWsGsL6Inwb93HzhwxRXa2YO8cXv0EIqP8Kx4877lgjK62KYoofLBODgyEHRz2Y5uga/ /uCA== 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:from:references :cc:to:subject:dkim-signature; bh=1gu89wY9LreYODHlzcyea31Rq8lJ9lifCsibkahK734=; b=hmiediRaFtoXKf/KwieLj6GQJsfxSAOnbZAAAUEFgN5jlIc7Eq0K50yyJ4ZaYSDvzX 79VsaSNTy+GfE89LHqxIOCNoEzygrp64mHJ444O5Joyp0jxUm8FFKX3SdIRh1Ne3OJxg ijl7gD96ev4L+kwt1LDtIPWiY6oK68HcK2jMEnozN1Em6bLiyEzQ595ltj3vEUoRkJrL XgR8EmAZfSzzWnCNujuAoasUF3fMNrY/tr0it+JLPry4/ctQ8QUpFEF06K639DE08BE0 TvyFd9s3CK3BTcn0Xyt1MDgXTyQXtrmS75MqZMEt2cmw4JEiRMvMWqjP5rOc5ny/q36L Y9CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=twallvAm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si3804316ejy.328.2021.08.04.13.39.35; Wed, 04 Aug 2021 13:40:27 -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=@gmail.com header.s=20161025 header.b=twallvAm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239940AbhHDR2w (ORCPT + 99 others); Wed, 4 Aug 2021 13:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239975AbhHDR2s (ORCPT ); Wed, 4 Aug 2021 13:28:48 -0400 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CFE5C06179A; Wed, 4 Aug 2021 10:28:33 -0700 (PDT) Received: by mail-ot1-x334.google.com with SMTP id a5-20020a05683012c5b029036edcf8f9a6so2337772otq.3; Wed, 04 Aug 2021 10:28:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1gu89wY9LreYODHlzcyea31Rq8lJ9lifCsibkahK734=; b=twallvAmbFxBl9Z6qyLi8tqJmCVWfRSu/r/bTsFejuxvtLNsGrdH36quktEn8bDI+f gDUiowVe2a0q9gRWDDvzbWNLcm0YPIHYtEcKjx3LWpHkjO1VMuXLmq1JGO8Wbh08dPuU WijtEETtWIn8YQmPUOaTBpfBLNnFlD0us43hrTvzZe12eO8kkPqBTfFEMkP9SoZksxfw mFpegkN7IiZ2ZzbSWutYBzy9TESGxJC5cr0ITIkkuyY+WPUbdtDzUlLPmjPuVt8jbTuc TTlAd7VxK0h+dgZHGDQt/wHli10k0oluN271z2YqbNgFZ56E+kmYRNNR6KOq/mgAMO8A NOyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1gu89wY9LreYODHlzcyea31Rq8lJ9lifCsibkahK734=; b=lFsm9OMPE2+KSGlQo5AGyDn+YvA+bC5TZqpbtHkrTvJOIrOoGhvNaPMSvCxPqMvFZt M2b/pvyykxt+ITQbX+n2nqDCx3xNJPqNs64ZedD0OHiaOIah2qOK9sdO0n3k8Rk6BVcz AkQckkoT4pf3lOqVCJZ1f6qR4Tcctlt/mJ0f5WoH6KhDD11hcr99XEYrBPtx77/w4YgA 2zEjtiyrR1VrYY52Uk2jAuTnjDUnFagacT+bsQfp5lA1U5nMhLU2+xFgd1wE21OnvF0s 83MF7+TFAo/UZDgrJSGWl16tfKdh1wsyQMdcq6S01b+Ai7N53blrUAHI3qPTzcKgZdXr 8y9g== X-Gm-Message-State: AOAM532cAm5HA4xAEnECrz0SQHscoAR5FHa1ZWQwyc+EoWLsKg1T8DWd UL3xgAgLKZxtGCdLg1LaFKzy3IjdMxR2Og== X-Received: by 2002:a9d:7550:: with SMTP id b16mr623424otl.309.1628098112834; Wed, 04 Aug 2021 10:28:32 -0700 (PDT) Received: from Davids-MacBook-Pro.local ([8.48.134.45]) by smtp.googlemail.com with ESMTPSA id r25sm418421oos.24.2021.08.04.10.28.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Aug 2021 10:28:32 -0700 (PDT) Subject: Re: [PATCH net-next 03/21] ethtool, stats: introduce standard XDP statistics To: Jakub Kicinski Cc: Saeed Mahameed , Alexander Lobakin , "David S. Miller" , Jesse Brandeburg , Lukasz Czapnik , Marcin Kubiak , Michal Kubiak , Michal Swiatkowski , Jonathan Corbet , Netanel Belgazal , Arthur Kiyanovski , Guy Tzalik , Saeed Bishara , Ioana Ciornei , Claudiu Manoil , Thomas Petazzoni , Marcin Wojtas , Russell King , Edward Cree , Martin Habets , "Michael S. Tsirkin" , Jason Wang , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Shay Agroskin , Sameeh Jubran , Alexander Duyck , Danielle Ratson , Ido Schimmel , Andrew Lunn , Vladyslav Tarasiuk , Arnd Bergmann , Andrew Morton , Jian Shen , Petr Vorel , Dan Murphy , Yangbo Lu , Michal Kubecek , Zheng Yongjun , Heiner Kallweit , YueHaibing , Johannes Berg , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, bpf@vger.kernel.org References: <20210803163641.3743-1-alexandr.lobakin@intel.com> <20210803163641.3743-4-alexandr.lobakin@intel.com> <20210803134900.578b4c37@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20210804053650.22aa8a5b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <43e91ce1-0f82-5820-7cac-b42461a0311a@gmail.com> <20210804094432.08d0fa86@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> From: David Ahern Message-ID: Date: Wed, 4 Aug 2021 11:28:28 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210804094432.08d0fa86@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/4/21 10:44 AM, Jakub Kicinski wrote: > On Wed, 4 Aug 2021 10:17:56 -0600 David Ahern wrote: >> On 8/4/21 6:36 AM, Jakub Kicinski wrote: >>>> XDP is going to always be eBPF based ! why not just report such stats >>>> to a special BPF_MAP ? BPF stack can collect the stats from the driver >>>> and report them to this special MAP upon user request. >>> Do you mean replacing the ethtool-netlink / rtnetlink etc. with >>> a new BPF_MAP? I don't think adding another category of uAPI thru >>> which netdevice stats are exposed would do much good :( Plus it >>> doesn't address the "yet another cacheline" concern. >>> >>> To my understanding the need for stats recognizes the fact that (in >>> large organizations) fleet monitoring is done by different teams than >>> XDP development. So XDP team may have all the stats they need, but the >>> team doing fleet monitoring has no idea how to get to them. >>> >>> To bridge the two worlds we need a way for the infra team to ask the >>> XDP for well-defined stats. Maybe we should take a page from the BPF >>> iterators book and create a program type for bridging the two worlds? >>> Called by networking core when duping stats to extract from the >>> existing BPF maps all the relevant stats and render them into a well >>> known struct? Users' XDP design can still use a single per-cpu map with >>> all the stats if they so choose, but there's a way to implement more >>> optimal designs and still expose well-defined stats. >>> >>> Maybe that's too complex, IDK. >> >> I was just explaining to someone internally how to get stats at all of >> the different points in the stack to track down reasons for dropped packets: >> >> ethtool -S for h/w and driver >> tc -s for drops by the qdisc >> /proc/net/softnet_stat for drops at the backlog layer >> netstat -s for network and transport layer >> >> yet another command and API just adds to the nightmare of explaining and >> understanding these stats. > > Are you referring to RTM_GETSTATS when you say "yet another command"? > RTM_GETSTATS exists and is used by offloads today. > > I'd expect ip -s (-s) to be extended to run GETSTATS and display the xdp > stats. (Not sure why ip -s was left out of your list :)) It's on my diagram, and yes, forgot to add it here. > >> There is real value in continuing to use ethtool API for XDP stats. Not >> saying this reorg of the XDP stats is the right thing to do, only that >> the existing API has real user benefits. > > RTM_GETSTATS is an existing API. New ethtool stats are intended to be HW > stats. I don't want to go back to ethtool being a dumping ground for all > stats because that's what the old interface encouraged. driver stats are important too. e.g., mlx5's cache stats and per-queue stats. > >> Does anyone have data that shows bumping a properly implemented counter >> causes a noticeable performance degradation and if so by how much? You >> mention 'yet another cacheline' but collecting stats on stack and >> incrementing the driver structs at the end of the napi loop should not >> have a huge impact versus the value the stats provide. > > Not sure, maybe Jesper has some numbers. Maybe Intel folks do? I just ran some quick tests with my setup and measured about 1.2% worst case. Certainly not exhaustive. Perhaps Intel or Mellanox can provide numbers for their high speed nics - e.g. ConnectX-6 and a saturated host. > > I'm just allergic to situations when there is a decision made and > then months later patches are posted disregarding the decision, > without analysis on why that decision was wrong. And while the > maintainer who made the decision is on vacation. > stats is one of the many sensitive topics. I have been consistent in defending the need to use existing APIs and tooling and not relying on XDP program writers to add the relevant stats and then provide whatever tool is needed to extract and print them. Standardization for fundamental analysis tools.