Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6676410rwl; Mon, 9 Jan 2023 11:25:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtczq9KZzTyjnSdWP8HPfqQd6/jdJlDUrasuB1o1f7WdXxJZ9iTyHLN2Wx/2vS+ttuFWBPp X-Received: by 2002:a17:907:d50e:b0:81f:fc05:2ba0 with SMTP id wb14-20020a170907d50e00b0081ffc052ba0mr57156422ejc.2.1673292348035; Mon, 09 Jan 2023 11:25:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673292348; cv=none; d=google.com; s=arc-20160816; b=jOC4K3a5/N63wRhLwriSebHiQhKceb4DYk+UU2HTQ1tGEbbQ7RSIYjqr6lO2ry+R7V MqwXH/Nsz6mvEgdfEXYbg15pNPm2Fs0XpHwfTIeoBvr7j7s9RLGUbgt9D+pU4jjsCPUa SrNCAVAU+apU8zQwobuIvJYM1PuhDpPI3m2nL9ohN5LuKyqaKAXbl2nubdrpLTOTR/oc Cqkt17qYxaD4mebM5LIKxtUb0zqLfZYcPVfizeYXsRbJdJBgeAP/XL0GmOfG7sJye+vu 8JxoA+MbnCjvPTNfB4gKgbLxi6kL6B+W2pHOY6mHMQmcrpS6uB+jZpCOPKCT2kx8p8gg EvDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Wv9Qlp//d2HQ8m+fdxA11p5JwKQ7sVVltk9S+MocsQk=; b=0f+SN02ikQwq3KsiyZQ9t1NhofOVl8gQmY6kFkE620hynfoJGMeY6YU7k9R8l0091A x8uFfykPwjxhim0Epx4CELO2GxyBwZhh7MApzh+PCciJ4NJAP2nkcbN4XPDlsToNte2L wvBwUS3Sm2VWAFp7/zEtTYZoQ8Vvl6KrftqJEpikwoSnVm8C46OKRFqUwwGXp26WVE2m CA6xm27fBbpyulsiq8BphCAnMmXLtWhzcM0rqy1J3uWhMRMmXel/TdoMYsHgZv5xBJfo Nsh0AY3NqKKbgbci/Fb6ylE0/OQ80+O4QsmWR0hAWLU0KjoDC7IzQ12/oTHZDlG+3bw9 YRDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ik1z28RO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ef8-20020a05640228c800b00486ac69b9f3si9284014edb.327.2023.01.09.11.25.12; Mon, 09 Jan 2023 11:25:48 -0800 (PST) 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=@google.com header.s=20210112 header.b=ik1z28RO; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233170AbjAISkX (ORCPT + 53 others); Mon, 9 Jan 2023 13:40:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237072AbjAISjm (ORCPT ); Mon, 9 Jan 2023 13:39:42 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F5713B924 for ; Mon, 9 Jan 2023 10:37:29 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id s9so9145275wru.13 for ; Mon, 09 Jan 2023 10:37:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Wv9Qlp//d2HQ8m+fdxA11p5JwKQ7sVVltk9S+MocsQk=; b=ik1z28ROscuLAtWReqcAjUFVbb42S1cYpK/n/PyKhtuypCrma7yZJtFIw2hMvn6NQX WAS9ydDC5f9JEzO9jxU1ictaTF5sFxT0EwjoUX7TX47OwQA1/kH1+qE2uoevxWE6RTw5 HDYUfJP7L+uHDU6H/FEsd8dfXbw+sXsMKKctVntGogLTgy9GOlAn6O4PfyDjQNIkTAXQ XO2xpkhpJ2JaEADCZyJNst7nW9Arr4QnnGrUVEr6i+uEU2U5WybbNcAuC9vGIBDYY37m 25auEHD034UJdMX/Oq3tuo9Pk2LZRirw0qr/XPnKLkntzeiFWZzUsVGBCgDCRYKB1SGJ wxSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Wv9Qlp//d2HQ8m+fdxA11p5JwKQ7sVVltk9S+MocsQk=; b=fBAlPm4Lr1XKR9b3UwuZ1xwO8iA0LNWkxTbVLWyI10en/xsmNwJ1gKPP5FvSqMxmG3 2PqUkkkfHnVlbEOWldHVbeKIYmks3O+vMUOzYtfaCs2i74GZX8gYQrfVBS4LJLPO007v 9LGiOhvyE7T/xchukSB650IvXyPs3cHL3DJjk8Z6wnTnwsyvWifqvhGcEQFIK/O8zZRE 5sUWtwUZLTuG3FLH/hfg7ZUBwk8H9O8WLD0Fh4Vftn+HxoN3cw0Fru6UA/ptJQ+isWWl Jl0/bePpXxJEMzaS4KffQCmQkxbKZIBhXUlgLPk0YNJVn2gqdIBOF2swybQuJ7ZOJYyx YGNA== X-Gm-Message-State: AFqh2koa+BN/LJooqpYMGwTt4bG7g1iAWjHnKeTrj1b3+TZiPTt69GfH eUxIuqOlYKT9PUjbe1bc7dyg8HFuYn0EF6Tp4a2jUw== X-Received: by 2002:a5d:45d0:0:b0:29c:52c7:3dce with SMTP id b16-20020a5d45d0000000b0029c52c73dcemr779159wrs.375.1673289447507; Mon, 09 Jan 2023 10:37:27 -0800 (PST) MIME-Version: 1.0 References: <20230106151320.619514-1-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Mon, 9 Jan 2023 10:37:15 -0800 Message-ID: Subject: Re: [PATCH v3 1/2] perf build: Properly guard libbpf includes To: Jiri Olsa Cc: Arnaldo Carvalho de Melo , Mike Leach , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, namhyung@kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 On Mon, Jan 9, 2023 at 10:10 AM Jiri Olsa wrote: > > On Mon, Jan 09, 2023 at 12:12:15PM -0300, Arnaldo Carvalho de Melo wrote: > > Em Fri, Jan 06, 2023 at 11:06:46AM -0800, Ian Rogers escreveu: > > > So trying to get build-test working on my Debian derived distro is a > > > PITA with broken feature detection for options I don't normally use. > > > > Its really difficult to have perf building with so many dependent > > libraries, mowing out some should be in order. > > > > > I'll try to fix this. > > > > Thanks. > > > > > In any case I think I've spotted what is really happening here and it > > > isn't a failure but a feature :-D The build is specifying > > > > I get it. > > > > > LIBBPF_DYNAMIC=1 which means you get the libbpf headers from > > > /usr/include. I think the build is trying to do this on a system with > > > an old libbpf and hence getting the failures above. Previously, even > > > though we wanted the dynamic headers we still had a -I, this time for > > > the install_headers version. Now you really are using the system > > > version and it is broken. This means a few things: > > > - the libbpf feature test should fail if code like above is going to fail, > > > > Agreed. > > > > > - we may want to contemplate supporting older libbpfs (I'd rather not), > > > > I'd rather require everybody to be up to the latest trends, but I really > > don't think that is a reasonable expectation. > > > > > - does build-test have a way to skip known issues like this? > > > > Unsure, Jiri? > > I don't think so it just triggers the build, it's up to the features check > to disable the feature if the library is not compatible with perf code > > could we add that specific libbpf call to the libbpf feature check? Looking at the failure closer, the failing code is code inside a feature check trying to workaround the feature not being present. We need to do something like: ``` diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c index 6e9b06cf06ee..a1c3cc230273 100644 --- a/tools/perf/util/bpf-loader.c +++ b/tools/perf/util/bpf-loader.c @@ -33,17 +33,18 @@ #include #ifndef HAVE_LIBBPF_BPF_PROGRAM__SET_INSNS -int bpf_program__set_insns(struct bpf_program *prog __maybe_unused, - struct bpf_insn *new_insns __maybe_unused, size_t new_insn_cnt __maybe_un used) +static int bpf_program__set_insns(struct bpf_program *prog __maybe_unused, + struct bpf_insn *new_insns __maybe_unused, + size_t new_insn_cnt __maybe_unused) { pr_err("%s: not support, update libbpf\n", __func__); return -ENOTSUP; } -int libbpf_register_prog_handler(const char *sec __maybe_unused, - enum bpf_prog_type prog_type __maybe_unused, - enum bpf_attach_type exp_attach_type __maybe_unused, - const struct libbpf_prog_handler_opts *opts __maybe_unused) +static int libbpf_register_prog_handler(const char *sec __maybe_unused, + enum bpf_prog_type prog_type __maybe_unused, + enum bpf_attach_type exp_attach_type __maybe_unused, + const void *opts __maybe_unused) { pr_err("%s: not support, update libbpf\n", __func__); return -ENOTSUP; ``` There are some other fixes necessary too. I'll try to write the fuller patch but I have no means for testing except for undefining HAVE_LIBBPF_BPF_PROGRAM__SET_INSNS. Thanks, Ian > jirka > > > > > But yeah, previous experiences with Andrii were that we can do not too > > costly feature checks, not using .c programs that would fail if some > > required feature wasn't present but instead would just do some grep on a > > header and if some "smell" wasn't scent, just fail the cap query. > > > > - Arnaldo