Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp866958rdb; Tue, 30 Jan 2024 00:23:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFA25HlEgCL/vyh6YdIMOSuP9hSXv30BUDBQ/4mMClyE2sSQp1pIaDixBGRbgRvtEDEOq6t X-Received: by 2002:a17:906:1353:b0:a35:6669:9fe with SMTP id x19-20020a170906135300b00a35666909femr782338ejb.32.1706603024283; Tue, 30 Jan 2024 00:23:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706603024; cv=pass; d=google.com; s=arc-20160816; b=lIqSs1b3eeMYEsDpvXnJuviHA0FBCPQZ1hiv6p4m/KD85mZMmvGqWJuBAx2bK/Vy/p hjRKz0cuq499dz+FnwpFuyDHlSjlDCHByfUpxIFw8X1S7WtAAlYqbFxUUyL2bij5BHzr GowWNX2sPLS+xYRO7NblHhbabC8l+iPbsrPjZBI7LBowk6/z25/y21Io7hLg9d432K4G dTmM8vggOpqxpoNVk5gDrzjcGKPi1U5vaykB2KtFOmaB+rStY3tSnmZPyRXO1rdcyUeh cmntoW1/im70xrJa/BkT4ita8q6Fyu7/0GUL4JB+6RreGlMDqqdX6hxhA0A5DW20daZ5 SRdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=MLUH2MrbJbyTg2PanUyjcCyUfWbIFdefagwcMnDabUw=; fh=cxfyUTrp2tOWuFLER9xUl75ScNJHtoW2pbkXFmoY910=; b=OlSePGCAzZEatNxygdFbcpT703DA7EIXH10dRlrJhDNxtwyFCbZ2k3RuRM6JmDwxn1 hFbuhYc5loI1jiX476g8kCSyFWyCeW7Ffui7LVOOGjxBO0Q+gNN4J3ANsoJa2XTmTfb4 pY8IizO5jbCwtWwJwRLrxdguTB55hD8OIwYFH2GO/m5zwpzKyT/zWFIGRnpmBca7Sx8X xBoC1nvtJsgqFn22wJ89C3IMuriui7PiV1+etBSKo3HOnGlQfdSlOo+bjlxzhD5FXCgl JN/hZm//kXYIFocdOapg23XwKX1vT0rSolr9ATlDChxs7KGuD67MCwB0sYVLjBHYrO8r ansA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lTaaweuJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-44121-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d10-20020a170906640a00b00a28ba5dd13asi4041513ejm.1055.2024.01.30.00.23.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 00:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44121-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lTaaweuJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-44121-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6E0F31F2B2CB for ; Tue, 30 Jan 2024 08:22:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A788C59151; Tue, 30 Jan 2024 08:15:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lTaaweuJ" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D54355C2D; Tue, 30 Jan 2024 08:15:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706602540; cv=none; b=BYE1Cf31sxUed7d4ib1mQ07GJxUih05cvbu4l+8LvtVe+vl1iZ+MHEYstZTf1fA1CPUDa1kplLz6yz5XZ084nbhd5IvGcJEtb5TAfSBo0s86Pe/F/PZNVdmuCUaOf7QfTFHK2ErVwJzZ87rGTDMRqipqnc2w2/+XFdMzZRq7o/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706602540; c=relaxed/simple; bh=zcBiUnh0+FoPyWXm+vLSKyGSXfIq6oNcDKyh+2nVAvk=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YU6YxpQpLhG8iVD/8FD/nfUM7j+0VvyiHX6amOMFN5ORIRyvbE9USSPFxw+EhzmdyeuieDGFUSiCJF1DXeXI6iG4nt4PJhDsdQdyvzvTMkuVNlRwszm5YbMDB/vx3YTkA3r3B38h/lfG5fHGbVUp0Jh1yEwbofZcpuaurgDRIf8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lTaaweuJ; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-55a9008c185so6333312a12.1; Tue, 30 Jan 2024 00:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706602537; x=1707207337; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=MLUH2MrbJbyTg2PanUyjcCyUfWbIFdefagwcMnDabUw=; b=lTaaweuJWxGbt4Xz/y0vJbh6WxRCbpWpwehYI3JtVPEJ3ZSGpdAxj5LYynDoGwjp5p 0ul7qJV7Awcr8FOdyeBWSABVHG+YP/IiibtEtzPhxfbNDpWCdeTiJWGc/P3SqlyQPCi8 Duc+UWWrdkB9g/BjANlQYw0mk512H7qpfJnoLFIE1soG3//rCuJjip8soSulrtfnxpEG 9xygh73PI6vZb4yxJtY8D4rUm6gxbw/tY3N64QOHXdOD0N4zUrFbDJjlSDKFwIIeUEL9 z/UzUzDFmWh9nqFIBTmJ/izbUSjm+UbfjiLLQINlfJM1qrEXJNaLib0o1KLw2tAxySWJ lSDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706602537; x=1707207337; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MLUH2MrbJbyTg2PanUyjcCyUfWbIFdefagwcMnDabUw=; b=VmEL0Smm9thZIEBwohtxuo8rKaaXb94H7uKri+6USrxa+s6xfBCC1jJhT+XU9fTlXT h5PQ5bUERKOqfmUT3cVNqFMv0y0xPhY8Z6vIYCN7PIojH/cmEM5y7T7GeluXzR7d/f79 4K+bKafX/MjtxyZjhjvSWT+s7sXIcUCGcFCNMs3Uezzs5jpqDyxZFbL/GSlGzlKqE8Qs XjSOs2RR9QcFki4idnVNviyvQMSQsbxy+JbiLXTHEDZEXytxjl2jEO5gl0lh/Ec8Z2K6 55UPP4uNSLy1133Tv1gefvGMRr0FgxXp198JXBaBu1+ULku7GanV2kwPNndDiJjOnU1g QjlQ== X-Gm-Message-State: AOJu0YzSrPzty3cZKx95T4QHaNMlXTf07Hh0GULFJ+llxaOdbUci4/Np +V4i4T8pg1h30/jKnDvSZdbFae4N+mQmUmF6WHV//q+V3ZOUdgDw X-Received: by 2002:a50:9e82:0:b0:55e:eb6e:ff51 with SMTP id a2-20020a509e82000000b0055eeb6eff51mr803378edf.12.1706602536959; Tue, 30 Jan 2024 00:15:36 -0800 (PST) Received: from krava (2001-1ae9-1c2-4c00-726e-c10f-8833-ff22.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:726e:c10f:8833:ff22]) by smtp.gmail.com with ESMTPSA id p14-20020a056402500e00b0055c67e6454asm4652639eda.70.2024.01.30.00.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 00:15:36 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Tue, 30 Jan 2024 09:15:33 +0100 To: Daniel Xu Cc: Jiri Olsa , quentin@isovalent.com, daniel@iogearbox.net, ast@kernel.org, andrii@kernel.org, alexei.starovoitov@gmail.com, alan.maguire@oracle.com, memxor@gmail.com, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next] bpftool: Support dumping kfunc prototypes from BTF Message-ID: References: <373d86f4c26c0ebf5046b6627c8988fa75ea7a1d.1706492080.git.dxu@dxuuu.xyz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 29, 2024 at 09:13:13AM -0700, Daniel Xu wrote: > Hi Jiri, > > On Mon, Jan 29, 2024 at 01:11:17PM +0100, Jiri Olsa wrote: > > On Sun, Jan 28, 2024 at 06:35:33PM -0700, Daniel Xu wrote: > > > This patch enables dumping kfunc prototypes from bpftool. This is useful > > > b/c with this patch, end users will no longer have to manually define > > > kfunc prototypes. For the kernel tree, this also means we can drop > > > kfunc prototypes from: > > > > > > tools/testing/selftests/bpf/bpf_kfuncs.h > > > tools/testing/selftests/bpf/bpf_experimental.h > > > > > > Example usage: > > > > > > $ make PAHOLE=/home/dxu/dev/pahole/build/pahole -j30 vmlinux > > > > > > $ ./tools/bpf/bpftool/bpftool btf dump file ./vmlinux format c | rg "__ksym;" | head -3 > > > extern void cgroup_rstat_updated(struct cgroup * cgrp, int cpu) __ksym; > > > extern void cgroup_rstat_flush(struct cgroup * cgrp) __ksym; > > > extern struct bpf_key * bpf_lookup_user_key(u32 serial, u64 flags) __ksym; > > > > hi, > > I'm getting following declaration for bpf_rbtree_add_impl: > > > > extern int bpf_rbtree_add_impl(struct bpf_rb_root * root, struct bpf_rb_node * node, bool (struct bpf_rb_node *, const struct bpf_rb_node *)* less, void * meta__ign, u64 off) __ksym; > > > > and it fails to compile with: > > > > In file included from skeleton/pid_iter.bpf.c:3: > > ./vmlinux.h:164511:141: error: expected ')' > > 164511 | extern int bpf_rbtree_add_impl(struct bpf_rb_root * root, struct bpf_rb_node * node, bool (struct bpf_rb_node *, const struct bpf_rb_node *)* less, void * meta__ign, u64 off) __ksym; > > | ^ > > ./vmlinux.h:164511:31: note: to match this '(' > > 164511 | extern int bpf_rbtree_add_impl(struct bpf_rb_root * root, struct bpf_rb_node * node, bool (struct bpf_rb_node *, const struct bpf_rb_node *)* less, void * meta__ign, u64 off) __ksym; > > > > looks like the btf_dumper_type_only won't dump function pointer argument > > properly.. I guess we should fix that, but looking at the other stuff in > > vmlinux.h like *_ops struct we can print function pointers properly, so > > perhaps another way around is to use btf_dumper interface instead > > Ah, crap, looks like between all the branch switching I didn't build > vmlinux with kfunc annotations. Having fixed that, I can repro this > build failure. > > I'll take a look and see what the best way to fix this is. > > Given that end to end the whole flow basically works, should we start > working on merging patches? yes, the flow looks good to me.. will check the rest of the patches jirka