Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8143919rwb; Tue, 6 Dec 2022 14:47:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5gQhnFhMQiF9wyOa1184E7H6H3Ac6ymtu9yTwz1CNmawiw/NQgJw1BvYlf68quR1WC3SgZ X-Received: by 2002:a05:6a00:1d22:b0:577:16ac:8447 with SMTP id a34-20020a056a001d2200b0057716ac8447mr8833747pfx.56.1670366837366; Tue, 06 Dec 2022 14:47:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670366837; cv=none; d=google.com; s=arc-20160816; b=a7xhOeIhCPT2r58ywz99fW4cGf28tcQEnxJ9s6a6UHmMum5dsZm9lpUOF0g6qbREmm nbwZXkDPBQ1+qsPAsn2frXMpf7TOncYp6fnRbrIOaFnU0Bd5BjA8exQYBa6JK9Ow7kQN gXzIYkMUxpsSFe75nb9qlHhBpKUZpDq+ZRffP4KokRF5WPhbdat96sn7sYHCN527T4xK edRq1AO5iuIKcUSzCKIBjo8et/JfNSJ+AsMsn41Z8/puPzOkoD5wd1jEuzuixjyN0AHX EO40jydtp94w5CL14QBLpf5XzpWc7APPMAH0ly6+YCc1lY35XxACAwGepmnACM0ciC3E lZxA== 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=CMe+dVd5NCnca0fxq7BMWY37ENtlTcvSDlcvk7XOY2w=; b=WtCGg/OKkBcA7uQhc0dIrm9seRHQCSR+9zGplV/U2eayUZhxY+XB5gzh3noEd2vnIx z5iQt12D8ziTjCgLfzq+VKwszQR9CZ7NFhmqU3dNkgCtqv6mKOaG/xxQ4DGF7MoJTiHA I6YmzTRuyeie40e/U8QSPYH03H/BwsUpLac+WW9eUTiJhWLu2T3jesrZls1vsauUer2O 6HGe8DqIeyMSG3saUBxqqhH8hB+5hn/H9MkG6/1Zglnir4cIVNxJqipoib9R7i4d2Bo4 Eog6bmGwnaL4bZFHH8d2699e8udvL07KMRuf9Y433LdNkYQMM4EK8ddhi6J4LGWdkug1 GhiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="hGbu5/VG"; 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 j17-20020a170902da9100b0018997e90c80si20253380plx.275.2022.12.06.14.47.05; Tue, 06 Dec 2022 14:47:17 -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="hGbu5/VG"; 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 S229791AbiLFWWd (ORCPT + 78 others); Tue, 6 Dec 2022 17:22:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbiLFWWb (ORCPT ); Tue, 6 Dec 2022 17:22:31 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22C643F078 for ; Tue, 6 Dec 2022 14:22:29 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id bs21so25570884wrb.4 for ; Tue, 06 Dec 2022 14:22: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=CMe+dVd5NCnca0fxq7BMWY37ENtlTcvSDlcvk7XOY2w=; b=hGbu5/VGxRxg50qkMsOPo8bLyBgo+q91kTTCe8kaBvHJOxYbPX38GVcWeGoDGm/Ymq NJA40cb1ccJ8HLNgZAJCmkHWVhPE+9Cfny6puzkdvBxPaqp6iV/Bz/YkzIFEfUwhMm06 Bqq6MSYtS7kUk7tDGPHtcSnRrRz/KPHnzlgGKLE+YntEA/S4Miw5YaiLe0I9f9wD34Fx nSpHgT9O98JO7WwHlBhu5jb5jPdsV6kGWtpIhZ/7H1Q1+HvtbrPykwbfK6KDePI6GH6W Uu2aRvejEnDDnr4N1c8ctTN4TgzHndhLy1owF7+qQxbKxjlcgrw2QEr75aFYZSASkU60 /2xQ== 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=CMe+dVd5NCnca0fxq7BMWY37ENtlTcvSDlcvk7XOY2w=; b=Ksoy7az921XvbU2E1jMym6nnxaqe/kGideyBfRpUcANgYW+r13p0KjZbvFR1yiBI7V 0T9WUlway9hCoDAUKgnlXqbUHtHFRWIwrZwokRyykmA4Ms1IiY98xwQY9u/ZIPlZdflZ Eln4lzMUgIHdI/3ITny2G5U50NVz+ffKOKHTxbJpu4ZoOqRKMZ2zwRNGEp4ZTXQ0jLOC 9rYsKyZMSG9zDZtMuXohcxb6BnKaZn8Kqdyi/awscT0649ygr8v7UU6SU4m8P1wWmygv sRVCR0De+bCx7wQLsjdq0FquUMMzbvnmMCFFcpqu1ViLzSaExgwLzvfXACiSAe9d4q2e eD/g== X-Gm-Message-State: ANoB5pmrkBk5AhdR0YH4wynWRiz9K0sXqrrcikFdMev3cB2ox3CYcgKD vwhPPeBMtjQZydtLhtMtnkJUmsH0+iSP/l4N3mYUag== X-Received: by 2002:adf:e2c9:0:b0:241:db86:176d with SMTP id d9-20020adfe2c9000000b00241db86176dmr43870568wrj.40.1670365347456; Tue, 06 Dec 2022 14:22:27 -0800 (PST) MIME-Version: 1.0 References: <20221205225940.3079667-3-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Tue, 6 Dec 2022 14:22:15 -0800 Message-ID: Subject: Re: [PATCH 2/3] perf build: Use libtraceevent from the system To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Stephane Eranian 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 Tue, Dec 6, 2022 at 9:31 AM Arnaldo Carvalho de Melo wrote: > > Em Tue, Dec 06, 2022 at 02:13:48PM -0300, Arnaldo Carvalho de Melo escreveu: > > Em Tue, Dec 06, 2022 at 02:07:32PM -0300, Arnaldo Carvalho de Melo escreveu: > > > Em Tue, Dec 06, 2022 at 02:01:43PM -0300, Arnaldo Carvalho de Melo escreveu: > > > > Em Tue, Dec 06, 2022 at 01:41:41PM -0300, Arnaldo Carvalho de Melo escreveu: > > > > > Now to look at the BUILD_BPF_SKEL=1 kaboom: > > > > > > > > > > [acme@quaco perf]$ alias m > > > > > alias m='rm -rf ~/libexec/perf-core/ ; make -k NO_LIBTRACEEVENT=1 BUILD_BPF_SKEL=1 O=/tmp/build/perf -C tools/perf install-bin && perf test python' > > > > > [acme@quaco perf]$ m > > > > > make: Entering directory '/home/acme/git/perf/tools/perf' > > > > > BUILD: Doing 'make -j8' parallel build > > > > > > > > > > /usr/bin/ld: /tmp/build/perf/perf-in.o: in function `add_work': > > > > > /home/acme/git/perf/tools/perf/util/bpf_kwork.c:285: undefined reference to `perf_kwork_add_work' > > > > > /usr/bin/ld: /tmp/build/perf/perf-in.o: in function `lock_contention_read': > > > > > > For that bpf_kwork.c see below. Now to see why the python binding is not > > > building, I guess is unrelated and you have some other outstanding > > > patch? > > > > Its related: > > > > [acme@quaco perf]$ perf test -v python > > Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc > > 14: 'import perf' in python : > > --- start --- > > test child forked, pid 1669872 > > python usage test: "echo "import sys ; sys.path.append('/tmp/build/perf/python'); import perf" | '/usr/bin/python3' " > > Traceback (most recent call last): > > File "", line 1, in > > ImportError: /tmp/build/perf/python/perf.cpython-310-x86_64-linux-gnu.so: undefined symbol: tep_unload_plugins > > test child finished with -1 > > ---- end ---- > > 'import perf' in python: FAILED! > > [acme@quaco perf]$ > > > > Now checking why NO_LIBTRACEEVENT=1 fails with this... > > > > [acme@quaco perf]$ find tools/perf/ -name "*.c" | xargs grep tep_unload_plugins > > tools/perf/util/trace-event.c: tep_unload_plugins(t->plugin_list, t->pevent); > > [acme@quaco perf]$ > > > > [acme@quaco perf]$ grep trace-event tools/perf/util/python-ext-sources > > util/trace-event.c > > [acme@quaco perf]$ > > > > Trying to fix... > > I'm missing some detail, this isn't working, util/trace-event.c is still > being built and linked. > > The python binding should be usable without tracepoints, in fact its > first usage was just to have access to the perf metaevents, see > tools/perf/python/twatch.py. You're right. I'd assumed that if you were disabling libtraceevent then you'd also disable python. To fix the issue above you can do: --- a/tools/perf/util/python-ext-sources +++ b/tools/perf/util/python-ext-sources @@ -30,7 +30,6 @@ util/rblist.c util/counts.c util/print_binary.c util/strlist.c -util/trace-event.c ../lib/rbtree.c util/string.c util/symbol_fprintf.c but this needs making conditional (possibly in setup.py) on whether libtraceevent is present or not. Thanks, Ian > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf > index f0e4daeef8120853..5bd67d54d036f281 100644 > --- a/tools/perf/Makefile.perf > +++ b/tools/perf/Makefile.perf > @@ -348,6 +348,10 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP > python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so > > PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) > +ifneq ($(CONFIG_TRACEEVENT),y) > + PYTHON_EXT_SRCS := $(call filter-out,$(PYTHON_EXT_SRCS),util/trace-event.c) > +endif > + > PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBAPI) > > SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) > diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c > index 728fe2f51759eb0d..72088aec2857b316 100644 > --- a/tools/perf/util/python.c > +++ b/tools/perf/util/python.c > @@ -1330,6 +1330,9 @@ static struct { > static PyObject *pyrf__tracepoint(struct pyrf_evsel *pevsel, > PyObject *args, PyObject *kwargs) > { > +#ifndef HAVE_LIBTRACEEVENT > + return NULL; > +#else > struct tep_event *tp_format; > static char *kwlist[] = { "sys", "name", NULL }; > char *sys = NULL; > @@ -1344,6 +1347,7 @@ static PyObject *pyrf__tracepoint(struct pyrf_evsel *pevsel, > return _PyLong_FromLong(-1); > > return _PyLong_FromLong(tp_format->id); > +#endif // HAVE_LIBTRACEEVENT > } > > static PyMethodDef perf__methods[] = {