Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp646439ybz; Wed, 22 Apr 2020 05:25:15 -0700 (PDT) X-Google-Smtp-Source: APiQypIAkO3jO3tkSzR9hjgUswJagKG9t3DO+74f1yW9Vsu533cXB3L/fQdJSaTwR+C3eAhcpcTI X-Received: by 2002:a17:907:2142:: with SMTP id rk2mr26392045ejb.356.1587558315222; Wed, 22 Apr 2020 05:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587558315; cv=none; d=google.com; s=arc-20160816; b=Gw9I+WkfVKN4eu06Wc9K3nTJq/3biqIq+TCFv2aKv2okanmEDsAxo9H27QYA6SvYtg dofLYCdbwIt6FyQsfFycagmcloVw/uhQXInnXrdfuYvDD5Zun42A0F5vFcjjl+HmQNiC RsvasvgVfTX/fRZwoLnGXrd51Aud1Qx4hneKSkVFj0i75l95Oj2Z/I+6gTFk+3Yryn8B nNtqvzg8/EAeWtRnMCjXsLQUYHtSqqW94DQs6u93qVaVmjXfet6vfLYNwbdiyI5vXwI+ ++i6VF1hrgpbXcEEOsCt46VXs+oYHPB4oNlZxtrBJdk+U7toA32lWOA+tU1WUDbLeCHU Lv/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=y8mukeykC/41Kk4HI/30Gj5pD2ex4kD9c+8nL2nnSXU=; b=h5N8LjqHsMspaLZ2YdeVosEoKRidbo648kB8CE1BWGPchpgSV3LNAzI8L/IRtWvOQL /BsmRfUGlSzjseMsCNk8VcReok+f96qXanJJsLgpFJWlY8iQ/8H8e7dD3EZ/GSG/4yGa qD0ZVcQvAxQZ21xKkzodxadGLk99E9V/yOpSWMBKEqot+gqoZezkb2h9VfTeyjdQ4S5z 8YfgfwSNbv5zzHHHDvpzrOrLndMM5APbkKjlGvRxz+TtQppXRUksn3tp3Bx074Nw1RJH 10xCxo9jDAv0qSOmh4SRsn8wxPPvTbVgbdnUMzaX3SkniyGZuxzDzT/7tzFi7tI9HlJ4 udpA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si3592758edn.502.2020.04.22.05.24.52; Wed, 22 Apr 2020 05:25:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728747AbgDVMRl convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 Apr 2020 08:17:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727782AbgDVMR3 (ORCPT ); Wed, 22 Apr 2020 08:17:29 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F5E6C03C1AD; Wed, 22 Apr 2020 05:17:29 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jREJf-0007kT-JW; Wed, 22 Apr 2020 14:17:23 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 114601C02FC; Wed, 22 Apr 2020 14:17:21 +0200 (CEST) Date: Wed, 22 Apr 2020 12:17:20 -0000 From: "tip-bot2 for Adrian Hunter" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf evlist: Move leader-sampling configuration Cc: Adrian Hunter , Andi Kleen , Jiri Olsa , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200401101613.6201-14-adrian.hunter@intel.com> References: <20200401101613.6201-14-adrian.hunter@intel.com> MIME-Version: 1.0 Message-ID: <158755784068.28353.2670739462496950321.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 5f34278867b78bed77dcbd723056244e9bfc12ef Gitweb: https://git.kernel.org/tip/5f34278867b78bed77dcbd723056244e9bfc12ef Author: Adrian Hunter AuthorDate: Wed, 01 Apr 2020 13:16:10 +03:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Sat, 18 Apr 2020 09:05:00 -03:00 perf evlist: Move leader-sampling configuration Move leader-sampling configuration in preparation for adding support for leader sampling with AUX area events. Committer notes: It only makes sense when configuring an evsel that is part of an evlist, so the only case where it is called outside perf_evlist__config(), in some 'perf test' entry, is safe, and even there we should just use perf_evlist__config(), but since in that case we have just one evsel in the evlist, it is equivalent. Also fixed up this problem: util/record.c: In function ‘perf_evlist__config’: util/record.c:223:3: error: too many arguments to function ‘perf_evsel__config_leader_sampling’ 223 | perf_evsel__config_leader_sampling(evsel, evlist); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ util/record.c:170:13: note: declared here 170 | static void perf_evsel__config_leader_sampling(struct evsel *evsel) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Adrian Hunter Cc: Andi Kleen Cc: Jiri Olsa Link: http://lore.kernel.org/lkml/20200401101613.6201-14-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 19 ------------------- tools/perf/util/record.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index f320ada..8300e8c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1002,25 +1002,6 @@ void perf_evsel__config(struct evsel *evsel, struct record_opts *opts, } } - /* - * Disable sampling for all group members other - * than leader in case leader 'leads' the sampling. - */ - if ((leader != evsel) && leader->sample_read) { - attr->freq = 0; - attr->sample_freq = 0; - attr->sample_period = 0; - attr->write_backward = 0; - - /* - * We don't get sample for slave events, we make them - * when delivering group leader sample. Set the slave - * event to follow the master sample_type to ease up - * report. - */ - attr->sample_type = leader->core.attr.sample_type; - } - if (opts->no_samples) attr->sample_freq = 0; diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c index 7def661..8870ae4 100644 --- a/tools/perf/util/record.c +++ b/tools/perf/util/record.c @@ -167,6 +167,31 @@ bool perf_can_aux_sample(void) return true; } +static void perf_evsel__config_leader_sampling(struct evsel *evsel) +{ + struct perf_event_attr *attr = &evsel->core.attr; + struct evsel *leader = evsel->leader; + + /* + * Disable sampling for all group members other + * than leader in case leader 'leads' the sampling. + */ + if (leader != evsel && leader->sample_read) { + attr->freq = 0; + attr->sample_freq = 0; + attr->sample_period = 0; + attr->write_backward = 0; + + /* + * We don't get sample for slave events, we make them + * when delivering group leader sample. Set the slave + * event to follow the master sample_type to ease up + * report. + */ + attr->sample_type = leader->core.attr.sample_type; + } +} + void perf_evlist__config(struct evlist *evlist, struct record_opts *opts, struct callchain_param *callchain) { @@ -193,6 +218,10 @@ void perf_evlist__config(struct evlist *evlist, struct record_opts *opts, evsel->core.attr.comm_exec = 1; } + /* Configure leader sampling here now that the sample type is known */ + evlist__for_each_entry(evlist, evsel) + perf_evsel__config_leader_sampling(evsel); + if (opts->full_auxtrace) { /* * Need to be able to synthesize and parse selected events with