Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1417955rwo; Wed, 2 Aug 2023 13:51:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlEy1WxNjP6OrArrlFfu27nnyvGlUTqb3Tc6HYu+35y7omoQR6sMjNUc7p313Y811CqjWQTS X-Received: by 2002:a17:903:22c1:b0:1b8:b2c6:7e8d with SMTP id y1-20020a17090322c100b001b8b2c67e8dmr19467047plg.66.1691009486357; Wed, 02 Aug 2023 13:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691009486; cv=none; d=google.com; s=arc-20160816; b=IU5oyJTDcFA5x3K5i5rcUA5cYLywSEDqO6+p6hvcmETsFduG/h6Ype0zYuwDJUnDPT 2y2FjxGgPx7E5tXGcL+S6DIiGss2Kmrmu44E9k/a452tWB194rxZBLwRIMEANo1oDNh1 1d5lJ1fSiCcFTSezr4FAZP67IGt+90rgM5AkxHT6NVXa5U+gD4i5ho7udxiM9kuL/vJL XyqtMooB/lCOVlrv6VNY2BFVq/4Xt8NE14arpCBI2ekgKPfNS9OYkMgQMB3q42zW4OQL 2Cat6QNwVLzcLdvnzvYoEo6xgdip9jsRv0nKI3NHPfhmN1Dy5tx/MIBbhFI8eo1ICgyP HQ/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=eUnvgMIi//w/sQqorQyrFDngZNeUoKS++dmuIbseIPk=; fh=4vKUGdamaGzSM5T8yihjINg8yc4jbXO/48R97N1s8YU=; b=NE7u8loGpHdFPolf9ibbZ/elZffywnYEif+gugtfC2y2wpWnyedCj+ZVGyGOb8hqo2 tR4DuFPTyPPobgZgN/6SsUhfRpfGHgGdTwEtkHpXBWGdBSq0LEvxbtSSC2D9xfp1BzOk C8mA0VijCevsboo0pA7dTl4aTke4g8ZyFJbZZPgOgHb/kO4Z1zOfPljXTjaPjUxmUNmL 9iCkfBqv7Lj+FLZFLgdWx8rEBoO0tHrnWmMWTIS5qw9Ojl0lH0YR0NhDznuzduaCcHRb jDbxvWvx77OzIcnUGkbBB1EmxxSAhO92lhDdKU809BoXFZFekuDdpXH02lox53LjRyxZ /wqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ij22-20020a170902ab5600b001bb1d188d9csi11384170plb.77.2023.08.02.13.51.13; Wed, 02 Aug 2023 13:51:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230384AbjHBUM1 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 2 Aug 2023 16:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbjHBUMZ (ORCPT ); Wed, 2 Aug 2023 16:12:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916E6E75; Wed, 2 Aug 2023 13:12:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1C2DF61AB8; Wed, 2 Aug 2023 20:12:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDB70C433C7; Wed, 2 Aug 2023 20:12:21 +0000 (UTC) Date: Wed, 2 Aug 2023 16:12:20 -0400 From: Steven Rostedt To: Alexei Starovoitov Cc: Masami Hiramatsu , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Florent Revest , Peter Zijlstra , Thomas Gleixner Subject: Re: [PATCH v4 3/9] bpf/btf: Add a function to search a member of a struct/union Message-ID: <20230802161220.579b2220@gandalf.local.home> In-Reply-To: References: <169078860386.173706.3091034523220945605.stgit@devnote2> <169078863449.173706.2322042687021909241.stgit@devnote2> <20230801085724.9bb07d2c82e5b6c6a6606848@kernel.org> <20230802000228.158f1bd605e497351611739e@kernel.org> <20230801112036.0d4ee60d@gandalf.local.home> <20230801113240.4e625020@gandalf.local.home> <20230801190920.7a1abfd5@gandalf.local.home> <20230802092146.9bda5e49528e6988ab97899c@kernel.org> <20230801204054.3884688e@rorschach.local.home> <20230802225634.f520080cd9de759d687a2b0a@kernel.org> <20230802143845.3ce6ed61@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Aug 2023 12:48:14 -0700 Alexei Starovoitov wrote: > On Wed, Aug 2, 2023 at 11:38 AM Steven Rostedt wrote: > > > > On Wed, 2 Aug 2023 11:24:12 -0700 > > Alexei Starovoitov wrote: > > > > > This is a non starter. > > > bpf progs expect arch dependent 'struct pt_regs *' and we cannot change that. > > > > If the progs are compiled into native code, isn't there optimizations that > > could be done? That is, if ftrace_regs is available, and the bpf program is > > just using the subset of pt_regs, is it possible that it could be compiled > > to use ftrace_regs? > > > > Forgive my ignorance on how BPF programs turn into executables when running > > in the kernel. > > Right. It's possible for the verifier to do an offset rewrite, > forbid certain access, always return 0 on load from certain offset, > and so on. > It's all non trivial amount of work. > ftrace_partial_regs() from ftrace_regs into pt_regs is so much simpler. Sure, and the copy could be the solution we have in the near future, but if we could optimize it in the future, then perhaps it would be worth doing it. Also, how are the bpf programs referencing the pt_regs? Could a ftrace_regs API be added too? If the verifier sees that the program is using ftrace_regs, it could then use the lighter weight fprobes for access, otherwise it falls back to the kprobe version. -- Steve