Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2059672rdb; Sun, 4 Feb 2024 13:07:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2ikRXh7COC1oUgtTBB1Qwguwpb0YpUsyiMw8+30NRTeESUpB+LJdauEVvbrCrXpf+sbnG X-Received: by 2002:a05:6358:592a:b0:178:f482:6e50 with SMTP id g42-20020a056358592a00b00178f4826e50mr212338rwf.11.1707080830308; Sun, 04 Feb 2024 13:07:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707080830; cv=pass; d=google.com; s=arc-20160816; b=IRzf3yRedQ9BmHbGj14w3/dfEdYl0nvUoLSDes96RIQwym7FZg2JEyb9H1TY0Y/6we RqtH8v9C9sV47NezGTz0S5IstgOAh03Io+0q7AwlNP4NR/3lkrpjyn2rP/vrOms7zxL7 cUU2haU3BGk11Ye+3DKyue+GUxJht0Pg1G+33dF4ve2JcRjXyCe8vRynVnztqwNatKf/ xJ2zZVy32SJuJk5Yq/3de9lHVSRwkOkRYL4HFwPcwzIaPahjG+WxN3fvTVRmpdz7jPvi fP+9x5Oq8iDrRNpUpeigvvyteBmMSxtR8tLuJODkhXc1KCNuKCoQA4fhs5cj9TJAYP6K qTSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :feedback-id:dkim-signature:dkim-signature; bh=Vmlk2shLBNaJQiu3F7UiauOWXFbhtVDGsu5iEKGc7NY=; fh=wzqjfYEHDy9OiFByuluGrsoxw8zLaz8KMssyVsS4N+0=; b=R5C5d5AeQl7sszM8m5DC5ltIsQ+zHgHM0odFPBz7VvfruoABo6xKWNDZ8Kehoyo3bW o+5YLSq8k3ZdvhJeRVTwCTPQsc4Wkssf8abVquzXhKPgUsdp4t7nW7Rn/VXslV2ZjS1M pcyAJj+L9Bja6kK2tcFfT37Or1Xia/2Jimovdf2vVsyr37ju0NBACqWXIPPI7SgJcKeW J6MvWWk8Y7IgeBoJkN0jN0iLap+ezGbKXyh5SkqcRqonV0UEDfNgn7XQ8GhW3GRIvJMw rWWtyRegiJd/Wn1zgdWNIIYREt8S2G0Yi4YZUMzXS8DeH8OcAaV+r2Mu08GsEm1RYsLb JWuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm2 header.b=UpCK5J4b; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=v+5kFjRt; arc=pass (i=1 spf=pass spfdomain=dxuuu.xyz dkim=pass dkdomain=dxuuu.xyz dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-51901-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51901-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXjzNakxa6xc/U98JPX3GvJVMZhCBm6SfF3LGVNuHKL1hQVxB/2b3t+Ls0Y3MEhaxUJd8GNh+DJyKAjkC1MBEmQus7+5fo6v3k7XyI1tA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id a1-20020a637f01000000b005d8c2880a7fsi5072401pgd.59.2024.02.04.13.07.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 13:07:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51901-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm2 header.b=UpCK5J4b; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=v+5kFjRt; arc=pass (i=1 spf=pass spfdomain=dxuuu.xyz dkim=pass dkdomain=dxuuu.xyz dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-51901-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51901-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 21C7EB2267B for ; Sun, 4 Feb 2024 21:07:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 030C5288D8; Sun, 4 Feb 2024 21:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b="UpCK5J4b"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="v+5kFjRt" Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85BB32C697; Sun, 4 Feb 2024 21:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707080813; cv=none; b=Bf//zMmU7Q+hKm01PYCrwwGVFcTou4UNqeWA4l3i8s7DAnJIcf6ksjEsO8rSezwIeecoPPvg0nUiiBJaPRnVqJHPlolCEjVtWTMih53/9WZp+LqxGOL8ZBXvZSJnoIYLg9PWSXadgdIOvvQsEO+QCLEw36K/kdeNlHXWUVbAHC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707080813; c=relaxed/simple; bh=NITE3fXCxmz6inqylAbpuLy1NnudrR7Xh5aJmakNCSY=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=laJTUcho06msqNSf2fBaL4q0NSjcyy62XyVwaHK3nxCPTHhBx8uAV9foX2XWEtcsJOE+ZBrcRYrXBEmbDdkiV7EKJOcr+JECKBB5tGdDNej7J2c3oqan8MEdjvXRvj3G0DPJO11RiiWIFJxgDqr6s1eORzKK1T12bbp4aacz7RE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dxuuu.xyz; spf=pass smtp.mailfrom=dxuuu.xyz; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b=UpCK5J4b; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=v+5kFjRt; arc=none smtp.client-ip=64.147.123.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=dxuuu.xyz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dxuuu.xyz Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 322083200A7A; Sun, 4 Feb 2024 16:06:49 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 04 Feb 2024 16:06:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm2; t=1707080808; x=1707167208; bh=Vmlk2shLBNaJQiu3F7Uia uOWXFbhtVDGsu5iEKGc7NY=; b=UpCK5J4byE50PZP5uEGDMgjSwyBOxPB5mtapU zrtIlAlZGIYSViGFu+zxHEeG7NfnDdjQQ+M4xYd5Z1bOTmQodNSIddrroRSVZoyZ MjtQ9XTspCgRlyGqBzFrAbXxiRsLD3ZpD9/7shCzfRZtbS3Esqc+8kf2hRg4MqPF xMG399ms7C58Iz+lbPbIeBQC5K4WWVp4O6VezzDj+PTbUD+SLSMgLR46I86KXuWe pqq1Gu2m5rEOuF4Ebvz5NKhmYlS9DfGtygYP1Czgb651ZdP4iJNYkk64YLsdXXHk lkl8RoV0r/3LETV0XwtNPFD3YjSvgbj6CWvTaOqIt4GSESWag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1707080808; x=1707167208; bh=Vmlk2shLBNaJQiu3F7UiauOWXFbh tVDGsu5iEKGc7NY=; b=v+5kFjRtzVN3RGYLZx9B0kjl5JPaPcvjc9StFkbmW/4E g5l1a2TnUDvf08/49b8F05HsodksJFY7p07S/niQocIabEyd3ZaBGpdO6/cf7nkZ xExMPRzWtdb25PDfJ9mrjdIg3xXCPtB3EppCS8wwynUOY8Hogxfue1DR25bJTs2j D9AlN8yiDjvWZTcKPG5KAfV5FgJE8smMLw8mfsqyvNwtDtaMgpjn5lFErNyqr+N6 RIgiWYphmOjzOgWhJsZ8qYZLH1QSIxJTgggPfC2dYoRgqZZcKLn/rjVgRF8MkPzD qGRM/zDRiyPw5s3NGdZHfvKHkdKCZA7zEj50efB7HQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedukedgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdefhedmnecujfgurhephf fvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeffrghnihgvlhcuighuuceougig uhesugiguhhuuhdrgiihiieqnecuggftrfgrthhtvghrnhepteefheetvdeugedtiedtfe duhedufeejteefjeffjeeugfehtdehveelvedufeejnecuffhomhgrihhnpehkvghrnhgv lhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegugihusegugihuuhhurdighiii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 4 Feb 2024 16:06:47 -0500 (EST) From: Daniel Xu To: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, andrii@kernel.org, olsajiri@gmail.com, quentin@isovalent.com, alan.maguire@oracle.com Subject: [PATCH bpf-next v2 0/2] bpf, bpftool: Support dumping kfunc prototypes from BTF Date: Sun, 4 Feb 2024 14:06:33 -0700 Message-ID: X-Mailer: git-send-email 2.42.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patchset enables dumping kfunc prototypes from bpftool. This is useful b/c with this patchset, 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) __weak __ksym; extern void cgroup_rstat_flush(struct cgroup *cgrp) __weak __ksym; extern struct bpf_key *bpf_lookup_user_key(u32 serial, u64 flags) __weak __ksym; Note that this patchset is only effective after the enabling pahole [0] change is merged and the resulting feature enabled with --btf_features=decl_tag_kfuncs. [0]: https://lore.kernel.org/bpf/cover.1707071969.git.dxu@dxuuu.xyz/ === Changelog === From v1: * Add __weak annotation * Use btf_dump for kfunc prototypes * Update kernel bpf_rdonly_cast() signature Daniel Xu (2): bpf: Have bpf_rdonly_cast() take a const pointer bpftool: Support dumping kfunc prototypes from BTF kernel/bpf/helpers.c | 4 ++-- tools/bpf/bpftool/btf.c | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) -- 2.42.1