Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5485490ybp; Mon, 14 Oct 2019 23:43:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuecah2sq3OxAEfR/6hTAQttBxYMYfPm2X+pvZ48/QyAmgJYSD82+Eaab9VHY5kwONnuOY X-Received: by 2002:aa7:de1a:: with SMTP id h26mr32057511edv.289.1571121793556; Mon, 14 Oct 2019 23:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571121793; cv=none; d=google.com; s=arc-20160816; b=k4iAWdJX33GoPEQBaVoab2myT/wrUIAgiPKx4fzCrR1bowlg3jTs5ks1mooYy2mhuR gagparxA80A0zcUpr3kUwQ93cNGo49Yyjy9FwB8+VTezcBGRxTi1EXp/eLmp6StIwEwq KQRg5Q58BpFO20N1WN2TRLFU1ry+UfAENV7Cz4GP8v2vVpQsJQrc6oISpntXCUgQRbHc +lvEwUuF/0h/sKSmeelazWO/ep3cSApy8a+qLEn6owC7hU8rR87/xFkt2iaS7b+DJfM7 C49i0yFdo2TXr+QNFKqJfhVn88GKPK38ZJwPyTjj9BYv7+6IaAcYhZPSqWB6STF7qsX6 Z5rA== 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=0k+gGyb28F1P1IFTSgYy+3qWsr9GGMK6ii9xvmVtOr8=; b=yZeslhbi/h9NgPKb2mreb/fzTOgtkcOSfht6Bgor89+IKpwAhyQBhNXY4qgYFlL4vH VkSIJinHS+3J4pTE5a1XFpmP2M12lffol5cxxk9I70SnAXP+uWLPjFjqCIgFxwIacDo6 7q+J3yFIaPaBownvpEJwJxAyAut6GBEeDPJsq6b5HoO/WNtrUJ3QdjcvgBmOIQjuE8K3 qkBDcNh2Zf/XMfZBcLTlpzmGLECJoAL4/pkitbsf7tI3K4LA630VaquRHfn4a/XdEylv NJwx8Tdk9gmVZ3lyo/KRR2U1/W8MyycPH2v1MqE9kMkWlrc1GiK7L/p4kjvJDzTZ7CUv 26XA== 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 k1si14088344ede.255.2019.10.14.23.42.49; Mon, 14 Oct 2019 23:43:13 -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 S1727543AbfJOFgV (ORCPT + 99 others); Tue, 15 Oct 2019 01:36:21 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41936 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728262AbfJOFby (ORCPT ); Tue, 15 Oct 2019 01:31:54 -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 1iKFQq-00004r-Lr; Tue, 15 Oct 2019 07:31:40 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id A171F1C0450; Tue, 15 Oct 2019 07:31:38 +0200 (CEST) Date: Tue, 15 Oct 2019 05:31:38 -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] libperf: Introduce perf_evlist_mmap_ops::idx callback 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-16-jolsa@kernel.org> References: <20191007125344.14268-16-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <157111749856.12254.3251239305894313360.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: 1fcbb75cc574072ab457dbbaa74fc7064b691e86 Gitweb: https://git.kernel.org/tip/1fcbb75cc574072ab457dbbaa74fc7064b691e86 Author: Jiri Olsa AuthorDate: Mon, 07 Oct 2019 14:53:23 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Thu, 10 Oct 2019 12:20:08 -03:00 libperf: Introduce perf_evlist_mmap_ops::idx callback Add the perf_evlist_mmap_ops::idx callback to be called in mmap_per_cpu() and mmap_per_thread() with current cpu and thread indexes. It's used by current aux code, so perf will use this callback to set the aux index. 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-16-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/evlist.c | 18 +++++++++++++----- tools/perf/lib/include/internal/evlist.h | 4 ++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index 88d63f5..3832d3e 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -426,7 +426,8 @@ mmap_per_evsel(struct perf_evlist *evlist, int idx, } static int -mmap_per_thread(struct perf_evlist *evlist, struct perf_mmap_param *mp) +mmap_per_thread(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops, + struct perf_mmap_param *mp) { int thread; int nr_threads = perf_thread_map__nr(evlist->threads); @@ -435,6 +436,9 @@ mmap_per_thread(struct perf_evlist *evlist, struct perf_mmap_param *mp) int output = -1; int output_overwrite = -1; + if (ops->idx) + ops->idx(evlist, mp, thread, false); + if (mmap_per_evsel(evlist, thread, mp, 0, thread, &output, &output_overwrite)) goto out_unmap; @@ -448,7 +452,8 @@ out_unmap: } static int -mmap_per_cpu(struct perf_evlist *evlist, struct perf_mmap_param *mp) +mmap_per_cpu(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops, + struct perf_mmap_param *mp) { int nr_threads = perf_thread_map__nr(evlist->threads); int nr_cpus = perf_cpu_map__nr(evlist->cpus); @@ -458,6 +463,9 @@ mmap_per_cpu(struct perf_evlist *evlist, struct perf_mmap_param *mp) int output = -1; int output_overwrite = -1; + if (ops->idx) + ops->idx(evlist, mp, cpu, true); + for (thread = 0; thread < nr_threads; thread++) { if (mmap_per_evsel(evlist, cpu, mp, cpu, thread, &output, &output_overwrite)) @@ -496,15 +504,15 @@ int perf_evlist__mmap_ops(struct perf_evlist *evlist, } if (perf_cpu_map__empty(cpus)) - return mmap_per_thread(evlist, mp); + return mmap_per_thread(evlist, ops, mp); - return mmap_per_cpu(evlist, mp); + return mmap_per_cpu(evlist, ops, mp); } int perf_evlist__mmap(struct perf_evlist *evlist, int pages) { struct perf_mmap_param mp; - struct perf_evlist_mmap_ops ops; + struct perf_evlist_mmap_ops ops = { 0 }; evlist->mmap_len = (pages + 1) * page_size; mp.mask = evlist->mmap_len - page_size - 1; diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h index e5f092f..053f620 100644 --- a/tools/perf/lib/include/internal/evlist.h +++ b/tools/perf/lib/include/internal/evlist.h @@ -27,7 +27,11 @@ struct perf_evlist { struct perf_mmap *mmap_ovw; }; +typedef void +(*perf_evlist_mmap__cb_idx_t)(struct perf_evlist*, struct perf_mmap_param*, int, bool); + struct perf_evlist_mmap_ops { + perf_evlist_mmap__cb_idx_t idx; }; int perf_evlist__alloc_pollfd(struct perf_evlist *evlist);