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 X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40112C433F5 for ; Mon, 13 Sep 2021 15:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27EFE60F9B for ; Mon, 13 Sep 2021 15:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244807AbhIMPxS (ORCPT ); Mon, 13 Sep 2021 11:53:18 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:47540 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244551AbhIMPxK (ORCPT ); Mon, 13 Sep 2021 11:53:10 -0400 Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 18DF56W0014477 for ; Mon, 13 Sep 2021 08:51:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=28VJ10Z+eSw1xnnp1vygxI4sjGr1JlObrqe5+oV+l8A=; b=RDJ2ivVTdESAAeDnzO/cvf1djxG2+x5OSXuQ1MNu9DXAtXzjgACnUvf17SeEbwqGZ9BH /0I41mXK2fbVS/qP+8xKR+ChFI5RQuStTq9TjMZzICZVTbiGAd+UCXBoF3e7mWnxETlN V+heFMmzPwulX+px+necWlUPmnofExw7ePs= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com with ESMTP id 3b1vfcux2e-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 13 Sep 2021 08:51:53 -0700 Received: from intmgw006.03.ash8.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Mon, 13 Sep 2021 08:51:50 -0700 Received: by devbig003.ftw2.facebook.com (Postfix, from userid 128203) id 7CC367279073; Mon, 13 Sep 2021 08:51:50 -0700 (PDT) From: Yonghong Song To: CC: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Subject: [PATCH bpf-next v2 05/11] bpftool: add support for BTF_KIND_TAG Date: Mon, 13 Sep 2021 08:51:50 -0700 Message-ID: <20210913155150.3727112-1-yhs@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210913155122.3722704-1-yhs@fb.com> References: <20210913155122.3722704-1-yhs@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-FB-Source: Intern X-Proofpoint-GUID: _MRB44QWRmDVC3t9Izqc0DjqDcG5MX5Q X-Proofpoint-ORIG-GUID: _MRB44QWRmDVC3t9Izqc0DjqDcG5MX5Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-13_07,2021-09-09_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109130103 X-FB-Internal: deliver Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Added bpftool support to dump BTF_KIND_TAG information. The new bpftool will be used in later patches to dump btf in the test bpf program object file. Currently, the tags are not emitted with bpftool btf dump file format c and they are silently ignored. The tag information is mostly used in the kernel for verification purpose and the kernel uses its own btf to check. With adding these tags to vmlinux.h, tags will be encoded in program's btf but they will not be used by the kernel, at least for now. So let us delay adding these tags to format C header files until there is a real need. Signed-off-by: Yonghong Song --- tools/bpf/bpftool/btf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index f7e5ff3586c9..49743ad96851 100644 --- a/tools/bpf/bpftool/btf.c +++ b/tools/bpf/bpftool/btf.c @@ -37,6 +37,7 @@ static const char * const btf_kind_str[NR_BTF_KINDS] =3D= { [BTF_KIND_VAR] =3D "VAR", [BTF_KIND_DATASEC] =3D "DATASEC", [BTF_KIND_FLOAT] =3D "FLOAT", + [BTF_KIND_TAG] =3D "TAG", }; =20 struct btf_attach_table { @@ -347,6 +348,17 @@ static int dump_btf_type(const struct btf *btf, __u3= 2 id, printf(" size=3D%u", t->size); break; } + case BTF_KIND_TAG: { + const struct btf_tag *tag =3D (const void *)(t + 1); + + if (json_output) { + jsonw_uint_field(w, "type_id", t->type); + jsonw_int_field(w, "component_idx", tag->component_idx); + } else { + printf(" type_id=3D%u component_idx=3D%d", t->type, tag->component_id= x); + } + break; + } default: break; } --=20 2.30.2