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=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 F2AEEC43460 for ; Wed, 21 Apr 2021 16:30:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA7BA61445 for ; Wed, 21 Apr 2021 16:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244333AbhDUQaf (ORCPT ); Wed, 21 Apr 2021 12:30:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235145AbhDUQae (ORCPT ); Wed, 21 Apr 2021 12:30:34 -0400 Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F4AC06174A; Wed, 21 Apr 2021 09:29:59 -0700 (PDT) Received: by mail-il1-x133.google.com with SMTP id c4so8860917ilq.9; Wed, 21 Apr 2021 09:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=kZEeiT+02hDVJRhO51gnJpF7hYzhozQfqmgkPQR+2go=; b=RCvSbC5gF4irYRxbKtCXq6ucAmn/fBlZPcmxc5StJjv0OsgtmawKZzSRMOt9KwaVfB mOterPVI+uca5uIZicYzxPVaYRAjch0dVaykdoLqmfnumz1qeSndgLTPIM5A88GuAh16 kY60ERydmvvHQ8SECatQeY+fvihLUbYrM61BxVEcAV4K+xfLjiZrTMwPk+MtsJVT2Zr6 GOZv43s51r2l+BrbedzeIDb4y3VrRbbDk8nnNp+fNSeMWAnjMPVM6JYQO/h4ai6vqwLR UCr2zI9SxvzesSwPuDXcovg8tK5WkZn8XccEKEIg0LxS0AurB5NZT/Bi0RNt9J0flU4S ysDg== 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:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=kZEeiT+02hDVJRhO51gnJpF7hYzhozQfqmgkPQR+2go=; b=LGFDSbNPq1gf/rK+UPmEorDkOeFw4LOj+j8juXF4Dg4lA37nUOOl3sByLXMTrnWHQc hBM0vRjY+dV+NOwWU08w+PpwDU2OgPm6mBzFfBjNzqpDrcvnLuBl8UDJRbbu3EiCoRFM HUe4p6lgkV+21HeN1vvXNy5y50hvL1iRUdz6/Ftydi6FIqBaw2gYQQE8CmyTJrDgekDx Fyi7rA9bdUE9vLvewlJp3YLFmlNONbXbBtFeagHr06/OWUZGfD9Yvl0aUzEAWuiUrlLm RrtF8fCAdi3fEgpImsSmuUD7qM/9DAsho21L6b1DKECc5U+/QhM7o7fiUcsNmKeJdajZ tvig== X-Gm-Message-State: AOAM5312Msjljx61MNr6hFgZTispHkNvHFNG0/ZKd8tuZJZUME5PKeNK 7WcYBtJH+kThXase1XwC6x0= X-Google-Smtp-Source: ABdhPJz7ul05BAWC6HoOuLc6EjCX5ztWUgfj1SHdCI0SDk1nQOPXDNy1tG/R5d8sRRgMhivItaOuEA== X-Received: by 2002:a92:ce0e:: with SMTP id b14mr25946343ilo.283.1619022599257; Wed, 21 Apr 2021 09:29:59 -0700 (PDT) Received: from localhost ([172.242.244.146]) by smtp.gmail.com with ESMTPSA id v26sm1303125ioh.42.2021.04.21.09.29.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 09:29:58 -0700 (PDT) Date: Wed, 21 Apr 2021 09:29:50 -0700 From: John Fastabend To: Christophe Leroy , Alexei Starovoitov Cc: Quentin Monnet , Ian Rogers , Song Liu , "open list:DOCUMENTATION" , Zi Shen Lim , Paul Walmsley , Alexei Starovoitov , Andrii Nakryiko , Paul Mackerras , Sandipan Das , "H. Peter Anvin" , sparclinux@vger.kernel.org, Shubham Bansal , Mahesh Bandewar , Will Deacon , Nicolas Dichtel , linux-s390 , Ilya Leoshkevich , paulburton@kernel.org, Jonathan Corbet , Mauro Carvalho Chehab , Masahiro Yamada , X86 ML , John Fastabend , Russell King , linux-riscv , Christian Borntraeger , Ingo Molnar , linux-arm-kernel , Catalin Marinas , "Naveen N . Rao" , Jakub Kicinski , Tobias Klauser , linux-mips@vger.kernel.org, grantseltzer@gmail.com, Xi Wang , Albert Ou , Kees Cook , Vasily Gorbik , Luke Nelson , LKML , Heiko Carstens , ppc-dev , KP Singh , iecedge@gmail.com, Simon Horman , Borislav Petkov , Alexander Viro , Yonghong Song , Thomas Gleixner , Dmitry Vyukov , tsbogend@alpha.franken.de, Daniel Borkmann , Hideaki YOSHIFUJI , Network Development , David Ahern , Wang YanQing , Martin KaFai Lau , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Palmer Dabbelt , bpf , Jianlin Lv , "David S. Miller" Message-ID: <608052fea86fb_46b92087@john-XPS-13-9370.notmuch> In-Reply-To: <7dc31256-eb1d-dc93-5e55-2de27475e0c6@csgroup.eu> 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> Subject: Re: [PATCH bpf-next 1/2] bpf: Remove bpf_jit_enable=2 debugging mode Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org Christophe Leroy wrote: > = > = > Le 20/04/2021 =C3=A0 05:28, Alexei Starovoitov a =C3=A9crit=C2=A0: > > On Sat, Apr 17, 2021 at 1:16 AM Christophe Leroy > > wrote: > >> > >> > >> > >> Le 16/04/2021 =C3=A0 01:49, Alexei Starovoitov a =C3=A9crit : > >>> 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 dis= couraged, > >>>>>> "bpftool prog dump jited" is much better way to examine JITed du= mps. > >>>>>> This patch get rid of the code related to bpf_jit_enable=3D2 mod= e 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 kerne= l > >>>> development, but in a context where buiding/using bpftool was not > >>>> possible. > >>> > >>> If building/using bpftool is not possible then majority of selftest= s won't > >>> be exercised. I don't think such environment is suitable for any ki= nd > >>> of bpf development. Much so for JIT debugging. > >>> While bpf_jit_enable=3D2 is nothing but the debugging tool for JIT = developers. > >>> I'd rather nuke that code instead of carrying it from kernel to ker= nel. > >>> > >> > >> 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 differ= s from the building host > >> endianess, see discussion at > >> https://lore.kernel.org/bpf/21e66a09-514f-f426-b9e2-13baab0b938b@csg= roup.eu/ > >> > >> That's right that selftests can't be exercised because they don't bu= ild. > >> > >> The question might be candid as I didn't investigate much about the = replacement of "bpf_jit_enable=3D2 > >> 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 an= d > > introspection for users. > > bpftool jit dump solves the 2nd part. It provides JIT introspection t= o 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 pa= tch message: > = > root@vgoip:~# ./bpftool prog dump jited > Error: No libbfd support > = > Christophe Seems your bpftool prog was built without libbfd, can you rebuild with li= bbfd installed. .John