Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5487033ybp; Mon, 14 Oct 2019 23:45:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1MuNxWoFhzkNm415u8KmvGBTt/eS+qafOWX64RsJnPZGCRLAo1LtZtnX5qALf3JDvmFD4 X-Received: by 2002:aa7:db55:: with SMTP id n21mr31960241edt.1.1571121925508; Mon, 14 Oct 2019 23:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571121925; cv=none; d=google.com; s=arc-20160816; b=gArCAzqW8yqkE8DGqsuZT3fKlaqGxITOVYgjSzMBnpealiHL37HC8DHTKm871A5Z8t xU2QrkUhkO/fUn3ri1kYVs7wg3S6nOR+aUoEdNsNQUNGrK18IGAOxpmvyvsoWSxQgkjI 4N4dXmWftP8/c5O6B0ohFqyjnP1zBBl1YF42alqBSDifWhLZqzF58Hn37rLQ8xHa2BWE F8Siy1vTQqXds+Xq+HRm2OkTne0G2xpDggdVy9BxXVlvFGEiLwylhkwg6LY+GwVQCSgM rwnBpHhfM2sziqr0DrvXEn+Sx4fellX6vh0ebObhFyQkDf+/iWTCb3S3+3js9m7kYp/x DwPw== 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=sI+guv+c4NrM/1BJa6fpJZcvMg9/hacHKpCW7iYWfqI=; b=N5jx3/4SOErxZ12IoNjKyLpEpLRw0SZFjx6CtNqq9ND7pItZwSs8UQeuX0w9HJLK+L PuwSoj0Tg/oeHS1UjtPIE4YuuVVgvZIXQVQ2n11BQUGOs8mUUqPLH8zMhmiILicX1PS3 m8DGznHxEqegprubl00n7sQv5KvbIUeEtoSwSpB6O4yhQnsazfxrBTeP4CmuI+qFlgnG cLw6tCTib3Xhq9jTGMUI54bsmt4XIutSAfllYfSemfSN+A+boGM9+q7Cw1NQ99gTTsOb Yu/PSQFKLq8movfiTYscI68zdcCFA30E1x60Y7U1Pr5IBPHGg0py61p4GkZI5KGsyMMy KSKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si12728530ejt.345.2019.10.14.23.45.01; Mon, 14 Oct 2019 23:45:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729332AbfJOFgW (ORCPT + 99 others); Tue, 15 Oct 2019 01:36:22 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41923 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728383AbfJOFbx (ORCPT ); Tue, 15 Oct 2019 01:31:53 -0400 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 1iKFQs-0008ST-ML; Tue, 15 Oct 2019 07:31:42 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 5CEFC1C0482; Tue, 15 Oct 2019 07:31:37 +0200 (CEST) Date: Tue, 15 Oct 2019 05:31:37 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf evlist: Introduce perf_evlist__mmap_cb_get() Cc: Jiri Olsa , Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <20191007125344.14268-20-jolsa@kernel.org> References: <20191007125344.14268-20-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <157111749722.12254.2532014264638298584.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: 7bit 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: bb1b1885e2f22afb8bc7981cd865fe4b0e3d975b Gitweb: https://git.kernel.org/tip/bb1b1885e2f22afb8bc7981cd865fe4b0e3d975b Author: Jiri Olsa AuthorDate: Mon, 07 Oct 2019 14:53:27 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Thu, 10 Oct 2019 12:30:21 -03:00 perf evlist: Introduce perf_evlist__mmap_cb_get() Add the perf_evlist__mmap_cb_get() function to return 'struct perf_mmap' object during perf_evlist__mmap_ops() call. The array of 'struct mmap' is allocated via evlist__alloc_mmap(), in this callback we simply returns pointer to the base object. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20191007125344.14268-20-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evlist.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 11716f2..f50ee5c 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -750,6 +750,29 @@ perf_evlist__mmap_cb_idx(struct perf_evlist *_evlist, auxtrace_mmap_params__set_idx(&mp->auxtrace_mp, evlist, idx, per_cpu); } +static struct perf_mmap* +perf_evlist__mmap_cb_get(struct perf_evlist *_evlist, bool overwrite, int idx) +{ + struct evlist *evlist = container_of(_evlist, struct evlist, core); + struct mmap *maps = evlist->mmap; + + if (overwrite) { + maps = evlist->overwrite_mmap; + + if (!maps) { + maps = evlist__alloc_mmap(evlist, true); + if (!maps) + return NULL; + + evlist->overwrite_mmap = maps; + if (evlist->bkw_mmap_state == BKW_MMAP_NOTREADY) + perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_RUNNING); + } + } + + return &maps[idx].core; +} + static int evlist__mmap_per_cpu(struct evlist *evlist, struct mmap_params *mp) { @@ -948,6 +971,7 @@ int evlist__mmap_ex(struct evlist *evlist, unsigned int pages, }; struct perf_evlist_mmap_ops ops __maybe_unused = { .idx = perf_evlist__mmap_cb_idx, + .get = perf_evlist__mmap_cb_get, }; if (!evlist->mmap)