Message ID | Zb1EBzpBn4s-mIa8@x1 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-50486-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp656831dyc; Fri, 2 Feb 2024 11:35:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeuEQThAhp58rkkbb3h113/1sUQOXMf67kjLDTsQ4aQa634fYJaktY6aqYi/Kzz0HEcitP X-Received: by 2002:a17:906:3059:b0:a37:35de:c71f with SMTP id d25-20020a170906305900b00a3735dec71fmr435373ejd.29.1706902554301; Fri, 02 Feb 2024 11:35:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706902554; cv=pass; d=google.com; s=arc-20160816; b=L1WVayYQSD/OudeR12UJ8rfIbPuAWSnUvInlnNX1laSpRWuf2RRTCd8buCDDudKhJe iBkaOAioh8/mq4/spFeVxEMYQSgp/g1jM2OXO4gpQeJMhyFdV5topsZd2w9RiM/vQCPz dIrGHRgoC1RUkMr3Z245L+vTQOhEsuHbdSC1Kp1x26Ci1nXsCtqJCQA2NHZhnorR0xOI jt3JOGxmpW6SXwAojT9c8VCBru5JNuU3uC8vaqw3G5Z5D5/W9QxaKPWuTayonxuq1sCb BfyUxmt9rzct/ujzGwuO3xpqspUt0NXRdz449swm4MWii7q3wH8RqUg4y6hOXGBYoEJl ybuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=QqN90ubLd5pBQkGbeDHn3t4n26qdulFCo/dDz3eO9Tw=; fh=7pSfBT+zwAUkb39tJlu/+XqHR5pP88aQuu1DjZalboY=; b=nb2jA+TqmpSqckdoy14Asi4MYNkFWusZ0W2RJPwByHBwuCa27x9etER7ygCLPeGXNh mWI6h+bfG7kU74l4F+ayWpj1s3QAzf5UPXAtsUBl9Z4SbtWn2jcLFZClf+DyBtEDX5Mw C/gjW2kceEGmBwGBYmbsRwy/pG7Mvk0AvL1+ItbEcL0n7ZzSGH8kbdS3EY4DNljklJoQ 7+ZEKM6xeLdanj3sRE5tYdgrsRVOtiC5s87v4ajPhClfk18RVfXKPlTOhOoB2DLDf0p5 JDT7IyeYudCvvkgc+UqAqV2GVDs9NVuCTfGXwnx8Zk7K84OL0IBiG6WMstddPLm34kq0 ppyg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="kWwGOR/F"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50486-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50486-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUON00/LZcMyXFn2e20f/C+hV2TggLs5tTmOdscJcUY/3ymGzQUFDJuA9wz84v8io82tbHlcY0+vlMcYMVbfWI1mg55WQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w15-20020a170906130f00b00a36fb4ca3d8si1010049ejb.357.2024.02.02.11.35.54 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 11:35:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50486-ouuuleilei=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=@kernel.org header.s=k20201202 header.b="kWwGOR/F"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50486-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50486-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 E4C111F27F71 for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 19:35:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCFB78060B; Fri, 2 Feb 2024 19:35:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kWwGOR/F" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 49BFF15E5D6 for <linux-kernel@vger.kernel.org>; Fri, 2 Feb 2024 19:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706902539; cv=none; b=P2V61PFsUPF5XQ9UGeqZOgJRmAFYia0M9FWyNggFo9TJGYXC2jYgrn4wzYgQCdyvPSLqk3XbmsYzMZ1EDUXnMdae0m7H16jdAVLsbjFcZdpZ+nKs9/w8f6NsUvNQG8JjU7vvIWPLOd4yEWZRCQInZyZOp6g6FvI8aNvgnI1ee8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706902539; c=relaxed/simple; bh=U0zfGUMFO4K2m1luVI9jAWwNldzXk9o9jhSpjNh1xo4=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=kprRwjv/U0UZLL85ts+CrdOqhIJlE2fZiK1XxMRIGL3ma813rmWevfajUG0RjaKD4M3M+5OLSafihnA5Ojz8ZTif64vOtX6FM7bs8U4lwCebicXjnEP9hdKSb4X8ehJ1Xk65R+mvhu1iKQcIhdDeBId2B0GNXAKaf1FdICFagZM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kWwGOR/F; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3856CC433F1; Fri, 2 Feb 2024 19:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706902538; bh=U0zfGUMFO4K2m1luVI9jAWwNldzXk9o9jhSpjNh1xo4=; h=Date:From:To:Cc:Subject:From; b=kWwGOR/FeQWTnU2aXMjWm+NS9P7nlvduLR/k8z5W2nmBun11QfN3xFQGcAaNE92P+ E2tgoX8/ls7KaD6vlb7kxKXBFyAX7/9HT5r6UqaZvZGJTJimXwx3fjSB6hZ0fO1HET fiq4O+oEss5Upl9O7SuEoygN1YWmZU5yuyPFKuP+FHJfwDhkXvZ6bIVbFF8Ix2PklC LdA+pzeBgPCRzvqRd1Jy9ip5mxKaX5hlLyh8dmG8q+VKaRLucYrLN6xK1OvFsPQ/T5 CxeQ7FfksXR2NBozbztkVenz73DIFSMJAfHkDSgvS6ld+RyKeB8mpVlFzAxCL51Qh3 WT9D8W8aeWlnQ== Date: Fri, 2 Feb 2024 16:35:35 -0300 From: Arnaldo Carvalho de Melo <acme@kernel.org> To: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com>, Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org> Subject: [PATCH 1/1] perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h Message-ID: <Zb1EBzpBn4s-mIa8@x1> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789817052609413298 X-GMAIL-MSGID: 1789817052609413298 |
Series |
[1/1] perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h
|
|
Commit Message
Arnaldo Carvalho de Melo
Feb. 2, 2024, 7:35 p.m. UTC
If we instead decide to generate vmlinux.h from BTF info, it will be
there:
$ pahole timespec64
struct timespec64 {
time64_t tv_sec; /* 0 8 */
long int tv_nsec; /* 8 8 */
/* size: 16, cachelines: 1, members: 2 */
/* last cacheline: 16 bytes */
};
$
pahole manages to find it from /sys/kernel/btf/vmlinux, that is
generated from the kernel types.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
.../util/bpf_skel/augmented_raw_syscalls.bpf.c | 14 +-------------
tools/perf/util/bpf_skel/vmlinux/vmlinux.h | 7 +++++++
2 files changed, 8 insertions(+), 13 deletions(-)
Comments
On Fri, Feb 2, 2024 at 11:35 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > If we instead decide to generate vmlinux.h from BTF info, it will be > there: > > $ pahole timespec64 > struct timespec64 { > time64_t tv_sec; /* 0 8 */ > long int tv_nsec; /* 8 8 */ > > /* size: 16, cachelines: 1, members: 2 */ > /* last cacheline: 16 bytes */ > }; > > $ > > pahole manages to find it from /sys/kernel/btf/vmlinux, that is > generated from the kernel types. > > Cc: Adrian Hunter <adrian.hunter@intel.com> > Cc: Ian Rogers <irogers@google.com> > Cc: Jiri Olsa <jolsa@kernel.org> > Cc: Namhyung Kim <namhyung@kernel.org> > Link: https://lore.kernel.org/lkml/ > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Thanks, Namhyung > --- > .../util/bpf_skel/augmented_raw_syscalls.bpf.c | 14 +------------- > tools/perf/util/bpf_skel/vmlinux/vmlinux.h | 7 +++++++ > 2 files changed, 8 insertions(+), 13 deletions(-) > > diff --git a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c > index baecffbece14fb68..d3b672593c540259 100644 > --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c > +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c > @@ -6,6 +6,7 @@ > * payload expected by the 'perf trace' beautifiers. > */ > > +#include "vmlinux.h" > #include <linux/bpf.h> > #include <bpf/bpf_helpers.h> > #include <linux/limits.h> > @@ -22,19 +23,6 @@ > > #define MAX_CPUS 4096 > > -// FIXME: These should come from system headers > -#ifndef bool > -typedef char bool; > -#endif > -typedef int pid_t; > -typedef long long int __s64; > -typedef __s64 time64_t; > - > -struct timespec64 { > - time64_t tv_sec; > - long int tv_nsec; > -}; > - > /* bpf-output associated map */ > struct __augmented_syscalls__ { > __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); > diff --git a/tools/perf/util/bpf_skel/vmlinux/vmlinux.h b/tools/perf/util/bpf_skel/vmlinux/vmlinux.h > index ab84a6e1da5eedb3..e9028235d7717b59 100644 > --- a/tools/perf/util/bpf_skel/vmlinux/vmlinux.h > +++ b/tools/perf/util/bpf_skel/vmlinux/vmlinux.h > @@ -20,6 +20,13 @@ typedef __s64 s64; > > typedef int pid_t; > > +typedef __s64 time64_t; > + > +struct timespec64 { > + time64_t tv_sec; > + long int tv_nsec; > +}; > + > enum cgroup_subsys_id { > perf_event_cgrp_id = 8, > }; > -- > 2.43.0 >
On Fri, Feb 2, 2024 at 6:01 PM Namhyung Kim <namhyung@kernel.org> wrote: > > On Fri, Feb 2, 2024 at 11:35 AM Arnaldo Carvalho de Melo > <acme@kernel.org> wrote: > > > > If we instead decide to generate vmlinux.h from BTF info, it will be > > there: > > > > $ pahole timespec64 > > struct timespec64 { > > time64_t tv_sec; /* 0 8 */ > > long int tv_nsec; /* 8 8 */ > > > > /* size: 16, cachelines: 1, members: 2 */ > > /* last cacheline: 16 bytes */ > > }; > > > > $ > > > > pahole manages to find it from /sys/kernel/btf/vmlinux, that is > > generated from the kernel types. > > > > Cc: Adrian Hunter <adrian.hunter@intel.com> > > Cc: Ian Rogers <irogers@google.com> > > Cc: Jiri Olsa <jolsa@kernel.org> > > Cc: Namhyung Kim <namhyung@kernel.org> > > Link: https://lore.kernel.org/lkml/ > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > Acked-by: Namhyung Kim <namhyung@kernel.org> Hmm.. but it makes it fail to build with GEN_VMLINUX_H=1. Thanks, Namhyung CLANG linux/tools/perf/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o In file included from util/bpf_skel/augmented_raw_syscalls.bpf.c:10: linux/tools/include/uapi/linux/bpf.h:55:2: error: redefinition of enumerator 'BPF_REG_0' BPF_REG_0 = 0, ^ linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:46833:2: note: previous definition is here BPF_REG_0 = 0, ^
On Mon, Feb 05, 2024 at 03:16:25PM -0800, Namhyung Kim wrote: > On Fri, Feb 2, 2024 at 6:01 PM Namhyung Kim <namhyung@kernel.org> wrote: > > On Fri, Feb 2, 2024 at 11:35 AM Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > > If we instead decide to generate vmlinux.h from BTF info, it will be > > > there: > > > $ pahole timespec64 > > > struct timespec64 { > > > time64_t tv_sec; /* 0 8 */ > > > long int tv_nsec; /* 8 8 */ > > > }; > > Acked-by: Namhyung Kim <namhyung@kernel.org> > Hmm.. but it makes it fail to build with GEN_VMLINUX_H=1. > CLANG linux/tools/perf/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o > In file included from util/bpf_skel/augmented_raw_syscalls.bpf.c:10: > linux/tools/include/uapi/linux/bpf.h:55:2: error: redefinition of > enumerator 'BPF_REG_0' > BPF_REG_0 = 0, > ^ > linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:46833:2: note: > previous definition is here > BPF_REG_0 = 0, > ^ Right, the following oneliner fixes it (the minimalistic pre-built vmlinux.h we carry when not using GEN_VMLINUX_H=1 already has it), I'll squash it, do some container test builds and resend. - Arnaldo diff --git a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c index d3b672593c540259..0acbd74e8c760956 100644 --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c @@ -7,7 +7,6 @@ */ #include "vmlinux.h" -#include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <linux/limits.h>
diff --git a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c index baecffbece14fb68..d3b672593c540259 100644 --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c @@ -6,6 +6,7 @@ * payload expected by the 'perf trace' beautifiers. */ +#include "vmlinux.h" #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <linux/limits.h> @@ -22,19 +23,6 @@ #define MAX_CPUS 4096 -// FIXME: These should come from system headers -#ifndef bool -typedef char bool; -#endif -typedef int pid_t; -typedef long long int __s64; -typedef __s64 time64_t; - -struct timespec64 { - time64_t tv_sec; - long int tv_nsec; -}; - /* bpf-output associated map */ struct __augmented_syscalls__ { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); diff --git a/tools/perf/util/bpf_skel/vmlinux/vmlinux.h b/tools/perf/util/bpf_skel/vmlinux/vmlinux.h index ab84a6e1da5eedb3..e9028235d7717b59 100644 --- a/tools/perf/util/bpf_skel/vmlinux/vmlinux.h +++ b/tools/perf/util/bpf_skel/vmlinux/vmlinux.h @@ -20,6 +20,13 @@ typedef __s64 s64; typedef int pid_t; +typedef __s64 time64_t; + +struct timespec64 { + time64_t tv_sec; + long int tv_nsec; +}; + enum cgroup_subsys_id { perf_event_cgrp_id = 8, };