From patchwork Fri Feb 16 22:20:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 202383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp22632dyc; Fri, 16 Feb 2024 14:20:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVuwqUjqoAkbF3hhWDdJ8Jk3pNYudk5vVXjhtnS8IcgUnOB3Sh0r8KeU+9zqk++I+HwnQcgoA0h+Aom+CVvWmX5CvL7oQ== X-Google-Smtp-Source: AGHT+IFPf8K6KAEWnUmVWK1PR9lwzV/KIA+ZVl6bVwls1Gmp1sAu+qlZSKGcHb/feG4YegTt59x2 X-Received: by 2002:a05:6a00:d5c:b0:6e0:df2d:e7fe with SMTP id n28-20020a056a000d5c00b006e0df2de7femr7326192pfv.11.1708122046703; Fri, 16 Feb 2024 14:20:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708122046; cv=pass; d=google.com; s=arc-20160816; b=SdSYhb94+03eELfO0csXYzuCMlXio4qqd2gMj4nNR1zbswEfjQlDNCQbLWBoKOuo6R 78dBMnTIDxrYF2omMfs2iYsjP7LfVEJ4oq215HY4ToyrYgCdrwmvHnPtopfhenkLoxvK 3/sfPSVBhD+J2aggD4hM7SwtiGrEynTfQ5ME18m7Jj2qww9ilPUMmVMNQXnb67zeRtm6 tHN8K8pI61XUFJBQPbtgajT9dnSwnCGOj6XJVDcQux+3eUUenpWhqEP9LSBegNOtGJp8 4OeKt1EvIeX2TQZs0TpIUXeWPnjnu2pSBInuQghQ8x3PfsCBKxkEYtIMNOW+A8uRKMkp /DNQ== 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=CrbTPV8FHS1s3dPHd9Z7qHEM4cgrA9yQ6XyWv+4Fj6o=; fh=LHoRBkCV7YFtute1bxRvAv2KoY1+DE4brpr3wmlFNFk=; b=X3i4LksvFtyKzAuMV8D7CXulHvC8HLorEkrngoaZo3RaqFSyVWk2zwoEyUuk2rWtmT URTY8UNhBK48ca37/Ly5yLx3aNHr+r+h0XF4+ULCyKvI+6KGm5Tn9yuQvaAz/mw8DLr2 6dKWyIpqaDLFfOm84jIfxIaJ9gYPLVnomMk+qt/tFxLPoM3A9/KXuTnMgcaGad4WHtsg FNcJ+b25yxXYo5cWFYoQSzBOhq56tIz/VgSPAl35/3HJel9dSkhLnk6ncQpJ4w1Jo1H4 /sAgQaLxYFRL4JZxIR8XZDg73cNCLWXxsC9Fc+7Rtjb5NYtqGzkYaQBPeyQfVrNnlhwa Uzlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=orfjmu27; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69397-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k14-20020aa788ce000000b006ddc43ddc61si552982pff.257.2024.02.16.14.20.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 14:20:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=orfjmu27; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69397-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 45E082882E0 for ; Fri, 16 Feb 2024 22:20:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A63F214831E; Fri, 16 Feb 2024 22:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="orfjmu27" 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 09078146007; Fri, 16 Feb 2024 22:20:27 +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=1708122028; cv=none; b=f+R51lvo7AtBfv9aA12STH0V2XrsakpKoPlHvCmgb95d7JD/2hUC89A+fM08Gbt3F3vPrdHVQp3cEdtuVYTQRSCprEwTRsSRHFrftY3JXR+sJnhyxfqUBdQzEaxt5JSK/9MmaIX3kBzOzbhbtLNZ0VyUDNe+orcmhltbSmPVvHI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708122028; c=relaxed/simple; bh=2Xx8Z5pTwI2JW5qD969uln16RftePq1Ha6Tf8/kMnL4=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=THNZ13up/mkRyxymdEvF8vH8cXb2x++jnZI5rG0rf9OAz0jLm0/nfw9X5DN2esU2tFVUYsW9GzhUk9HJIDzRfr60EKt9I+5fyND3q7EnoGf1cYtL7CrdSRn2qsBWjHO0KfXE+427joJg6Iit6Y8K1jVRE2IHKrPbnVSDKbr5x6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=orfjmu27; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1984C433C7; Fri, 16 Feb 2024 22:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708122027; bh=2Xx8Z5pTwI2JW5qD969uln16RftePq1Ha6Tf8/kMnL4=; h=Date:From:To:Cc:Subject:From; b=orfjmu27b7csWhaDNboaStMb/nFRea8q/SSJhSGYaj4d78xi192uOHccp9i9RyYUN zml5QwcrVnM80FLSzzUT4a21P4+mRk1DvteGM7mwKL/k5U9r48ndZYLFg0ZU5RSl4a T/3Wwua1Vwo2XJE8rczRjRl2vRPn1uY+iJd3CHKSDPKetJOILiuDGDSrOdGDvabzJ7 6N8V+2AfFNyG6j77GM4OXMVVNJRiWZNf/VorhXQ+9GNMOcRE0E58QMQAwUVxZ0wloU Ptf9R7IpGvHKXgAiOgmQd1MncFjSQspDmQEuKBthtzQs7aIEIHsN39HdOggHP4o+Dd 68LN31jyF0Omw== Date: Fri, 16 Feb 2024 19:20:23 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Adrian Hunter , Ian Rogers , Jiri Olsa , Linux Kernel Mailing List , linux-perf-users@vger.kernel.org Subject: [PATCH 1/1 v2] perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789817052609413298 X-GMAIL-MSGID: 1791095783147158954 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. With this linux/bpf.h doesn't need to be included, as its already in the minimalistic tools/perf/util/bpf_skel/vmlinux/vmlinux.h file or what we need comes when generating a vmlinux.h file from BTF info, i.e. when using GEN_VMLINUX_H=1, as noticed by Namyung in a build break before removing linux/bpf.h. Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lore.kernel.org/lkml/Zc-gAKByhLBV_X59@x1 Signed-off-by: Arnaldo Carvalho de Melo --- v2: Remove linux/bpf.h as explained in the commit log message. --- .../util/bpf_skel/augmented_raw_syscalls.bpf.c | 15 +-------------- tools/perf/util/bpf_skel/vmlinux/vmlinux.h | 7 +++++++ 2 files changed, 8 insertions(+), 14 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..0acbd74e8c760956 100644 --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c @@ -6,7 +6,7 @@ * payload expected by the 'perf trace' beautifiers. */ -#include +#include "vmlinux.h" #include #include @@ -22,19 +22,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, };