Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1453998rwo; Wed, 2 Aug 2023 14:32:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlF80jvtsU/7+KMEngGTr17GJ660RlF9tvEmeMiPhpxRhewBdbdtLzddJUZnYgzSzlufn9TZ X-Received: by 2002:a17:907:7885:b0:99c:4ea0:ed18 with SMTP id ku5-20020a170907788500b0099c4ea0ed18mr2045643ejc.8.1691011976600; Wed, 02 Aug 2023 14:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691011976; cv=none; d=google.com; s=arc-20160816; b=H1o+gwrUzAzpem9Axe4OsFwRnyYAYOGzEBUAApEHbFhncxdZvriHq03wp+9hpru1aM kUY/GhRaZF2uOSDvspkAxgRFVFc3dyfHEwVvK+CwocTU5KVTPVn0Yf1GmyCmKCX/wYTp 1YWmeUOpghcqyqO5diT53DpPh4yR3I+pi1E82/b090QfIBiqJ/Y0dI50wh4aHa/geGKH lfGjGPeVlJIdj+lixLPKuC+OZ+n0jQSx6ON5u9zFdLNs/yglcEMUBGLv3L37qWS5JmTn 69ZgNgRD4tq0BuFZEdevbfoYW/xAwpPXsQm6MfGq7BF3Jsp6XAx2xgrLiNnIDfSebBH2 cH0A== 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=fXpNsLUTVNX9sFjFzmjiCCJcWZd1K7Cg3XGCsj2KKNo=; fh=uCWdrVl2eOEjuijMA5Y+8irSBS2z+K896sRRGoC2NAk=; b=mwOSqU7lpDCLgeUI4K8PWyAtFOFEQVXqJtQwL8HOsOYhb7TEHmQW4T+eHODoj/2N+T f5QfTTx9Jl3TKuIGQojUc7FIazyTMGE2tqjX7m/ZLSB/c5VWnpw3yDi8P4WyrYG3xv/G CvalYftjAQGUTi/xpdnceprjdCyaiasaZzXGNbCbUTdnSr7wsRHpFt/0TyAXAtGoJkgb NbWHbL44KC8OBDh/AR/JNZiBdFS2Yrfdg1CBW+zJ/mWYyALLId8vvM5JlER/Fpty51qu GxwqX1zSOveJ1pYpzcKX0ErYEvGG9DtuUqXiGhh4sVQdliyWpgOpBTtWOpy2vavkTt+U jFlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=sQ2U1U8I; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lo8-20020a170906fa0800b0099bd5561245si898634ejb.54.2023.08.02.14.32.31; Wed, 02 Aug 2023 14:32:56 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=sQ2U1U8I; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbjHBTsc (ORCPT + 99 others); Wed, 2 Aug 2023 15:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbjHBTs3 (ORCPT ); Wed, 2 Aug 2023 15:48:29 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE0EF19AD; Wed, 2 Aug 2023 12:48:27 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b9f0b7af65so2496621fa.1; Wed, 02 Aug 2023 12:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691005706; x=1691610506; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fXpNsLUTVNX9sFjFzmjiCCJcWZd1K7Cg3XGCsj2KKNo=; b=sQ2U1U8IIoBh/ny1VCsSidkVurHcchk62vCBvykv+inOZa8u3oRLhx2yX8U/YL+cEF salGgBTvsOgGURhMCOzlTCrSJ6i9k3vpu1blDlBgh5UbWsFbEjyKXwVBPbGvGwwMj0SX hjv2IYhdV9H42t4qX2SRiJWKkil4pmkqRZsAFDybxmgEHzbWKkIg8cauv29JByaj0Dkz RXy42dGSiHmvzUa1ZKA5uvXzbr61ddy4GPW91NSl+eTtaxl7kaKBAXMMaopirhZI6GuG L3BWtI/x9AryBODOIZMJfcuRkW7hTj5+h8LnefyB1RuVzHTIkQeEqPpFoylN6brBMVby votA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691005706; x=1691610506; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fXpNsLUTVNX9sFjFzmjiCCJcWZd1K7Cg3XGCsj2KKNo=; b=FhAIhHRG+MNNpAfre+a0P2AzWfVHw8KwmUJVW1yBLt8PPq27Wq47jAy2yUaG5kD77B QmHU8IEXPiRfQQAcwh/Q1zUsqKWYMxgtN1LXT5/f56Qb9nl7HTsUVn48+3YBACbUYveh y+JxY9Umeqa7cBQcoS6Ab3RAn8yI8D6wKPINBQ4aLWemAFn3h/Rer2rg0KbeVFxP5xbP TQPRRMT8NsHeTzbW5P8SUYHt+7bE/pcv9OqR4XuxqE4Hfd4R6bIU4Vugt3FzcGQBeLSD L/iw+GxjTf7IBYQLbGJVOMxHSfactsQakMULWxzn5hcqXhR1MSeYkA6AcdH8Sx+aumUf E9Ng== X-Gm-Message-State: ABy/qLbxssHI+IQJhTqu5gl7Yh0iiP2c5VuRxdHaw1Pr4jLpd5yb4y1o syWcj/2ap4tJlCNSSSVKlVHlNmz2Mv9hqSLln30= X-Received: by 2002:a05:651c:201:b0:2b6:dd9a:e1d3 with SMTP id y1-20020a05651c020100b002b6dd9ae1d3mr6025265ljn.44.1691005705801; Wed, 02 Aug 2023 12:48:25 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20230802143845.3ce6ed61@gandalf.local.home> From: Alexei Starovoitov Date: Wed, 2 Aug 2023 12:48:14 -0700 Message-ID: Subject: Re: [PATCH v4 3/9] bpf/btf: Add a function to search a member of a struct/union To: Steven Rostedt 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,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, Aug 2, 2023 at 11:38=E2=80=AFAM 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 tha= t > 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 compile= d > to use ftrace_regs? > > Forgive my ignorance on how BPF programs turn into executables when runni= ng > 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.