From mboxrd@z Thu Jan 1 00:00:00 1970 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 B4C34C433EF for ; Fri, 7 Jan 2022 03:30:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345842AbiAGDat (ORCPT ); Thu, 6 Jan 2022 22:30:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344897AbiAGDas (ORCPT ); Thu, 6 Jan 2022 22:30:48 -0500 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DE64C061245 for ; Thu, 6 Jan 2022 19:30:48 -0800 (PST) Received: by mail-io1-xd34.google.com with SMTP id o7so5538508ioo.9 for ; Thu, 06 Jan 2022 19:30:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=VAEkU2R1UQj31evD5cMUh51QG6EoSzvLakj58aqdxzs=; b=KFSkZYzz72P5yYwPIFLx0T1WyC3G8o5ShliJQxbkMCU7NKYrRp9g021aysoTHd7+rw unD0Nc6+BmUX7gQ22Q2DFrZmElLojiRK5udFCdnEoSdYUFcdNRkWOmzOU8/7GhZrV9Ir MyrbCh7SeqgF/BXfEqQnHiLILv63fu8fyo6hQYqM+bD85WdtVyUh7tVoqWBaO/JO56d9 a4CBRwtCA06pfTAytVycIVim79WMvfbRVnR5ldw1g79Jq4VDha6DleVOTrh4IqqICuWw 4g6SGmUKPFJIijy9N7Bx9PPHYChNCZij8+7nvDMtZgSS3jH3WlcOHaP4IJuwDVbIdSbJ UvxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=VAEkU2R1UQj31evD5cMUh51QG6EoSzvLakj58aqdxzs=; b=rH5JwYYqwbl4yVX7+JqgxN4Tf0mXyxwXbQLLVDEQJ/SojxIzETRzHDGEdAZmJhkQBC kIeZQdtTVkveS7a1WpX4pLJCE7ktqPOL0ACfu++5DeU5HZ7utgh/YVcsTNDtyvVPtuiY 8YXQ3qTrHm5+UEFUR+P6rJQiynxJNHG9SYwA6j/t4g0I8ZNsjwTlSIZHsHPPgOcKHD3M Idl4PWJeoDf/JVXjTvpIgnLABMjr12FrczJ8jM/pJFNOim5Lkg4vtNDiBJnoQkahne5T pWLYAMEJrTVNeE6O6SjB/kh/zXjcMtzSOy+YcXUoW5sbWm8w8AkHdiaynms/9+edJBsK SrCQ== X-Gm-Message-State: AOAM530+KzEoPOYBedSDN6o3BiArvOuCFEmQCIDa8mddaaxV3WjE+uMe 3R8JHQ7RsiOPyoMQ0Eu2pa0+s93HsVd3EA1pDNx5Bg== X-Google-Smtp-Source: ABdhPJw/YN1CT+MfZfogyNkC2m2mbp7I0eOOsvw2JrnU7NUT+BD4DZ2xo8s4tpkRZSgjdqyvU1JFXFNtLbwr1+QrVVs= X-Received: by 2002:a02:294b:: with SMTP id p72mr23938411jap.263.1641526247488; Thu, 06 Jan 2022 19:30:47 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ian Rogers Date: Thu, 6 Jan 2022 19:30:34 -0800 Message-ID: Subject: Re: perf build broken seemingly due to libbpf changes, checking... To: Andrii Nakryiko Cc: Arnaldo Carvalho de Melo , Song Liu , Jiri Olsa , Steven Rostedt , Jiri Slaby , Namhyung Kim , bpf , Linux Kernel Mailing List , Quentin Monnet Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 6, 2022 at 2:04 PM Ian Rogers wrote: > > On Thu, Jan 6, 2022 at 1:44 PM Andrii Nakryiko > wrote: > > > > On Thu, Jan 6, 2022 at 1:42 PM Ian Rogers wrote: > > > > > > On Thu, Jan 6, 2022 at 11:48 AM Arnaldo Carvalho de Melo > > > wrote: > > > > > > > > Em Thu, Jan 06, 2022 at 04:44:14PM -0300, Arnaldo Carvalho de Melo = escreveu: > > > > > Em Thu, Jan 06, 2022 at 04:34:46PM -0300, Arnaldo Carvalho de Mel= o escreveu: > > > > > > After merging torvalds/master to perf/urgent I'm getting this: > > > > > > > > > > > > util/bpf-event.c:25:21: error: no previous prototype for =E2=80= =98btf__load_from_kernel_by_id=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > > > 25 | struct btf * __weak btf__load_from_kernel_by_id(__u32 i= d) > > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > util/bpf-event.c:37:1: error: no previous prototype for =E2=80= =98bpf_object__next_program=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > > > 37 | bpf_object__next_program(const struct bpf_object *obj, = struct bpf_program *prev) > > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > util/bpf-event.c:46:1: error: no previous prototype for =E2=80= =98bpf_object__next_map=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > > > 46 | bpf_object__next_map(const struct bpf_object *obj, cons= t struct bpf_map *prev) > > > > > > | ^~~~~~~~~~~~~~~~~~~~ > > > > > > util/bpf-event.c:55:1: error: no previous prototype for =E2=80= =98btf__raw_data=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > > > 55 | btf__raw_data(const struct btf *btf_ro, __u32 *size) > > > > > > | ^~~~~~~~~~~~~ > > > > > > cc1: all warnings being treated as errors > > > > > > make[4]: *** [/var/home/acme/git/perf/tools/build/Makefile.buil= d:96: /tmp/build/perf/util/bpf-event.o] Error 1 > > > > > > make[4]: *** Waiting for unfinished jobs.... > > > > > > util/bpf_counter.c: In function =E2=80=98bpf_target_prog_name= =E2=80=99: > > > > > > util/bpf_counter.c:82:15: error: implicit declaration of functi= on =E2=80=98btf__load_from_kernel_by_id=E2=80=99 [-Werror=3Dimplicit-functi= on-declaration] > > > > > > 82 | btf =3D btf__load_from_kernel_by_id(info_linear= ->info.btf_id); > > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > util/bpf_counter.c:82:13: error: assignment to =E2=80=98struct = btf *=E2=80=99 from =E2=80=98int=E2=80=99 makes pointer from integer withou= t a cast [-Werror=3Dint-conversion] > > > > > > 82 | btf =3D btf__load_from_kernel_by_id(info_linear= ->info.btf_id); > > > > > > | ^ > > > > > > cc1: all warnings being treated as errors > > > > > > make[4]: *** [/var/home/acme/git/perf/tools/build/Makefile.buil= d:96: /tmp/build/perf/util/bpf_counter.o] Error 1 > > > > > > > > > > > > I'm checking now... > > > > > > > > > > > > BTW I test perf builds with: > > > > > > > > > > > > make -k BUILD_BPF_SKEL=3D1 CORESIGHT=3D1 PYTHON=3Dpython3 O=3D/= tmp/build/perf -C tools/perf install-bin && git status && perf test python > > > > > > > > > > Nevermind, this was due to a patch by Ian Rogers I was testing, > > > > > bisecting get up to the last patch, since I had merged torvalds/m= aster > > > > > today it got me to a wrong correlation, sorry for the disturbance= . > > > > > > > > > > For reference, this is the patch: > > > > > > > > > > http://lore.kernel.org/lkml/20220106072627.476524-1-irogers@googl= e.com > > > > > > > > Ian, I have libbpf-devel installed: > > > > > > > > =E2=AC=A2[acme@toolbox perf]$ rpm -qa | grep libbpf > > > > libbpf-0.4.0-1.fc34.x86_64 > > > > libbpf-devel-0.4.0-1.fc34.x86_64 > > > > =E2=AC=A2[acme@toolbox perf]$ > > > > > > > > But I'm not using LIBBPF_DYNAMIC=3D1, so you can't just give preced= ence to > > > > system headers for all of the homies in tools/lib/. > > > > > > > > I bet that if I remove the libbpf-devel package it works, yeah, jus= t > > > > tested. So we need to make those overrides dependent on using > > > > LIBBPF_DYNAMIC=3D1, LIBTRACEEVENT_DYNAMIC=3D1, etc and avoid the bi= g hammer > > > > that is -Itools/lib/, using a more finegrained approach, right? > > > > > > Ugh, this is messy. The -I for tools/lib is overloaded and being used > > > in tools/perf/util/bpf-event.c so that bpf/bpf.h, bpf/btf.h and > > > > can you do `make install` for libbpf instead and have it install > > headers into a dedicated target directory which can be added into -I > > search path. Quentin did this for all the other libbpf users in kernel > > tree (bpftool, resolve_btfids, etc) and it works great. > > This sounds good to me, and being able to borrow code from bpftool > should make writing it is straightforward. I'll try to find time to do > a patch, but I don't mind someone getting there before me :-) So tools/lib also provides subcmd, symbol and api. These will need Makefiles to allow an install and likely the header file structure altering. This seems like too big a fix for the next 5.16rc, wdyt? Thanks, Ian > > > bpf/libbpf.h can be found. Likewise, for tools/perf/util/debug.c it i= s > > > used to pick up traceevent/event-parse.h. > > > > > > Assuming LIBBPF_DYNAMIC=3D1 and LIBTRACEEVENT_DYNAMIC=3D1 then we ge= t > > > different combinations of: > > > libtraceevent >=3D 1.3 && libbpf >=3D 0.6 - -I is broken for debug.c, > > > -idirafter okay > > > libtraceevent >=3D 1.3 && libbpf < 0.6 - -I is broken for debug.c, > > > -idirafter broken for bpf-event.c > > > libtraceevent < 1.3 && libbpf >=3D 0.6 - -I should build okay but > > > headers mismatched, -idirafter okay > > > libtraceevent < 1.3 && libbpf < 0.6 - -I will fail to link > > > bpf-event.c, -idirafter broken for bpf-event.c > > > > > > As the choice of -I and -idirafter are binary then there will always > > > be a way to break the build. We could modify the build so that the > > > -I/-idirafter only applies to the affected C files. This postpones th= e > > > problem to when libbpf and libtracevent are in the same file, which > > > doesn't happen currently. I think if you want the dynamic behavior > > > then you need to use idirafter. > > > > > > Thanks, > > > Ian