Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8344526rwp; Wed, 19 Jul 2023 08:32:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/r8DYnPQ3tCkvC1dYSgYy3uYM3u47QFhvrpnwu9y6cm2nOUi00tw+OA2BjazhVThJE1M+ X-Received: by 2002:a17:90a:df05:b0:263:6e10:7cdd with SMTP id gp5-20020a17090adf0500b002636e107cddmr17591582pjb.38.1689780761762; Wed, 19 Jul 2023 08:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689780761; cv=none; d=google.com; s=arc-20160816; b=b/Xmhl2LP1ZEPnVlR1MviTZ72kIomK2YX2PcHpTnBLX3QdqMd/55Ub+usRe6jbaHEr sIwzt5OqUSrTya1bqzTJrDzM1jihhk0pH0WbfvmYYCilCOT9OYVOfWc3dtUeyYGb/oMW e2eSZFuP8LE20SYgQIQB26gbvbO8yQLw5VnPm2pQ28Nt1/rHkoUPWdmurk8u6B9FS46S DGSpzgqGcPOsg85dOqKrj+rU5bfNBv0T1P2Vlpi2lgGrS8/kP7PIgM5q4GKGa4LLUXdH c2rvu/ghrUmexPwtCSiAbf4080b3CaJvNmnWBjSNmcGX8P6XptwKjtL7ybiLQJ+K60pt QveA== 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 :dkim-signature; bh=kjgOwn9cuXpPCh/rx2PvRaENH58aYAD3xVRvS/AXreU=; fh=q+TYpr+RLFlIe9/MoMY46EG0vHm1oTgUqRSPb5kYdyQ=; b=N5F+mPk6vpjfF60EkyURVMBPE2kaUxZp6hp8pZ2GwEl56PP9TwIUICwJfhwyDjtb3Y UI04m+4W49Fw7wA+tWJlkQBppyZnaqk85i8XY5IoQyfnCKE/sDc4rZdcFKMTh+yJcpL9 nGPh4uL54C05t5prpyik7lQPkW3Q8fduQOiEmE/DlTf6A2oF0REsf+QNU0rzmwej9B3Y 9ni2FZ+F7n8obFVsR69RfFFFzXClXzVLc3vRp9Ka42YoOF9xWn3SmF8BsZA34s+Ben/i sw8dRfs5aPF168Wh2cSQksQLpz+ljVAbh7VH2drvN1DmCzw/QC2yegC9NPxmVe5Jq7HX waYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q47QyiR0; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a17090a588400b00262cc36ea3esi1523125pji.76.2023.07.19.08.32.29; Wed, 19 Jul 2023 08:32:41 -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=@kernel.org header.s=k20201202 header.b=Q47QyiR0; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231613AbjGSPS2 (ORCPT + 99 others); Wed, 19 Jul 2023 11:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231649AbjGSPST (ORCPT ); Wed, 19 Jul 2023 11:18:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6B3719BE; Wed, 19 Jul 2023 08:17:56 -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 546D46177F; Wed, 19 Jul 2023 15:17:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29E04C433C8; Wed, 19 Jul 2023 15:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689779868; bh=ROKSrUYlEa7zbqxtmCRVjwKdUJCj1sHQcb/iPoyTbNU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q47QyiR0w82ydmdB7rxTc86aT/KwJYvtgfEuRpYv0Fhej1gjGpWMkq0glx9xd3yLb u6qA+Wy82wX8sBxsrX0iXgWvHILN80TOEV0cJgVEl1igR3Q/kAeVHpjd9+bKRI74Mq Mj3EeC3ZFHBYLf+SvAdhx8MAcvAnQKwZZw17XsQ4wbbWbIHuT/2HZpogEzmXsINLVP IU2Q0S8mGIV36qE2PKwBLlMKEbdk18i/yw5xhWuxcNPUIPEf4vLvWXibcnzs37Mfk5 4CzZIsE7wiEZqu9CuSqi6SeXYPomv+58UAiKkyAWNeFuBHXC46k+gBRpAjTj/UYd0P 6Z3+SwucXxd6w== Date: Thu, 20 Jul 2023 00:17:43 +0900 From: Masami Hiramatsu (Google) To: Alexei Starovoitov Cc: Donglin Peng , linux-trace-kernel@vger.kernel.org, LKML , Steven Rostedt , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov Subject: Re: [PATCH v2 2/9] bpf/btf: tracing: Move finding func-proto API and getting func-param API to BTF Message-Id: <20230720001743.ca2daff25ff13146711de3cc@kernel.org> In-Reply-To: References: <168960739768.34107.15145201749042174448.stgit@devnote2> <168960741686.34107.6330273416064011062.stgit@devnote2> <20230718194431.5653b1e89841e6abd9742ede@kernel.org> <20230718225606.926222723cdd8c2c37294e41@kernel.org> <20230719080337.0955a6e77d799daad4c44350@kernel.org> X-Mailer: Sylpheed 3.7.0 (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=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 Tue, 18 Jul 2023 16:12:55 -0700 Alexei Starovoitov wrote: > On Tue, Jul 18, 2023 at 4:03 PM Masami Hiramatsu wrote: > > > > On Tue, 18 Jul 2023 10:11:01 -0700 > > Alexei Starovoitov wrote: > > > > > On Tue, Jul 18, 2023 at 6:56 AM Masami Hiramatsu wrote: > > > > > > > > On Tue, 18 Jul 2023 19:44:31 +0900 > > > > Masami Hiramatsu (Google) wrote: > > > > > > > > > > > static const struct btf_param *find_btf_func_param(const char *funcname, s32 *nr, > > > > > > > bool tracepoint) > > > > > > > { > > > > > > > + struct btf *btf = traceprobe_get_btf(); > > > > > > > > > > > > I found that traceprobe_get_btf() only returns the vmlinux's btf. But > > > > > > if the function is > > > > > > defined in a kernel module, we should get the module's btf. > > > > > > > > > > > > > > > > Good catch! That should be a separated fix (or improvement?) > > > > > I think it's better to use btf_get() and btf_put(), and pass btf via > > > > > traceprobe_parse_context. > > > > > > > > Hmm, it seems that there is no exposed API to get the module's btf. > > > > Should I use btf_idr and btf_idr_lock directly to find the corresponding > > > > btf? If there isn't yet, I will add it too. > > > > > > There is bpf_find_btf_id. > > > Probably drop 'static' from it and use it. > > > > Thanks! BTW, that API seems to search BTF type info by name. If user want to > > specify a module name, do we need a new API? (Or expand the function to parse > > a module name in given name?) > > We can allow users specify module name, but how would it help? > Do you want to allow static func names ? > But module name won't help. There can be many statics with the same name > in the module. Currently pahole filters out all ambiguous things in BTF. > Alan is working on better representation of statics in BTF. > The work is still in progress. Ah, got it. So currently we don't have to worry about that case. > > For now I don't see a need for an api to specify module, since it's not > a modifier that can be relied upon to disambiguate. > Hence bpf_find_btf_id that transparently searches across all should be enough. > At least it was enough for all of bpf use cases. OK. After updating the BTF I will revisit here. Thank you! -- Masami Hiramatsu (Google)