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 71A4CC433FE for ; Thu, 6 Jan 2022 22:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244698AbiAFWEk (ORCPT ); Thu, 6 Jan 2022 17:04:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244462AbiAFWEj (ORCPT ); Thu, 6 Jan 2022 17:04:39 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E463C061201 for ; Thu, 6 Jan 2022 14:04:39 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id b1so3202154ilj.2 for ; Thu, 06 Jan 2022 14:04:39 -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=5lCMFrmKhRkcXXvDt5cwlZjJinUAktC4NqCvpS04174=; b=pD1rFucmR46qqxkXoaSy+x+Q68ByrPXZh6xWdlE74Hj9mIC0VXltNLqQ88I/xWdglD iJdVcL8F3HZfeChQ/0X2+ClqV8RvGQI9ADtSfznZWr7tylswqN0WeXrkImoitvKuOq/r 7LjiZstSSYgxWeWeZDgVWZUHggdqwlFd2uzkadgzQBgGvxwctaZo7VEMjm/asziO32GN 1EPueFX8h9RWS+3nTWwKMPoQjSOgq8T4ZcysL9EQv/mdRgogvicJPG5d3UW6ZTUFH2LA 8xriR0KFf4UBxjhDsKST9Sbr0CAXLCkvm/q7HQ2BFrWKel+diYAnjfBkpW0/7/0tpxI6 zQ6w== 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=5lCMFrmKhRkcXXvDt5cwlZjJinUAktC4NqCvpS04174=; b=Z8veR9TcZLlBHm/uNcZ7z0ueQ5Ohr+NLqoSSB8T3mlIBP/SSWV5rSZTLQcTKUsK6jI NqK4sb7Xof2+LagQdpAS+boSOHQXp+WPwrPl2n86+kmQdi5vVwsWkq4VRiD8bLjgqmga IiNJOgyCkn+XPI1sSkW8Wl6z8VkhCi2I+7sYQLpbHbSJ8TKVhu7EFafxrjsbmUk+lRj0 cD7wkkHgO76eHBjjXWjo7Nv2PA1frmE+s53yzxuoEWTshUdBRPcWnaa/u/4p9WuqQnb0 lO0I12/2CB+fwhc2+sdiuUJ3rKVG4GZQOKP9v0RFQqkv800dkOkBVOE4+jUrG+nic1Pa K0QQ== X-Gm-Message-State: AOAM533JrVgo6PbkI5meTWXA0XDWpb7qsP0rrIakf9PD979raXim/yNT KU/UitL+pF0lXdQUSpGhuRk3XnYArD+LNibpMoiwYA== X-Google-Smtp-Source: ABdhPJzAMAQgMooGtqRDN40j09UsYvwRjjhj9krflCLslxZqCmlo0k1UyQ8SX0b/aozYQqrCNQo4a6eaX9DRQi9ppgM= X-Received: by 2002:a92:dd87:: with SMTP id g7mr5165224iln.174.1641506678460; Thu, 06 Jan 2022 14:04:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ian Rogers Date: Thu, 6 Jan 2022 14:04:25 -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 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 es= creveu: > > > > Em Thu, Jan 06, 2022 at 04:34:46PM -0300, Arnaldo Carvalho de Melo = 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 id) > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > util/bpf-event.c:37:1: error: no previous prototype for =E2=80=98= bpf_object__next_program=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > > 37 | bpf_object__next_program(const struct bpf_object *obj, st= ruct bpf_program *prev) > > > > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > > > > util/bpf-event.c:46:1: error: no previous prototype for =E2=80=98= bpf_object__next_map=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > > 46 | bpf_object__next_map(const struct bpf_object *obj, const = struct bpf_map *prev) > > > > > | ^~~~~~~~~~~~~~~~~~~~ > > > > > util/bpf-event.c:55:1: error: no previous prototype for =E2=80=98= btf__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.build:= 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 function= =E2=80=98btf__load_from_kernel_by_id=E2=80=99 [-Werror=3Dimplicit-function= -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 bt= f *=E2=80=99 from =E2=80=98int=E2=80=99 makes pointer from integer without = 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.build:= 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/tm= p/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/mas= ter > > > > 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@google.= 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 preceden= ce to > > > system headers for all of the homies in tools/lib/. > > > > > > I bet that if I remove the libbpf-devel package it works, yeah, just > > > tested. So we need to make those overrides dependent on using > > > LIBBPF_DYNAMIC=3D1, LIBTRACEEVENT_DYNAMIC=3D1, etc and avoid the big = 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 :-) Thanks, Ian > > bpf/libbpf.h can be found. Likewise, for tools/perf/util/debug.c it is > > used to pick up traceevent/event-parse.h. > > > > Assuming LIBBPF_DYNAMIC=3D1 and LIBTRACEEVENT_DYNAMIC=3D1 then we get > > 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 the > > 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