From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D076EC43387 for ; Wed, 16 Jan 2019 17:15:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9106220651 for ; Wed, 16 Jan 2019 17:15:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=fomichev-me.20150623.gappssmtp.com header.i=@fomichev-me.20150623.gappssmtp.com header.b="g1v1nmfP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727031AbfAPRPt (ORCPT ); Wed, 16 Jan 2019 12:15:49 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:37605 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726732AbfAPRPt (ORCPT ); Wed, 16 Jan 2019 12:15:49 -0500 Received: by mail-pg1-f195.google.com with SMTP id c25so3102015pgb.4 for ; Wed, 16 Jan 2019 09:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fomichev-me.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DX+hYpKIMdfktxZA4S3urTdFjJ2f1U5MtxeEQJpu2jA=; b=g1v1nmfPNR9tPyuhKH/yrqm0h8suQn6IGhPQgtJTJalmr1kwQKZugQ+hUq5XuN1I2J wr8sXD1o8hcuY7ArjzVXiSdMfNwYrHw21QnPGv2KtMN08gCdu1L+QT4BVhFrUV031xK6 biSbNPVBg6eleaQk1lE0wOVCf0cvTDOPxR9abPVmkCfBYHThtSZqoTqYJY7/kHfmElGY NlXfUBt5iW3HQv3yG2Z2HPBPIwWT6MWeAAGfXjcJEWLuiERbNLIRo3d/Y5gNkbc+kPno 6yF9T7Ys5Kea4j5k4KzhM71HgULTmiHZsqvgPGWzgr3F0no4xXISSce0BCfxpjAYKp6A KGAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DX+hYpKIMdfktxZA4S3urTdFjJ2f1U5MtxeEQJpu2jA=; b=EnPwOeIjfYM9u0Ehf97ag06kJJ2fr+lGtCluCOA0+9sDcvf8BWTRXUfq3SDjKBBChY arZfTW2bo2gboH+GKnCfcgCosMJSDOM9Hgkn96H/ec5xaju9Nu9WwT3VPF2dz6OJ+5St 0loBIlFsFEmeQ6/rU1zISrX6Fcp7rno3qZ/HRST9Tip1FzLp3kBsO5t2/E2lfUBVYMPV nsTWKBALevcTVlSCcjlMo+ONAMjcAa73K1NN8BXzM9BzExxw/Zu0fLBZ4pSBxJioN50l 3o/8ZDxncDYik9dbocScXjywt7A+fSYFjQpiBvb8E2r7+qUTgXDm0q1H9xIha7rIyxXn 1hLg== X-Gm-Message-State: AJcUukdno1/5jing+VmNhzFDI2wCSZKl+thT6WU97o7N7bP85EbQ3Wzj 8NeA4XkMQggyn7yg2VtcOCHG1Q== X-Google-Smtp-Source: ALg8bN4CQfxAkdhMqsQmBkbxtO1qiILnlmrpVZQFOK7IL7laWOVXYD9Sirw/fNFgWlrRgNh9LVwYHw== X-Received: by 2002:a63:a84a:: with SMTP id i10mr9941157pgp.263.1547658947556; Wed, 16 Jan 2019 09:15:47 -0800 (PST) Received: from localhost ([2601:646:8f00:18d9:d0fa:7a4b:764f:de48]) by smtp.gmail.com with ESMTPSA id y5sm13349678pge.49.2019.01.16.09.15.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 09:15:46 -0800 (PST) Date: Wed, 16 Jan 2019 09:15:45 -0800 From: Stanislav Fomichev To: Quentin Monnet Cc: Alexei Starovoitov , Daniel Borkmann , netdev@vger.kernel.org, oss-drivers@netronome.com, Arnaldo Carvalho de Melo , Jesper Dangaard Brouer , Stanislav Fomichev Subject: Re: [PATCH bpf-next v4 0/9] tools: bpftool: add probes for system and device Message-ID: <20190116171545.GE726@mini-arch> References: <20190116142119.8358-1-quentin.monnet@netronome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190116142119.8358-1-quentin.monnet@netronome.com> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 01/16, Quentin Monnet wrote: > Hi, > This set adds a new command to bpftool in order to dump a list of > eBPF-related parameters for the system (or for a specific network > device) to the console. Once again, this is based on a suggestion from > Daniel. > > At this time, output includes: > > - Availability of bpf() system call > - Availability of bpf() system call for unprivileged users > - JIT status (enabled or not, with or without debugging traces) > - JIT hardening status > - JIT kallsyms exports status > - Global memory limit for JIT compiler for unprivileged users > - Status of kernel compilation options related to BPF features > - Availability of known eBPF program types > - Availability of known eBPF map types > - Availability of known eBPF helper functions > > There are three different ways to dump this information at this time: > > - Plain output dumps probe results in plain text. It is the most > flexible options for providing descriptive output to the user, but > should not be relied upon for parsing the output. > - JSON output is supported. > - A third mode, available through the "macros" keyword appended to the > command line, dumps some of those parameters (not all) as a series of > "#define" directives, that can be included into a C header file for > example. > > Probes for supported program and map types, and supported helpers, are > directly added to libbpf, so that other applications (or selftests) can > reuse them as necessary. > > If the user does not have root privileges (or more precisely, the > CAP_SYS_ADMIN capability) detection will be erroneous for most > parameters. Therefore, forbid non-root users to run the command. > > v4: > - Probe bpf_jit_limit parameter (patch 2). > - Probe some additional kernel config options (patch 3). > - Minor fixes on patch 6. Looks great! For the whole series: Reviewed-by: Stanislav Fomichev > > v3: > - Do not probe kernel version in bpftool (just retrieve it to probe support > for kprobes in libbpf). > - Change the way results for helper support is displayed: now one list of > compatible helpers for each program type (and C-style output gets a > HAVE_PROG_TYPE_HELPER(prog_type, helper) macro to help with tests. See > patches 6, 7. > - Address other comments from feedback from v2 (please refer to individual > patches' history). > > v2 (please also refer to individual patches' history): > - Move probes for prog/map types, helpers, from bpftool to libbpf. > - Move C-style output as a separate patch, and restrict it to a subset of > collected information (bpf() availability, prog/map types, helpers). > - Now probe helpers with all supported program types, and display a list of > compatible program types (as supported on the system) for each helper. > - NOT addressed: grouping compilation options for kernel into subsections > (patch 3) (I don't see an easy way of grouping them at the moment, please > see also the discussion on v1 thread). > > Cc: Arnaldo Carvalho de Melo > Cc: Jesper Dangaard Brouer > Cc: Stanislav Fomichev > > Quentin Monnet (9): > tools: bpftool: add basic probe capability, probe syscall availability > tools: bpftool: add probes for /proc/ eBPF parameters > tools: bpftool: add probes for kernel configuration options > tools: bpftool: add probes for eBPF program types > tools: bpftool: add probes for eBPF map types > tools: bpftool: add probes for eBPF helper functions > tools: bpftool: add C-style "#define" output for probes > tools: bpftool: add probes for a network device > tools: bpftool: add bash completion for bpftool probes > > .../bpftool/Documentation/bpftool-cgroup.rst | 1 + > .../bpftool/Documentation/bpftool-feature.rst | 85 ++ > .../bpf/bpftool/Documentation/bpftool-map.rst | 1 + > .../bpf/bpftool/Documentation/bpftool-net.rst | 1 + > .../bpftool/Documentation/bpftool-perf.rst | 1 + > .../bpftool/Documentation/bpftool-prog.rst | 1 + > tools/bpf/bpftool/Documentation/bpftool.rst | 1 + > tools/bpf/bpftool/bash-completion/bpftool | 19 + > tools/bpf/bpftool/feature.c | 764 ++++++++++++++++++ > tools/bpf/bpftool/main.c | 3 +- > tools/bpf/bpftool/main.h | 4 + > tools/bpf/bpftool/map.c | 4 +- > tools/lib/bpf/Build | 2 +- > tools/lib/bpf/libbpf.h | 14 + > tools/lib/bpf/libbpf.map | 3 + > tools/lib/bpf/libbpf_probes.c | 242 ++++++ > 16 files changed, 1143 insertions(+), 3 deletions(-) > create mode 100644 tools/bpf/bpftool/Documentation/bpftool-feature.rst > create mode 100644 tools/bpf/bpftool/feature.c > create mode 100644 tools/lib/bpf/libbpf_probes.c > > -- > 2.17.1 >