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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 02564C433B4 for ; Fri, 23 Apr 2021 13:44:52 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 44FF061163 for ; Fri, 23 Apr 2021 13:44:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44FF061163 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=isovalent.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FRbBT5nTWz30F9 for ; Fri, 23 Apr 2021 23:44:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=isovalent-com.20150623.gappssmtp.com header.i=@isovalent-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=aSb/o1mV; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=isovalent.com (client-ip=2a00:1450:4864:20::32b; helo=mail-wm1-x32b.google.com; envelope-from=quentin@isovalent.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=isovalent-com.20150623.gappssmtp.com header.i=@isovalent-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=aSb/o1mV; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FRVnc5z6vz2xfh for ; Fri, 23 Apr 2021 20:26:26 +1000 (AEST) Received: by mail-wm1-x32b.google.com with SMTP id n127so13908134wmb.5 for ; Fri, 23 Apr 2021 03:26:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isovalent-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pZC3bOQbN5+fqyuA7H9ye81q8uOWfqddKhA+GXdAbe0=; b=aSb/o1mV8h0CcE9ai+0+GIlXRSGlsJTPumKNmGEJ88Z4i3bGRbY+GZu4y+9bXJ2Ej0 Gnr1pQPVFxw/OkuLgXzy8PcFfaYDEZW1fihUNP/VtK/ltQ5OgS+ABY7Byb2o9rvuH3w9 aiiyIdPgdOTZ+hKQKeseFBSIHuPOG3wEViDcm9o+RO0YnIbhhMqz+iQQf7AY04+ybwHf 2nC4MhrVKh/73RRSCeoHklo+CLEPmhYLF8BmrTl+dusVmM5VfEfslHL7IoEnP1IXaaeU +VlpWeuLfKHGTov0axRspP5fwSgIZ4r+kUdG1PRmBmRYDbmUFoGKlyjNhDcKQj1tRsaO 5EEA== 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=pZC3bOQbN5+fqyuA7H9ye81q8uOWfqddKhA+GXdAbe0=; b=pXtvEvhJVJpc/vSyFc0YMcSquRJKYS4yVjDiRwOMLovsfCRGPGeMLSAy/eEQUzYRbf G6qHy1i1rICA5vFyco7VOehA8zmuMx8QNUxwNYPxyd8kFvpCRvNZ0AnDp95qcaqOy5Z4 UKKUcjcEKFxvS47ev7f2GBbIkfBu2gby6edv+GI8Yo9aY6Uzmfdhq1IgfZwZKwM0mENR hV7ipSuHDBKMVaZnBRZUkRvoJLr4eqokSopMrBe3PC3TGgPt1uEGbrj2JYR8v8YnHd3e 0aRlMs12IVpWGO7Bzk9W3f2+7MxpIsN0wHFrTMKasXeta1s4TjcKS+yYVIyM3OZ9KPsr Qlqw== X-Gm-Message-State: AOAM530TA7DJuhklaLxel6WkV4iS4JMUoSD0hQMqiEUI8xz/IqujX3pH +qUK2aj/3DdbLoOIO5E/Mv7Dwg== X-Google-Smtp-Source: ABdhPJwzRkVz3Ofbfxh8n0buCkcX7vCmdhQBvEZ1KP3t4/FvoWzwFRVeYSa0K9So4C2Yfv4k3szanw== X-Received: by 2002:a1c:b743:: with SMTP id h64mr3431829wmf.35.1619173579445; Fri, 23 Apr 2021 03:26:19 -0700 (PDT) Received: from [192.168.1.8] ([149.86.88.56]) by smtp.gmail.com with ESMTPSA id b15sm8464544wrt.57.2021.04.23.03.26.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Apr 2021 03:26:18 -0700 (PDT) Subject: Re: [PATCH bpf-next 1/2] bpf: Remove bpf_jit_enable=2 debugging mode To: Christophe Leroy , Alexei Starovoitov References: <20210415093250.3391257-1-Jianlin.Lv@arm.com> <9c4a78d2-f73c-832a-e6e2-4b4daa729e07@iogearbox.net> <0dea05ba-9467-0d84-4515-b8766f60318e@csgroup.eu> From: Quentin Monnet Message-ID: <58296f87-ad00-a0f5-954b-2150aa84efc4@isovalent.com> Date: Fri, 23 Apr 2021 11:26:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 23 Apr 2021 23:44:23 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ian Rogers , Song Liu , "open list:DOCUMENTATION" , Zi Shen Lim , Alexei Starovoitov , Russell King , "David S. Miller" , Paul Mackerras , Sandipan Das , "H. Peter Anvin" , sparclinux@vger.kernel.org, Shubham Bansal , Mahesh Bandewar , Will Deacon , linux-riscv , linux-s390 , Ilya Leoshkevich , paulburton@kernel.org, Jonathan Corbet , Mauro Carvalho Chehab , Masahiro Yamada , X86 ML , John Fastabend , Andrii Nakryiko , Christian Borntraeger , Ingo Molnar , Dmitry Vyukov , Catalin Marinas , "Naveen N . Rao" , Jakub Kicinski , Tobias Klauser , grantseltzer@gmail.com, Xi Wang , Albert Ou , Kees Cook , Vasily Gorbik , Luke Nelson , Heiko Carstens , KP Singh , iecedge@gmail.com, Simon Horman , Borislav Petkov , Alexander Viro , Paul Walmsley , Jianlin Lv , Nicolas Dichtel , Palmer Dabbelt , linux-arm-kernel , Wang YanQing , tsbogend@alpha.franken.de, Daniel Borkmann , Hideaki YOSHIFUJI , Network Development , David Ahern , linux-mips@vger.kernel.org, LKML , Yonghong Song , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Thomas Gleixner , bpf , ppc-dev , Martin KaFai Lau Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 2021-04-23 09:19 UTC+0200 ~ Christophe Leroy [...] > I finally managed to cross compile bpftool with libbpf, libopcodes, > readline, ncurses, libcap, libz and all needed stuff. Was not easy but I > made it. Libcap is optional and bpftool does not use readline or ncurses. May I ask how you tried to build it? > > Now, how do I use it ? > > Let say I want to dump the jitted code generated from a call to > 'tcpdump'. How do I do that with 'bpftool prog dump jited' ? > > I thought by calling this line I would then get programs dumped in a way > or another just like when setting 'bpf_jit_enable=2', but calling that > line just provides me some bpftool help text. Well the purpose of this text is to help you find the way to call bpftool to do what you want :). For dumping your programs' instructions, you need to tell bpftool what program to dump: Bpftool isn't waiting until you load a program to dump it, instead you need to load your program first and then tell bpftool to retrieve the instructions from the kernel. To reference your program you could use a pinned path, or first list the programs on your system with "bpftool prog show": # bpftool prog show 138: tracing name foo tag e54c922dfa54f65f gpl loaded_at 2021-02-25T01:32:30+0000 uid 0 xlated 256B jited 154B memlock 4096B map_ids 64 btf_id 235 Then you can use for example the program id displayed on the first line to reference and dump your program: # bpftool prog dump jited id 138 You should find additional documentation under tools/bpf/bpftool/Documentation. > > By the way, I would be nice to have a kernel OPTION that selects all > OPTIONS required for building bpftool. Because you discover them one by > one at every build failure. I had to had CONFIG_IPV6, CONFIG_DEBUG_BTF, > CONFIG_CGROUPS, ... If there could be an option like "Build a 'bpftool' > ready kernel" that selected all those, it would be great. > > Christophe I do not believe any of these are required to build bpftool. Quentin