Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp8046832rdb; Thu, 4 Jan 2024 17:26:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVPh7KyYbv5sHkPVYqv8XsxVRHclr1oqLq3wRsTBxZ2yB2Vb71MUi7V4YbMOzBXZtVFSb+ X-Received: by 2002:a05:600c:138d:b0:40d:609d:d654 with SMTP id u13-20020a05600c138d00b0040d609dd654mr740229wmf.201.1704417993323; Thu, 04 Jan 2024 17:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704417993; cv=none; d=google.com; s=arc-20160816; b=C78ZqjqpXrgpbcnvBUWhkPczYcSRapNGYTNf8t1x7sdiJRvkt/WJwpNFCoOgo0l9N/ 2ocNPQdY7XpsHI3tDMr36BDiV+aIdNFX0gnFDh7vNnwd6w7YTiBA58BoxFwaI0YWgcR2 /Wfh8wBSEBRlX8lSgqAMd8E1SbdUH9w4RTGfLsxf6b7Yrz8ZXvl7EduK8cNkhOmh64+O 3KF8ks8jDKT8DPdnmkpvvcXFk75O++VqnZbMkmBwYJGgogLdVSscd+wCPUgYkOztqv+0 mIPssMOZMooGhVAVtD3+fcRTVktl9VInppvSQ6qJvbLhOR+BQiqd548MNTJ20fMk04YF wwOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=8oxbnZeja7VLjsmNqyq5U5Vh+kwCbUgeDbgUqppXGZw=; fh=fBA4AbHQw+vEUQKuPDfw4madFpzXu+bmyBE/WY4fCzw=; b=V9Ytqdx1C8rIG84qzRJ3uTpQCkHA12idEmR9JtFdl2VMCmH4kzqHtH4g35bT6wH0Yu vK1ZuPU9erocu8m1WcNVJmEucYrBtwoEMJYllo5xyF2EnRm3rVgzKV7Lw2tkOg3zC8oh PA4CA6/goRi7TNCWdYAR0i0aL9vhaOixkkUcIprqQu1+EgT7XCCAM7QmVmOlpcxdR7pm qygD2S4cS2gxHQQ3YMzLZ/QopK4bzpwxOWyiv4k82WCyUYI5eD7qp7FIZQn24SOLL6z9 PHfu0Tx2XKPE/lJoHVEDImYzIfSkgBl/ijKP6UH1+BLMb6qeH8pqpjAx+ZFbeKLOtMO5 9lZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=Clbt61oB; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=i+l8k8Vu; spf=pass (google.com: domain of linux-kernel+bounces-17389-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17389-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y19-20020a170906071300b00a28165592f8si199448ejb.255.2024.01.04.17.26.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 17:26:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17389-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@dxuuu.xyz header.s=fm1 header.b=Clbt61oB; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=i+l8k8Vu; spf=pass (google.com: domain of linux-kernel+bounces-17389-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17389-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0BDA31F21E32 for ; Fri, 5 Jan 2024 01:26:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E90961FBF; Fri, 5 Jan 2024 01:24:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dxuuu.xyz header.i=@dxuuu.xyz header.b="Clbt61oB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="i+l8k8Vu" X-Original-To: linux-kernel@vger.kernel.org Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (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 6C9D81C10; Fri, 5 Jan 2024 01:24:04 +0000 (UTC) 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 compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 24AD23200B83; Thu, 4 Jan 2024 20:24:02 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 04 Jan 2024 20:24:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dxuuu.xyz; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704417841; x=1704504241; bh=8oxbnZeja7VLjsmNqyq5U5Vh+kwCbUgeDbgUqppXGZw=; b= Clbt61oBxHKzbCGy07g4rOxFGxLX2tL7ztb/4TkbPXfZQuKZQ/QyOJQC/agh/u3h 4fxlz6ral5PdX4FkRqJWcF6oOsXVYXhgCtHv1LjN2lvqDGU7s0B9cTK1b0BBwMSN Z21AW0UE1OfncoCrqw/ZTJ03MT0LBK7yK5qE9/P+P351qT15DP1nWGH4RNBxBmGb tO6f5eGnKgZ1kbYkENSmdY8a4F2wJztAWfX5xOY89USB7OLTQuskrt4lGgi3cc9T w7b9FmxorG2Xa4WFoaEXObUiXijrMNw7TQkTptGio3KGcNk8JF3fr8BDUWUuZWqW oKTxhIxshUpNCydt78/Q0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704417841; x= 1704504241; bh=8oxbnZeja7VLjsmNqyq5U5Vh+kwCbUgeDbgUqppXGZw=; b=i +l8k8VuIIdFlO50LVgUeJ1KML/J4piu+x2pGugwd5FztWf51/Ha/wIbikIFRayzp T7n59YgISpvOMgNWfbOfEuBVVvKfosnDYq6HPcq5F1UX6AmEMkdiAIGBHevcT/Dm S2EUPLEmdWoad7JyXOn3jWXU7RWYCArPyw3wcR4dk1suiIFlEOhaMmkts8ndy248 9tDIS1kH9aqutke0Bfh6+hh3+vQGe3Af4gHoOI3D7L0FAvpWUBIWHpzgWAsUQlD0 PM+Nmh7bZ8JinIJP3b/Ox/mxbQbRQkLLTndWItk2SNGEQRo4mXSvM982IvCXhiQR DjV2EM404gB2LJeKh54tA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegkedgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvvefukfhfgggtugfgjgestheksfdt tddtjeenucfhrhhomhepffgrnhhivghlucgiuhcuoegugihusegugihuuhhurdighiiiqe enucggtffrrghtthgvrhhnpeffffeggeekjedvjeegheetkeduhffgfeegveeklefhgeeu leejhfeljedtkeevffenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugiguhesugiguhhuuhdr giihii X-ME-Proxy: Feedback-ID: i6a694271:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 4 Jan 2024 20:24:00 -0500 (EST) Date: Thu, 4 Jan 2024 18:23:58 -0700 From: Daniel Xu To: Alexei Starovoitov Cc: Jiri Olsa , Martin KaFai Lau , Andrii Nakryiko , Daniel Borkmann , Alexei Starovoitov , Quentin Monnet , Alan Maguire , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , bpf , LKML Subject: Re: [PATCH bpf-next 1/2] bpf: btf: Support optional flags for BTF_SET8 sets Message-ID: References: <29644dc7906c7c0e6843d8acf92c3e29089845d0.1704324602.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Jan 04, 2024 at 09:11:56AM -0800, Alexei Starovoitov wrote: > On Thu, Jan 4, 2024 at 3:23 AM Jiri Olsa wrote: > > > > On Wed, Jan 03, 2024 at 04:31:55PM -0700, Daniel Xu wrote: > > > This commit adds support for optional flags on BTF_SET8s. > > > struct btf_id_set8 already supported 32 bits worth of flags, but was > > > only used for alignment purposes before. > > > > > > We now use these bits to encode flags. The next commit will tag all > > > kfunc sets with a flag so that pahole can recognize which > > > BTF_ID_FLAGS(func, ..) are actual kfuncs. > > > > > > Signed-off-by: Daniel Xu > > > --- > > > include/linux/btf_ids.h | 14 +++++++++----- > > > 1 file changed, 9 insertions(+), 5 deletions(-) > > > > > > diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h > > > index a9cb10b0e2e9..88f914579fa1 100644 > > > --- a/include/linux/btf_ids.h > > > +++ b/include/linux/btf_ids.h > > > @@ -183,17 +183,21 @@ extern struct btf_id_set name; > > > * .word (1 << 3) | (1 << 1) | (1 << 2) > > > * > > > */ > > > -#define __BTF_SET8_START(name, scope) \ > > > +#define ___BTF_SET8_START(name, scope, flags) \ > > > asm( \ > > > ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ > > > "." #scope " __BTF_ID__set8__" #name "; \n" \ > > > "__BTF_ID__set8__" #name ":; \n" \ > > > -".zero 8 \n" \ > > > +".zero 4 \n" \ > > > +".long " #flags "\n" \ > > > ".popsection; \n"); > > > > > > -#define BTF_SET8_START(name) \ > > > +#define __BTF_SET8_START(name, scope, flags, ...) \ > > > +___BTF_SET8_START(name, scope, flags) > > > + > > > +#define BTF_SET8_START(name, ...) \ > > > __BTF_ID_LIST(name, local) \ > > > -__BTF_SET8_START(name, local) > > > +__BTF_SET8_START(name, local, ##__VA_ARGS__, 0) > > > > I think it'd better to use something like: > > > > BTF_SET8_KFUNCS_START(fsverity_set_ids) > > > > instead of: > > > > BTF_SET8_START(fsverity_set_ids, BTF_SET8_KFUNC) > > > > and to keep current BTF_SET8_START without flags argument, like: > > > > #define BTF_SET8_START(name) \ > > __BTF_SET8_START(... , 0, ... > > > > #define BTF_SET8_KFUNCS_START(name) \ > > __BTF_SET8_START(... , BTF_SET8_KFUNC, ... > > I was about to suggest the same :) > > We can drop SET8 part as well, since it's implementation detail. > Just BTF_KFUNCS_START and pair it with BTF_KFUNCS_END > that will be the same as BTF_SET8_END. > Until we need to do something else with these macros. Ack, will change. > > > > > also I'd rename BTF_SET8_KFUNC to BTF_SET8_KFUNCS (with S) > > > > do you have the pahole changes somewhere? would be great to > > see all the related changes and try the whole thing > > +1 > without corresponding pahole changes it's not clear whether > it actually helps. Here's a checkpointed branch: https://github.com/danobi/pahole/tree/kfunc_btf-mailed . I won't force push to it. It should work against this patchset. I might need to clean it up a bit still. Thanks, Daniel