Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp117441rwi; Thu, 3 Nov 2022 18:08:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yQDWS/VjJyOg7BJ4EWwcrMOT34hyS8+LxLHH+X133WOZMhWdGrKxDqJLZiunGyZAQcawr X-Received: by 2002:a17:907:a04c:b0:7ae:2eb5:8bd1 with SMTP id gz12-20020a170907a04c00b007ae2eb58bd1mr1330448ejc.571.1667524088341; Thu, 03 Nov 2022 18:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667524088; cv=none; d=google.com; s=arc-20160816; b=z7o8EWFV+GNhGVFzW+/R8pO41AGphLyp5UUBaEWjJ84dVJgq3si3MFqmcUDg07Y5xI NkMVOEXzo/17o282+xhF+3IcjW1Cyl0lnlT4wDKyn/6t6XAAwJfXw+oy2bcXNNg9yTWK 7hBzQGl++z1ToWRZo/4NmJ99KDPq0G2Y+qgsL2O7wh7QIsc5FOihi3YpM1d7EChPaFhz 6CNlbulguoQspm6MZrX8pxCWu/GlTMRrk5fnLoON57bPFCXPwbPjxOGB7G2lufC8lsbO nZX3/E/0k9EtCpiWQeAjD0mVbx+v1Ir6pYXK0fwWXNZfWp9A7v+Rm2C73fxIxleKas7f 448A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rhI0G8i5nPvXJL+U5cE5OIb3/1vgjnQE20clx0pYwIA=; b=hXQckN+Wfu7kEnmcFbw0FFwX/EvnOp3rt/UQeTOBpUTxE/1AMFs6LPLO+XPKz37TPW 0oaq0TEHRthM5yA2DqAROg3YUZ/W7GH4I17EXk0RF9V1LI9yr3zB2g16Xh1JTVfmKzVd ozR23yvMNqjpuaI/EUF1sBW+9wOuB050JqlZDJoeNpSiM0a+YRUlQmalfsGGt6B4w5p4 ENIDuPm9rOmla6ar7EQGc05NYXWJ30Fv/8hwyvmnFqsjPH6fXj9H53SGVEpw+4bWUARb smu97N635p0c2sthvSh1PcgYEkSRugjsNrdJZDkJs2cjPTY5D1kczM0IEcDW+e19bVP5 Ny4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A6NiF9Ia; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb38-20020a170907162600b007a39ad3da43si3142106ejc.714.2022.11.03.18.07.44; Thu, 03 Nov 2022 18:08:08 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A6NiF9Ia; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbiKDBFB (ORCPT + 98 others); Thu, 3 Nov 2022 21:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiKDBE6 (ORCPT ); Thu, 3 Nov 2022 21:04:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03523102E; Thu, 3 Nov 2022 18:04:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9513FB829AB; Fri, 4 Nov 2022 01:04:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC96C433D6; Fri, 4 Nov 2022 01:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667523894; bh=k5m4HcM/H4aY8U/2muzNcpORFVLxijrfXYSNOiQeADU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A6NiF9Iaz1HjS67DBuiA29ABpMGsMhrwP/33eq4TrZYomLdoXIgZ/p+caHfxmWSpX kxFzBRi+Dy/FpA+p6WbPgWV8eXBB4/j5F1DtWG7dZn8jLBeMZ4OYw3g1jA5yeHJODo XjbjMi9wdh6df7XEJRmOMK7WFdCgS+vliDKPNqnTfg3NKGkrBw3PplUol5sIdhNNJh tPrgHZ+XLwEZ+ZqybDAy9HRwZhnnkPQfCc8R3uclBMGp3+JogUkFpsNV7MdYByFb+h XaAO+rfAXdAqBPAur8vM2ceJ4SheI21tNAIK8/xVP1iEK+WXpfO0ZW28PDpSH2mjse dgxl5HMoEMwyg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C68334034E; Thu, 3 Nov 2022 22:04:51 -0300 (-03) Date: Thu, 3 Nov 2022 22:04:51 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH v1 6/7] perf trace: 5sec fix libbpf 1.0+ compatibility Message-ID: References: <20221103045437.163510-1-irogers@google.com> <20221103045437.163510-7-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Nov 03, 2022 at 09:21:06PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Thu, Nov 03, 2022 at 03:01:21PM -0700, Ian Rogers escreveu: > > On Thu, Nov 3, 2022 at 2:35 PM Arnaldo Carvalho de Melo wrote: > > > > > > With this: > > > > > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config > > > index d3d3c13a9f25b55c..067a6e56eeacc9fc 100644 > > > --- a/tools/perf/Makefile.config > > > +++ b/tools/perf/Makefile.config > > > @@ -1239,7 +1239,7 @@ includedir = $(abspath $(prefix)/$(includedir_relative)) > > > mandir = share/man > > > infodir = share/info > > > perfexecdir = libexec/perf-core > > > -perf_include_dir = lib/perf/include > > > +perf_include_dir = /usr/include > > > perf_examples_dir = lib/perf/examples > > > sharedir = $(prefix)/share > > > template_dir = share/perf-core/templates > > > diff --git a/tools/perf/examples/bpf/augmented_raw_syscalls.c b/tools/perf/examples/bpf/augmented_raw_syscalls.c > > > index 13c72fd602c307e4..98a2731c011339ba 100644 > > > --- a/tools/perf/examples/bpf/augmented_raw_syscalls.c > > > +++ b/tools/perf/examples/bpf/augmented_raw_syscalls.c > > > @@ -17,8 +17,9 @@ > > > #include > > > #include > > > #include > > > -#include > > > -#include > > > + > > > +typedef char bool; > > > +typedef int pid_t; > > > > > > /* bpf-output associated map */ > > > struct __augmented_syscalls__ { > > > @@ -94,6 +95,30 @@ struct pids_filtered { > > > __uint(max_entries, 64); > > > } pids_filtered SEC(".maps"); > > > > > > +/* > > > + * Desired design of maximum size and alignment (see RFC2553) > > > + */ > > > +#define _K_SS_MAXSIZE 128 /* Implementation specific max size */ > > > + > > > +typedef unsigned short sa_family_t; > > > + > > > +/* > > > + * The definition uses anonymous union and struct in order to control the > > > + * default alignment. > > > + */ > > > +struct sockaddr_storage { > > > + union { > > > + struct { > > > + sa_family_t ss_family; /* address family */ > > > + /* Following field(s) are implementation specific */ > > > + char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; > > > + /* space to achieve desired size, */ > > > + /* _SS_MAXSIZE value minus size of ss_family */ > > > + }; > > > + void *__align; /* implementation specific desired alignment */ > > > + }; > > > +}; > > > + > > > struct augmented_args_payload { > > > struct syscall_enter_args args; > > > union { > > > diff --git a/tools/perf/examples/bpf/empty.c b/tools/perf/examples/bpf/empty.c > > > index 3e296c0c53d7d8e2..e4872c48a484f218 100644 > > > --- a/tools/perf/examples/bpf/empty.c > > > +++ b/tools/perf/examples/bpf/empty.c > > > @@ -7,6 +7,6 @@ struct syscall_enter_args; > > > SEC("raw_syscalls:sys_enter") > > > int sys_enter(struct syscall_enter_args *args) > > > { > > > - return 0; > > > + return 1; > > > } > > > char _license[] SEC("license") = "GPL"; > > > diff --git a/tools/perf/util/llvm-utils.c b/tools/perf/util/llvm-utils.c > > > index 2dc7970074196ca8..a5cac85783d8711f 100644 > > > --- a/tools/perf/util/llvm-utils.c > > > +++ b/tools/perf/util/llvm-utils.c > > > @@ -495,7 +495,7 @@ int llvm__compile_bpf(const char *path, void **p_obj_buf, > > > > > > snprintf(linux_version_code_str, sizeof(linux_version_code_str), > > > "0x%x", kernel_version); > > > - if (asprintf(&perf_bpf_include_opts, "-I%s/bpf", perf_include_dir) < 0) > > > + if (asprintf(&perf_bpf_include_opts, "-I%s/", perf_include_dir) < 0) > > > goto errout; > > > force_set_env("NR_CPUS", nr_cpus_avail_str); > > > force_set_env("LINUX_VERSION_CODE", linux_version_code_str); > > > > > > > > > The connect calls gets served, tomorrow, if you don't beat me I'll apply > > > the series after adding these minimal changes so that we have this > > > working with libbpf 1.0 and then we can move from there, with a switch > > > to a BPF skel, simplest things first, then deal with faults at pointer > > > payload copy, which is another avenue, AFAIK with solutions already. > > > > So I was trying to be clean and not redefine too much. My clang > > command line was: > > > > clang -target bpf -O2 -g -c -I/usr/include/x86_64-linux-gnu > > -D__NR_CPUS__=16 -D__x86_64__=1 > > Sure, I haven't even checked why that is needed, maybe its not anymore. > > I just tried the first hunch about the header files, those other > variables maybe were needed long ago, maybe its just more stuff to trow > out in the direction of doing it the modern way, BPF skels. > > > It'd be nice to just drop the need for __NR_CPUS__ and have it be > > dynamic, the skeleton approach would require this. Not sure how to > > workaround the x86 define and path :-/ Perhaps send out your changes > > for review and I can look at and test them. > > Done deal, early tomorrow I'll send it and wait for your review. Did it now, please take a look at my tmp.perf/core branch. Tomorrow I'll add the Tested-by tags. - Arnaldo