Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1624850ybz; Sat, 18 Apr 2020 05:06:08 -0700 (PDT) X-Google-Smtp-Source: APiQypLZ7HplMDoAXRtWlVDiP7SdlPQWaHLjQlO5MGJdX6YmEZ+o9xdM1OsYg1u4VSF+ws+YEYsr X-Received: by 2002:aa7:d857:: with SMTP id f23mr6810738eds.235.1587211568671; Sat, 18 Apr 2020 05:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587211568; cv=none; d=google.com; s=arc-20160816; b=CUwIkL8+jjB+8Jep4GcHClmxhmq3SS5HO9QlinwcpUr/h8ki+0Mt43LB4OS+VSSXD/ Jn1qCV3f1BNvKTvPUYp0rpHHmk8ONzHylh3vlW361PT2EL29r+yJ6jHqpBjUqnaLDUDa 9W+joTeinHO6zZsoRXSnntF8JEZrx6nbtGlFxv40A195Md9pIBHFpO3fozBfcXnOc8Do Ym8w9ueUlykXX9H989DC23zENcR4ajdI748TXEY8tYuTzMyUueeWCT6DQUbXR/6dZVV9 FlN6dB3N24tP5tqM2Q8pdOPYNFRnWRieNNAd8z8tfuPDfdjcPCp4Hd1eM9uP4UGFzYCR 1ANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=BZwlaHWeOeafAExOcOIbelNG2HeXx9/G4hvqk9vloyo=; b=TIwCpiiWDISzEUAqr5wQIWT6fzOhw4W2i34lkCuQZqC6LrS0WoYtiSqpHMpw1KM0BZ aIm86C3tXZGElT2F8n8g1z+U4zz0VJbAwnPlpRBn2FlhWHVRuy/DKiD0gEc+qJq5WKpZ /fv37R6Ku43xLYBEPWYUtOzuB00jNwE+CmBFXHf3Gq2qp5zg9hyOY3RcJI4sS3mm8bBp 5iwb9Tad28u9Y6aEbY4MWZfyRDlcx2bU9K/uLF9lwfETXqSIgiUolkx+/cOHxUzHXAry eJ70RI0sUZpOwOcAqeqB5yyluWmrGHUx8jAasROSD+6cjzPnENi3u7xuS0zthfKaBlUY RJxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mMgStgWr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs10si6269017edb.429.2020.04.18.05.05.45; Sat, 18 Apr 2020 05:06:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mMgStgWr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725903AbgDRMEI (ORCPT + 99 others); Sat, 18 Apr 2020 08:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725809AbgDRMEH (ORCPT ); Sat, 18 Apr 2020 08:04:07 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5B56C061A0C for ; Sat, 18 Apr 2020 05:04:07 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id l25so5416118qkk.3 for ; Sat, 18 Apr 2020 05:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BZwlaHWeOeafAExOcOIbelNG2HeXx9/G4hvqk9vloyo=; b=mMgStgWrMw67hjiTamIm6buAZPVe1wCbfjPELaYiDEL29wH0Ij/4O3xwJAjIuBUZ4A ADQjW9Aon9Yl8GUDjGwmwrNg6Hj6yFSUAvvGCznXS/oC3JT6Pzxww2lvKHboYAYJ1/tq waRtmiPmalo8eCeL3DHstUd1QkllCTARF5O3pB5TqdLKYNbIFbJ+IS8rpLTb5kbgv9Ft qOr9XU0eF+jopJBgB8YLpGD4QmBWq8Fejhm37B+CX02VK8Z8ZI1bGoUMGaxMfGnieWAh QUihX8h6Kr6S68UMNcjGCvepWKrSJCMrOZnqYcuqEMM3lPwvAdOGyND6RN0qfeLoKYMF DCOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BZwlaHWeOeafAExOcOIbelNG2HeXx9/G4hvqk9vloyo=; b=CRYxLt4Zr1U+TZHH6l1x7IwWfrRxukQLBDGwzxZefnJ8yakrDXHUavyOsWSJ72J0LR KpXk4VvfxEoEBxAOYwkcSryp61qFQY8AImrg/b4ZfvuekK3W1DerIlLsMcoP+3E14nxt oRQcwXBnDvx30L1dgSA1VaIDiWNxr60Ma7OSeX3rBjYJeLtDQAhR5cYQKBu6YejXpHjf avZvXAVYgr0JnToT/6LkF7zr4i6XLq4xNr2R2NeaN2wQOlK/HKe3W3HmT6t7HJhE4Aay m3k4xro8RanVGVwzmjnozMYisiEx/noaZNblHJuTu1GA7ID0B54enZ7r33YYCf2+X/CP 1/tA== X-Gm-Message-State: AGi0PuZgTbjdivbsWHTixHmhYSwdlJT3pCm+3MS08zgB0ZPLj4NSG91n UTiLScXDbjM2YERstYDIxmd4DpC2HfI= X-Received: by 2002:a37:4a85:: with SMTP id x127mr7666693qka.152.1587211446588; Sat, 18 Apr 2020 05:04:06 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id 11sm17558479qkg.122.2020.04.18.05.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Apr 2020 05:04:06 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 0CDBD409A3; Sat, 18 Apr 2020 09:04:04 -0300 (-03) Date: Sat, 18 Apr 2020 09:04:03 -0300 To: Adrian Hunter Cc: Jiri Olsa , Andi Kleen , linux-kernel@vger.kernel.org Subject: Re: [PATCH 12/16] perf tools: Move and globalize perf_evsel__find_pmu() and perf_evsel__is_aux_event() Message-ID: <20200418120403.GB6031@kernel.org> References: <20200401101613.6201-1-adrian.hunter@intel.com> <20200401101613.6201-13-adrian.hunter@intel.com> <20200418115017.GA6031@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200418115017.GA6031@kernel.org> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Apr 18, 2020 at 08:50:17AM -0300, Arnaldo Carvalho de Melo escreveu: > Em Wed, Apr 01, 2020 at 01:16:09PM +0300, Adrian Hunter escreveu: > > Move and globalize 2 functions so that they can be reused. > > So this breaks this: > > [acme@five perf]$ perf test -v python > Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc > 19: 'import perf' in python : > --- start --- > test child forked, pid 168414 > Traceback (most recent call last): > File "", line 1, in > ImportError: /tmp/build/perf/python/perf.so: undefined symbol: perf_pmu__scan > test child finished with -1 > ---- end ---- > 'import perf' in python: FAILED! > [acme@five perf]$ > > I'm trying to fix... I solved this by moving those functions to tools/perf/util/pmu.c instead. Please consider running 'perf test' before sending your patches to me next time, Thanks, - Arnaldo > > Signed-off-by: Adrian Hunter > > --- > > tools/perf/util/auxtrace.c | 19 ------------------- > > tools/perf/util/evsel.c | 20 ++++++++++++++++++++ > > tools/perf/util/evsel.h | 3 +++ > > 3 files changed, 23 insertions(+), 19 deletions(-) > > > > diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c > > index 809a09e75c55..33ad33378a90 100644 > > --- a/tools/perf/util/auxtrace.c > > +++ b/tools/perf/util/auxtrace.c > > @@ -58,25 +58,6 @@ > > #include "symbol/kallsyms.h" > > #include > > > > -static struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel) > > -{ > > - struct perf_pmu *pmu = NULL; > > - > > - while ((pmu = perf_pmu__scan(pmu)) != NULL) { > > - if (pmu->type == evsel->core.attr.type) > > - break; > > - } > > - > > - return pmu; > > -} > > - > > -static bool perf_evsel__is_aux_event(struct evsel *evsel) > > -{ > > - struct perf_pmu *pmu = perf_evsel__find_pmu(evsel); > > - > > - return pmu && pmu->auxtrace; > > -} > > - > > /* > > * Make a group from 'leader' to 'last', requiring that the events were not > > * already grouped to a different leader. > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > > index 60e6cd49dee3..d4ab073c9fe7 100644 > > --- a/tools/perf/util/evsel.c > > +++ b/tools/perf/util/evsel.c > > @@ -44,6 +44,7 @@ > > #include "stat.h" > > #include "string2.h" > > #include "memswap.h" > > +#include "pmu.h" > > #include "util.h" > > #include "../perf-sys.h" > > #include "util/parse-branch-options.h" > > @@ -100,6 +101,25 @@ int perf_evsel__object_config(size_t object_size, > > return 0; > > } > > > > +struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel) > > +{ > > + struct perf_pmu *pmu = NULL; > > + > > + while ((pmu = perf_pmu__scan(pmu)) != NULL) { > > + if (pmu->type == evsel->core.attr.type) > > + break; > > + } > > + > > + return pmu; > > +} > > + > > +bool perf_evsel__is_aux_event(struct evsel *evsel) > > +{ > > + struct perf_pmu *pmu = perf_evsel__find_pmu(evsel); > > + > > + return pmu && pmu->auxtrace; > > +} > > + > > #define FD(e, x, y) (*(int *)xyarray__entry(e->core.fd, x, y)) > > > > int __perf_evsel__sample_size(u64 sample_type) > > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > > index e64ed4202cab..a463bc65b001 100644 > > --- a/tools/perf/util/evsel.h > > +++ b/tools/perf/util/evsel.h > > @@ -158,6 +158,9 @@ int perf_evsel__object_config(size_t object_size, > > int (*init)(struct evsel *evsel), > > void (*fini)(struct evsel *evsel)); > > > > +struct perf_pmu *perf_evsel__find_pmu(struct evsel *evsel); > > +bool perf_evsel__is_aux_event(struct evsel *evsel); > > + > > struct evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx); > > > > static inline struct evsel *evsel__new(struct perf_event_attr *attr) > > -- > > 2.17.1 > > > > -- > > - Arnaldo -- - Arnaldo