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=-10.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 4188CC433B4 for ; Wed, 21 Apr 2021 21:39:25 +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 6EEDA601FD for ; Wed, 21 Apr 2021 21:39:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EEDA601FD 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 4FQYpz0gnRz3022 for ; Thu, 22 Apr 2021 07:39:23 +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=Ld1STCns; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=isovalent.com (client-ip=2a00:1450:4864:20::335; helo=mail-wm1-x335.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=Ld1STCns; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 4FQPYc2Ww6z2xZS for ; Thu, 22 Apr 2021 01:27:13 +1000 (AEST) Received: by mail-wm1-x335.google.com with SMTP id t14-20020a05600c198eb029012eeb3edfaeso1522020wmq.2 for ; Wed, 21 Apr 2021 08:27:13 -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=gKdt8Wk+0o9N/o4Eeh7jFivsYAp+6odRUk2hDoOYTNE=; b=Ld1STCnsE1eouA8OovEt+JR3kvLhy+38SIeXNlwIkDlOiLq05bK7Xtf0K9jrzy0JBg l7Vv9cqjwitQLtZanAgbC4FHzf0jZYrRiLFa1aiMF+HviBubCWXTbitrlhIeZgclqfrr rNSiHWguSr/4GVnfTLurIDqrGY85zcHBi1fjyNVIwnwt04M07BxCWghuUhWyyCRBw0PQ kODch46wzB/NfbSZH3OkAXLF7Scy075Euz1AgKCdsC/jqLZFujuUsUSTB9qK2x31ltBH td1grGFzAsMrRdOHHH0QYY+3dvXwt//4U27ImWFpSaFnt7wVbc0SpT/Y+WZBQRPuwY4A rcLg== 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=gKdt8Wk+0o9N/o4Eeh7jFivsYAp+6odRUk2hDoOYTNE=; b=Exh+OZoFB5lEprnWfTKE+oTRT9nDkGtQjRvpXLMTwlYo8TYp5lh8thPRMcHm0ORCdn 3ocNoBUEJIFnCGuJAEVpHglYYqsdthSWo/zVrSjsHZOxNINds8dDB83ej+uvE2qSXtpM w1vpfulbkRckzIkuR7OD5mvtU2aqM3oTTjzjB+Ecj3Lz91NoFJ3meH3Y7dsYYU2GYRHl yS99uARaysQ56JJNuGl4rd5Hfch5GKzo0mGQXcOxIpUoOeKHnpvy+AtqeWNuzLOYwZky 9rE72fSNbICFQneb1nuzJ/DabUpNOdwy45/Xu5h/xaEV/Y9sDfPmpGrJot+/dVgEKaz3 I8rQ== X-Gm-Message-State: AOAM530kLWceGp2fq9ojJM1y47v/NbCSZdVY1Awni1WmmBqcyeim+C3V cZwXO2bXX8mp1ZiVofNnX+quBQ== X-Google-Smtp-Source: ABdhPJx/Z4/wH0IczXzrpu1/+CHFDyPCB4UahTsagrUa+vs9LV/LiT8hoPliplY5euRpNBomq4NZqQ== X-Received: by 2002:a1c:1f8e:: with SMTP id f136mr10451672wmf.17.1619018828018; Wed, 21 Apr 2021 08:27:08 -0700 (PDT) Received: from [192.168.1.8] ([149.86.81.177]) by smtp.gmail.com with ESMTPSA id n2sm3159970wmb.32.2021.04.21.08.27.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Apr 2021 08:27:07 -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> <7dc31256-eb1d-dc93-5e55-2de27475e0c6@csgroup.eu> From: Quentin Monnet Message-ID: Date: Wed, 21 Apr 2021 16:27:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <7dc31256-eb1d-dc93-5e55-2de27475e0c6@csgroup.eu> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 22 Apr 2021 07:38:35 +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-21 15:10 UTC+0200 ~ Christophe Leroy > > > Le 20/04/2021 à 05:28, Alexei Starovoitov a écrit : >> On Sat, Apr 17, 2021 at 1:16 AM Christophe Leroy >> wrote: >>> >>> >>> >>> Le 16/04/2021 à 01:49, Alexei Starovoitov a écrit : >>>> On Thu, Apr 15, 2021 at 8:41 AM Quentin Monnet >>>> wrote: >>>>> >>>>> 2021-04-15 16:37 UTC+0200 ~ Daniel Borkmann >>>>>> On 4/15/21 11:32 AM, Jianlin Lv wrote: >>>>>>> For debugging JITs, dumping the JITed image to kernel log is >>>>>>> discouraged, >>>>>>> "bpftool prog dump jited" is much better way to examine JITed dumps. >>>>>>> This patch get rid of the code related to bpf_jit_enable=2 mode and >>>>>>> update the proc handler of bpf_jit_enable, also added auxiliary >>>>>>> information to explain how to use bpf_jit_disasm tool after this >>>>>>> change. >>>>>>> >>>>>>> Signed-off-by: Jianlin Lv >>>>> >>>>> Hello, >>>>> >>>>> For what it's worth, I have already seen people dump the JIT image in >>>>> kernel logs in Qemu VMs running with just a busybox, not for kernel >>>>> development, but in a context where buiding/using bpftool was not >>>>> possible. >>>> >>>> If building/using bpftool is not possible then majority of selftests >>>> won't >>>> be exercised. I don't think such environment is suitable for any kind >>>> of bpf development. Much so for JIT debugging. >>>> While bpf_jit_enable=2 is nothing but the debugging tool for JIT >>>> developers. >>>> I'd rather nuke that code instead of carrying it from kernel to kernel. >>>> >>> >>> When I implemented JIT for PPC32, it was extremely helpfull. >>> >>> As far as I understand, for the time being bpftool is not usable in >>> my environment because it >>> doesn't support cross compilation when the target's endianess differs >>> from the building host >>> endianess, see discussion at >>> https://lore.kernel.org/bpf/21e66a09-514f-f426-b9e2-13baab0b938b@csgroup.eu/ >>> >>> >>> That's right that selftests can't be exercised because they don't build. >>> >>> The question might be candid as I didn't investigate much about the >>> replacement of "bpf_jit_enable=2 >>> debugging mode" by bpftool, how do we use bpftool exactly for that ? >>> Especially when using the BPF >>> test module ? >> >> the kernel developers can add any amount of printk and dumps to debug >> their code, >> but such debugging aid should not be part of the production kernel. >> That sysctl was two things at once: debugging tool for kernel devs and >> introspection for users. >> bpftool jit dump solves the 2nd part. It provides JIT introspection to >> users. >> Debugging of the kernel can be done with any amount of auxiliary code >> including calling print_hex_dump() during jiting. >> > > I get the following message when trying the command suggested in the > patch message: > > root@vgoip:~# ./bpftool prog dump jited > Error: No libbfd support > > Christophe Hi Christophe, Bpftool relies on libbfd to disassemble the JIT-ed instructions, but this is an optional dependency and your version of bpftool has been compiled without it. You could try to install it on your system (it is usually shipped with binutils, package "binutils-dev" on Ubuntu for example). If you want to cross-compile bpftool, the libbfd version provided by your distribution may not include support for the target architecture. In that case you would have to build libbfd yourself to make sure it supports it. Then you can clean up the results from the libbfd probing: $ make -C tools/build/feature/ clean and recompile bpftool. I hope this helps, Quentin