From patchwork Wed Jun 29 07:12:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonghong Song X-Patchwork-Id: 12899559 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 5F6A4CCA481 for ; Wed, 29 Jun 2022 07:12:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232459AbiF2HMb (ORCPT ); Wed, 29 Jun 2022 03:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229656AbiF2HMY (ORCPT ); Wed, 29 Jun 2022 03:12:24 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DC2EEE20 for ; Wed, 29 Jun 2022 00:12:23 -0700 (PDT) Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25SNDeHg006942 for ; Wed, 29 Jun 2022 00:12:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=facebook; bh=11Mmh1ktNaJLDFSZqPtyXu8VJNHrEdr4+JSsAcPQU0Q=; b=bWrKk2kjcY1PK2+83dTZPmDIdxfdb6oy+jYtcup2LTn85xznS8NpWlEK+qBLQBQCp8tF gJkEVIH5+TQOi848LhsbWhov1JBYxFW94rotEHe7DRapT3OIJTqRjQ+fr0DyunTZWSEG RNT4QYG+HrguG7Xz5deeJ2iacZse1l006d0= Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3h03ax61ym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 29 Jun 2022 00:12:22 -0700 Received: from twshared34609.14.frc2.facebook.com (2620:10d:c085:208::11) by mail.thefacebook.com (2620:10d:c085:21d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 29 Jun 2022 00:12:20 -0700 Received: by devbig309.ftw3.facebook.com (Postfix, from userid 128203) id D672DC24D6F4; Wed, 29 Jun 2022 00:12:13 -0700 (PDT) From: Yonghong Song To: Arnaldo Carvalho de Melo , CC: Alexei Starovoitov , Andrii Nakryiko , , Daniel Borkmann , Subject: [PATCH dwarves v3 0/2] btf: support BTF_KIND_ENUM64 Date: Wed, 29 Jun 2022 00:12:13 -0700 Message-ID: <20220629071213.3178592-1-yhs@fb.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: HoJpWS9RvK_txly7RSPp41laRBdoPcoP X-Proofpoint-ORIG-GUID: HoJpWS9RvK_txly7RSPp41laRBdoPcoP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-28_11,2022-06-28_01,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Add support for enum64. For 64-bit enumerator value, previously, the value is truncated into 32bit, e.g., for the following enum in linux uapi bpf.h, enum { BPF_F_INDEX_MASK = 0xffffffffULL, BPF_F_CURRENT_CPU = BPF_F_INDEX_MASK, /* BPF_FUNC_perf_event_output for sk_buff input context. */ BPF_F_CTXLEN_MASK = (0xfffffULL << 32), }; BPF_F_CTXLEN_MASK will be encoded with 0 with BTF_KIND_ENUM after pahole dwarf-to-btf conversion. With this patch, the BPF_F_CTXLEN_MASK will be encoded properly with BTF_KIND_ENUM64. This patch is on top of tmp.master since tmp.master has not been sync'ed with master branch yet. Changelogs: v2 -> v3: - pass struct type/conf_load pointers to btf_encoder__add_enum[_value] to make code easier to understand. v1 -> v2: - Add flag --skip_encoding_btf_enum64 to disable newly-added functionality. Yonghong Song (2): libbpf: Sync with latest libbpf repo btf: Support BTF_KIND_ENUM64 btf_encoder.c | 67 +++++++++++++++++++++++++++++++++++------------ btf_encoder.h | 2 +- dwarf_loader.c | 12 +++++++++ dwarves.h | 4 ++- dwarves_fprintf.c | 6 ++++- lib/bpf | 2 +- pahole.c | 10 ++++++- 7 files changed, 81 insertions(+), 22 deletions(-) Tested-by: Jiri Olsa