Message ID | 20230509063649.239942-1-yangjihong1@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2665207vqo; Mon, 8 May 2023 23:39:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4QCQ3/I5zHbKSIGiNFKtdLWyJ4Kuf8Mj0xN+vjcFyXG8JRQKOt7BFmG4Z7jN1TQLRBkiGz X-Received: by 2002:a17:90a:d518:b0:250:1b4c:d861 with SMTP id t24-20020a17090ad51800b002501b4cd861mr15111607pju.13.1683614379833; Mon, 08 May 2023 23:39:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683614379; cv=none; d=google.com; s=arc-20160816; b=xYCUDdVao8vUJ2PVqwyvjun9V6beHg4q7RfTossyBKouyMb9d0uBp5tjYaK+JqMfmM wdHJ6C54k61by00bhMVf+QMWdL7/xix7N6aLMODTKcofg8ExRUKHUp4XPiRJ3gQZ+1bo BEyh/ypy0AXDcE5PamkFr2cfp+9i1+jZJMLhT70xhmrwpSYZH1FhXuiKGOE57IS6ZhFH +kf1FHK5O7xmtqC3mVR/VW165wffpAAI3LOWV5wUZ+Urpp6YDYqOGswkljyrdHauSQoG Q7qp5//luO/0Gvra5nhlAJFkXXjVWiLiVabw9v0ScJx7ol/yhhcaXyFNvKIdPJ/FBv9N DBcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qyjgBqbcq3l/YIyR2DEulE02txdrzwgIKZerZcp1kII=; b=UbDc3SJcjo85miyaI33Ae8XMz0tEAENss8pBrX9WEXZqOFqfL8eKEK3D5yyrc5Aob0 0GmV0S5GY2ufDgpVeMn5aBgOtf+RwAKSka8kQjbK1D43QdOXuEMOBNr+ZhsYPQbtdIvW tl/gdTK0EiMWMrwJIyQXXPeF7wpkJz3wCtVBdo+camFlTYrck5fTmrllxWf6KqHkoxAa 40bnJi9B8pGJXxMpY3GfK9uFf8VBc0d+e/JDd8j2n56ueZ+96v8TOR12DNkJgC3XAcAe Lz3vT3DKgu8tQMLYyrot2aXFq5TwEf3X7cyXcA9wez9X3lT8ymrhPsEDIZXBuA6l8Xkc BN3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j15-20020a170903024f00b001a63ba2c894si841738plh.548.2023.05.08.23.39.25; Mon, 08 May 2023 23:39:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbjEIGiX (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Tue, 9 May 2023 02:38:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234897AbjEIGiV (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 9 May 2023 02:38:21 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A7BDAD25; Mon, 8 May 2023 23:38:19 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QFpLm0cZLzLpd7; Tue, 9 May 2023 14:35:28 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 9 May 2023 14:38:17 +0800 From: Yang Jihong <yangjihong1@huawei.com> To: <peterz@infradead.org>, <mingo@redhat.com>, <acme@kernel.org>, <mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>, <jolsa@kernel.org>, <namhyung@kernel.org>, <irogers@google.com>, <adrian.hunter@intel.com>, <linux-perf-users@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <yangjihong1@huawei.com> Subject: [PATCH] perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory Date: Tue, 9 May 2023 06:36:49 +0000 Message-ID: <20230509063649.239942-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765397631625016166?= X-GMAIL-MSGID: =?utf-8?q?1765397631625016166?= |
Series |
perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory
|
|
Commit Message
Yang Jihong
May 9, 2023, 6:36 a.m. UTC
Currently, vmlinux.h uses the bpf.h and perf_event.h header files in the
system path. If the header files in compilation environment are old,
compilation may fail. For example:
/home/yangjihong/linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:151:27: error: field has incomplete type 'union perf_sample_weight'
union perf_sample_weight weight;
Use the bpf.h and perf_event.h files in the source code directory to
avoid compilation compatibility problems.
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
---
tools/perf/util/bpf_skel/vmlinux.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Comments
Em Tue, May 09, 2023 at 06:36:49AM +0000, Yang Jihong escreveu: > Currently, vmlinux.h uses the bpf.h and perf_event.h header files in the > system path. If the header files in compilation environment are old, > compilation may fail. For example: > > /home/yangjihong/linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:151:27: error: field has incomplete type 'union perf_sample_weight' > union perf_sample_weight weight; Can this be solved in the Makefile directives for building BPF targets? - Arnaldo > Use the bpf.h and perf_event.h files in the source code directory to > avoid compilation compatibility problems. > > Signed-off-by: Yang Jihong <yangjihong1@huawei.com> > --- > tools/perf/util/bpf_skel/vmlinux.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/bpf_skel/vmlinux.h b/tools/perf/util/bpf_skel/vmlinux.h > index 449b1ea91fc4..af79bcc4c4b7 100644 > --- a/tools/perf/util/bpf_skel/vmlinux.h > +++ b/tools/perf/util/bpf_skel/vmlinux.h > @@ -1,11 +1,13 @@ > #ifndef __VMLINUX_H > #define __VMLINUX_H > > -#include <linux/bpf.h> > #include <linux/types.h> > -#include <linux/perf_event.h> > #include <stdbool.h> > > +// Use header files in source directory to avoid compilation compatibility problems. > +#include "../../../include/uapi/linux/perf_event.h" > +#include "../../../include/uapi/linux/bpf.h" > + > // non-UAPI kernel data structures, used in the .bpf.c BPF tool component. > > // Just the fields used in these tools preserving the access index so that > -- > 2.30.GIT >
Hello, On 2023/5/10 2:21, Arnaldo Carvalho de Melo wrote: > Em Tue, May 09, 2023 at 06:36:49AM +0000, Yang Jihong escreveu: >> Currently, vmlinux.h uses the bpf.h and perf_event.h header files in the >> system path. If the header files in compilation environment are old, >> compilation may fail. For example: >> >> /home/yangjihong/linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:151:27: error: field has incomplete type 'union perf_sample_weight' >> union perf_sample_weight weight; > > > Can this be solved in the Makefile directives for building BPF targets? > OK, will send v2 patch, use Makefile to specify path of header file that is preferentially used. Pls check whether the solution is OK. Thanks, Yang
diff --git a/tools/perf/util/bpf_skel/vmlinux.h b/tools/perf/util/bpf_skel/vmlinux.h index 449b1ea91fc4..af79bcc4c4b7 100644 --- a/tools/perf/util/bpf_skel/vmlinux.h +++ b/tools/perf/util/bpf_skel/vmlinux.h @@ -1,11 +1,13 @@ #ifndef __VMLINUX_H #define __VMLINUX_H -#include <linux/bpf.h> #include <linux/types.h> -#include <linux/perf_event.h> #include <stdbool.h> +// Use header files in source directory to avoid compilation compatibility problems. +#include "../../../include/uapi/linux/perf_event.h" +#include "../../../include/uapi/linux/bpf.h" + // non-UAPI kernel data structures, used in the .bpf.c BPF tool component. // Just the fields used in these tools preserving the access index so that