Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp199296pxt; Wed, 4 Aug 2021 08:59:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmhfwTMQ7b/EjtWQkPgqH7QGSEeWJC8W7P/SZ91ZJ5wZGGa8NASETNR48KJa2kmadsM9Ic X-Received: by 2002:a05:6402:270f:: with SMTP id y15mr505494edd.65.1628092771119; Wed, 04 Aug 2021 08:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628092771; cv=none; d=google.com; s=arc-20160816; b=snvR4z0TPuvR1/qZAUNVMyYJbMHW0cWgQ2tJmrtA+UiOnhY8xRIwzoSJUSpIU3Vabu kLNNOPpBT1c/tyeUaInQEbYuVbAlrr79RJwvgLiCTJal6uBQ/364ME7XMD19faPuQ++m tgaQQuKweq9cvK86RRdmyzEBARVK2Q6AL4xlj2fy8zblEXcDVrB5hx77ezuWMP0bHRyF JKDOaYXlUDlie3QM1ZoLr5rSricwWfRGJKeehTOrkaJZ+yW1BaAuI2veqdB33UJxAicP Oqvcho4dHxX+AK1Lc6CKjzeOT4F3hW4KtodTsFG7SwtOfGn7qIagTJjWo4Cbs/Xen0DM unRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oJQ3L424PVZNHmGG3IcDWs0hLLDaLaDWR0w/Tpzrk+Y=; b=Cu+/+teL7TM3Od67IL5O7lHncaLO+tuKp++iuULpms0tJAFdJ3q8JRWkZ3hM0Gtgqc B3SNjjW2urTy+iUK8QHmAHLytHPi8n/8zSr+xRDR0eRthfNLXRpnUlZkP8KhJ5nkPyQ2 vf420pK5vez1Zh5rhRZLcZbtupTs6FS672vTupkJvV2wOEp1EDoCZ/joGwdZ1eKaZ3c6 DZlOi25gt+bclhgFysq6Eb+/tMCQftb/lYf8C0WAMCKhor8NemQSv5XZ1ro6fN69hP0T wxe3wPDDylAGwxVg+mYB6kqTOea1kxeDxK7JKgqzkiwMOtiM2dpwrCtEY38GuoecHA2X 3dXQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si2591984eje.573.2021.08.04.08.59.06; Wed, 04 Aug 2021 08:59:31 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239645AbhHDPyA (ORCPT + 99 others); Wed, 4 Aug 2021 11:54:00 -0400 Received: from mga04.intel.com ([192.55.52.120]:1307 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239692AbhHDPx4 (ORCPT ); Wed, 4 Aug 2021 11:53:56 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10066"; a="212087308" X-IronPort-AV: E=Sophos;i="5.84,294,1620716400"; d="scan'208";a="212087308" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2021 08:53:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,294,1620716400"; d="scan'208";a="441798957" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga007.fm.intel.com with ESMTP; 04 Aug 2021 08:53:34 -0700 Received: from alobakin-mobl.ger.corp.intel.com (kswiecic-MOBL.ger.corp.intel.com [10.213.28.10]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 174FrTiQ022328; Wed, 4 Aug 2021 16:53:29 +0100 From: Alexander Lobakin To: Jakub Kicinski Cc: Alexander Lobakin , "David S. Miller" , Jesse Brandeburg , Lukasz Czapnik , Marcin Kubiak , Michal Kubiak , Michal Swiatkowski , Jonathan Corbet , Netanel Belgazal , Arthur Kiyanovski , 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 , Alexander Duyck , Danielle Ratson , Ido Schimmel , Andrew Lunn , Arnd Bergmann , Andrew Morton , Jian Shen , Petr Vorel , 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 Subject: Re: [PATCH net-next 03/21] ethtool, stats: introduce standard XDP statistics Date: Wed, 4 Aug 2021 17:53:27 +0200 Message-Id: <20210804155327.337-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210804053650.22aa8a5b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> 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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski Date: Wed, 4 Aug 2021 05:36:50 -0700 > On Tue, 03 Aug 2021 16:57:22 -0700 Saeed Mahameed wrote: > > On Tue, 2021-08-03 at 13:49 -0700, Jakub Kicinski wrote: > > > On Tue, 3 Aug 2021 18:36:23 +0200 Alexander Lobakin wrote: > > > > Most of the driver-side XDP enabled drivers provide some statistics > > > > on XDP programs runs and different actions taken (number of passes, > > > > drops, redirects etc.). > > > > > > Could you please share the statistics to back that statement up? > > > Having uAPI for XDP stats is pretty much making the recommendation > > > that drivers should implement such stats. The recommendation from > > > Alexei and others back in the day (IIRC) was that XDP programs should > > > implement stats, not the drivers, to avoid duplication. Well, 20+ patches in the series with at least half of them is drivers conversion. Plus mlx5. Plus we'll about to land XDP statistics for all Intel drivers, just firstly need to get a common infra for them (the purpose of this series). Also, introducing IEEE and rmon stats didn't make a statement that all drivers should really expose them, right? > > There are stats "mainly errors*" that are not even visible or reported > > to the user prog, Not really. Many drivers like to count the number of redirects, xdp_xmits and stuff (incl. mlx5). Nevertheless, these stats aren't the same as something you can get from inside an XDP prog, right. > Fair point, exceptions should not be performance critical. > > > for that i had an idea in the past to attach an > > exception_bpf_prog provided by the user, where driver/stack will report > > errors to this special exception_prog. > > Or maybe we should turn trace_xdp_exception() into a call which > unconditionally collects exception stats? I think we can reasonably > expect the exception_bpf_prog to always be attached, right? trace_xdp_exception() is again a error path, and would restrict us to have only "bad" statistics. > > > > Regarding that it's almost pretty the same across all the drivers > > > > (which is obvious), we can implement some sort of "standardized" > > > > statistics using Ethtool standard stats infra to eliminate a lot > > > > of code and stringsets duplication, different approaches to count > > > > these stats and so on. > > > > > > I'm not 100% sold on the fact that these should be ethtool stats. > > > Why not rtnl_fill_statsinfo() stats? Current ethtool std stats are > > > all pretty Ethernet specific, and all HW stats. Mixing HW and SW > > > stats > > > is what we're trying to get away from. I was trying to introduce as few functional changes as possible, including that all the current drivers expose XDP stats through Ethtool. I don't say it's a 100% optimal way, but lots of different scripts and monitoring tools are already based on this fact and there can be some negative impact. There'll be for sure due to that std stats is a bit different thing and different drivers count and name XDP stats differently (breh). BTW, I'm fine with rtnl xstats. A nice reminder, thanks. If there won't be much cons like "don't touch our Ethtool stats", I would prefer this one instead of Ethtool standard stats way. > > 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. + this makes obtaining/tracking the statistics much harder. For now, all you need is `ethtool -S devname` (mainline) or `ethtool -S devname --groups xdp` (this series), and obtaining rtnl xstats is just a different command to invoke. BPF_MAP-based stats are a completely different story then. > 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. Thanks, Al