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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0CB6C0015E for ; Tue, 18 Jul 2023 23:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbjGRXD7 (ORCPT ); Tue, 18 Jul 2023 19:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbjGRXD5 (ORCPT ); Tue, 18 Jul 2023 19:03:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC1EED; Tue, 18 Jul 2023 16:03:43 -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 29A7E6130C; Tue, 18 Jul 2023 23:03:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27746C433C7; Tue, 18 Jul 2023 23:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689721422; bh=KLWairXWjM3wHL7cN2BqH6MgbWz4n9bm+Sod/qxn6hE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GgemyIa0/KWxtZey2iWTFwkaoLD00Lvvy0CR1AjwmRSuHgnEzAZDkT9UymjBk57mB msJIyUULvpB+VIDOynw92BBgGJFCyEwMZIeHXaJy37ZRfwxH9hKw6DNdzjQhx0/gtd WNNr4s5RTMGVYXRCAMSWh4nj/kGuMxlN58iULiG7TbrY15XbkGdQeKa+JeA8+pksil E3zQGiZZYymzO4oUuXt6C4+kAMp07mp/HgiaWlGGrF2mHBDYqG/ksBH/TBOWX/GOw3 +yr4DmeAYk8CGNxQaD3LkBmEnXSPVlImV6Gqa6SPv9NrPeX2CrHQw35oe5A+Skjfmm y+JgSBNeVqrRA== Date: Wed, 19 Jul 2023 08:03:37 +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: <20230719080337.0955a6e77d799daad4c44350@kernel.org> In-Reply-To: References: <168960739768.34107.15145201749042174448.stgit@devnote2> <168960741686.34107.6330273416064011062.stgit@devnote2> <20230718194431.5653b1e89841e6abd9742ede@kernel.org> <20230718225606.926222723cdd8c2c37294e41@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?) Thank you, -- Masami Hiramatsu (Google)