Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2989984pxb; Mon, 19 Apr 2021 20:30:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB/MEx5rmXxHZb8Wms3MWYUGJXksANzZ+tbZv6G8kxUYir+mAlvvYhPBAGyAq0IJMfuU78 X-Received: by 2002:a63:fb12:: with SMTP id o18mr14587069pgh.438.1618889432096; Mon, 19 Apr 2021 20:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618889432; cv=none; d=google.com; s=arc-20160816; b=BLhLcxIgx6qJbHDIVm+Am47ZTnAe583CIhveFCGMcgg5FRpoqdRouEOX4PKVmNAegJ rJGploZI32mPDQeYM9Uoh/nainFcSx9hSMsqJYEX87K9PqHZZUOjEy8fayvw1utJ9k1R 0MAbrXxYn7A/Jo7RQTzS3luEsKq7hCBaT4QTr/gIX8Ux50IE7/i2luqN+2+xoYaewszb ZflVUF46r7ugtvfSfSuh3CrvgcPeZcrWRpjJld9c1mLtSWyFnMtXSxSSxwks1Z7EHkA/ dFoE3yBH3JP3Fuhrasx1vfsgxiaN2VOL5kD+S5H5FEanZ6B2RN2ejBQwpBDCK7zv4AL2 Jq/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sjA5c4MI/V/Us5khupc3zlEWJtPk9Lba1kHWIn9xqrM=; b=URpaAt/EUBW87Ul7/QjbQhCONIi45I3Q+jpQQby8An9z9pgvITvbvbplgL+LtLBuS0 +5amdPTKYDJH1zi3w0dQD2YFMv/T9//aMrHg9jcgADa2kiP04ECCQa49sb++IUtJWq8G PcSiKNo2pqk6XSVNoWsEwcEMCOKUnMrI81gFY+Z1hOxq0/1FoTD0dp8n9UXiATBexIcV BdvohvlPI483MWuKwsOuPbbvfudquvlWY6+GDZXmK9YLyVx7lhCb9AXi6BTSt6FeVpxa cUAIgC1b1GwUPhx5pPve95SXHG+w/EXzwirY80cuWiUd4456l112r8nJY7ci9JJipYZl B6wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aZSJaNW8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si1615624pjg.144.2021.04.19.20.30.17; Mon, 19 Apr 2021 20:30:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aZSJaNW8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbhDTD30 (ORCPT + 99 others); Mon, 19 Apr 2021 23:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbhDTD3Y (ORCPT ); Mon, 19 Apr 2021 23:29:24 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10933C06174A; Mon, 19 Apr 2021 20:28:54 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id j4so19800989lfp.0; Mon, 19 Apr 2021 20:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sjA5c4MI/V/Us5khupc3zlEWJtPk9Lba1kHWIn9xqrM=; b=aZSJaNW84mZRYAHIY5t88erflreGTdYjaH3FYtF1qHJPn6VWs0jryZT46tcKmPEGha /og/FC8vcGojrzKljv51Y7lWbKJNsViPSNua0KzzWTeHQBaA77mtr8NCMQ4THd2QTzcC W4NX+bAwjkGszUu3wkPlccw0aoYiZjMS+T4JTPsVHoVH+R4TOOISLvGTXFbJ16T+Dgur kbNEKiwtz58pU2SAt4AjUcSxyUGvQb0yQueu6ghHyatn+Cc/mNZXXrnsQvXgxCwKXuNp sZTyXkoz02r+DOAERoaXyqJHUX8rL4MjlDqKs+1CuVe940UruGYC9kE+b/nNTgV9xhkG purg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sjA5c4MI/V/Us5khupc3zlEWJtPk9Lba1kHWIn9xqrM=; b=LgJPb5MBlEKi1REqgkAuvdlJjsp0gQpZhNPuzFcdyfII3Wkdw2WUL93Hhz5Yp/9s/z Zg3K4GmkMz47pxCriTVhhLFa+EON2SMq/RUwepb7LMM7I0nyTU2HjfRMS/O5k2DUF7h6 dYKaMX88np5drCkQ3VCx9WuUfiml+evx0IN99nW0ssu3Vb9/aYOurM+c3WnyiX1Lyejn q7uNJZm6MC/WC35f4g+0UdSpmrkh4zRUSH+bmQZU1DEIARkeRedC9zVo5cTd52D9b2Hz 8Lg8v95BMLJEnyFKvMm+eBXFz/WhbJ0o918UxMIpL4vwo2eI8q+SZCX0nZ1SqGGk/LrS Exkw== X-Gm-Message-State: AOAM530Nb75ftxe060+0oeBb+vVmav6/Y7uUN3xTz1ok6Q2Z0C9FT6Bl CF9Mupz/vZH60+Tz8lPd7DAow43Kjj+6XiluqSo= X-Received: by 2002:ac2:510d:: with SMTP id q13mr13835296lfb.75.1618889332453; Mon, 19 Apr 2021 20:28:52 -0700 (PDT) MIME-Version: 1.0 References: <20210415093250.3391257-1-Jianlin.Lv@arm.com> <9c4a78d2-f73c-832a-e6e2-4b4daa729e07@iogearbox.net> <0dea05ba-9467-0d84-4515-b8766f60318e@csgroup.eu> In-Reply-To: <0dea05ba-9467-0d84-4515-b8766f60318e@csgroup.eu> From: Alexei Starovoitov Date: Mon, 19 Apr 2021 20:28:41 -0700 Message-ID: Subject: Re: [PATCH bpf-next 1/2] bpf: Remove bpf_jit_enable=2 debugging mode To: Christophe Leroy 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" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 discour= aged, > >>>> "bpftool prog dump jited" is much better way to examine JITed dumps. > >>>> This patch get rid of the code related to bpf_jit_enable=3D2 mode an= d > >>>> update the proc handler of bpf_jit_enable, also added auxiliary > >>>> information to explain how to use bpf_jit_disasm tool after this cha= nge. > >>>> > >>>> 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 wo= n'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=3D2 is nothing but the debugging tool for JIT deve= lopers. > > 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 en= vironment because it > doesn't support cross compilation when the target's endianess differs fro= m 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 repla= cement of "bpf_jit_enable=3D2 > debugging mode" by bpftool, how do we use bpftool exactly for that ? Espe= cially 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 user= s. Debugging of the kernel can be done with any amount of auxiliary code including calling print_hex_dump() during jiting.