Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5489015ybp; Mon, 14 Oct 2019 23:48:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYYdDJDWbKeFoVGuXVXF0y/buX4LQTrNKZtYlb6vTDWPu86QjyC0CUeqD2IfLPrMthtDgo X-Received: by 2002:a05:6402:1492:: with SMTP id e18mr31564966edv.140.1571122088726; Mon, 14 Oct 2019 23:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571122088; cv=none; d=google.com; s=arc-20160816; b=HvNIrLK28URDWheR73FTXPnEfaypVJnQscapDqDc186Km0vsc6a6sF5n318CQ+5r8t voRyAHLzmmFyjYxjq6jRPCyAi4RmzzE/xYNLl3TREAC/NlvgkFd05hXrcbGWg96en5+d nRv/YIR2MRViuTgq45cQgfxVI5vAjKRa8jw73BF0kZnf+jKTqU3TtT++dv4HM6l2ZouS J9MpmKUsjd3xmPkykQz1Ruh5NewRILLtSnPHhJydqGvtEoKUsCiRPH1rWpmVwuUd8q9P FMsGp9K3AC+OqvKakpUjk+Z0GoDhiU1RaJk86M2EMU6V73FkxCGTdjm0yLwgp0TMgTgH M5Ow== 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=3Gq/+52gY2gx+h1WTJsjKCOgANrS4aaePiqIxHTX7Go=; b=AVJT423Q5yV2u/A0HkU+ay5uAi/UZbritN+hvKqSqIp9MzWL2OaYK3HBYgJH4kyTpd +03HfJQ8EqSjhO35yBg6l9aP3ZOpaCm5xGk2y/JaxEgdg4h+KE44L3ne77AkdBGuidXY RCjq+BumFIAzXXTqoGfk4qeWV60FOM1D88WM0fVND0jRW9V9NkSD2C7xC9fnptf9ECKS gNSkjx2H5UnFkIHg4oF318CluUGtqSJ4/NmNflPoHMSNilq/iCZ9+zwtf1IRd+tlZupj 1JgwQi3S33rau9e061nits48eHh32prGyvHZ8NHknWHOy4QLb+RNnp717/sx39vhsE30 L6xg== 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 i11si12813996eja.317.2019.10.14.23.47.45; Mon, 14 Oct 2019 23:48:08 -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 S1727227AbfJOFga (ORCPT + 99 others); Tue, 15 Oct 2019 01:36:30 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41903 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728254AbfJOFbv (ORCPT ); Tue, 15 Oct 2019 01:31:51 -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-00005L-6N; 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 DF2961C0494; 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() Cc: Arnaldo Carvalho de Melo , Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , Jiri Olsa , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <20191007125344.14268-15-jolsa@kernel.org> References: <20191007125344.14268-15-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <157111749880.12254.1536799430986791776.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: 0b5ea10d4c312f5b17af9d09187efb9418517bec Gitweb: https://git.kernel.org/tip/0b5ea10d4c312f5b17af9d09187efb9418517bec Author: Jiri Olsa AuthorDate: Mon, 07 Oct 2019 14:53:22 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Thu, 10 Oct 2019 12:18:00 -03:00 libperf: Introduce perf_evlist__mmap_ops() To be able to pass specific callbacks to evlist's mmap. There will be a specific call to this function from perf's evlist__mmap() and libperf's perf_evlist__mmap() functions in following changes. Signed-off-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20191007125344.14268-15-jolsa@kernel.org Signed-off-by: Jiri Olsa --- tools/perf/lib/evlist.c | 24 +++++++++++++++++------ tools/perf/lib/include/internal/evlist.h | 8 ++++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index 250ad57..88d63f5 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -472,12 +472,16 @@ out_unmap: return -1; } -int perf_evlist__mmap(struct perf_evlist *evlist, int pages) +int perf_evlist__mmap_ops(struct perf_evlist *evlist, + struct perf_evlist_mmap_ops *ops, + struct perf_mmap_param *mp) { struct perf_evsel *evsel; const struct perf_cpu_map *cpus = evlist->cpus; const struct perf_thread_map *threads = evlist->threads; - struct perf_mmap_param mp; + + if (!ops) + return -EINVAL; if (!evlist->mmap) evlist->mmap = perf_evlist__alloc_mmap(evlist, false); @@ -491,13 +495,21 @@ int perf_evlist__mmap(struct perf_evlist *evlist, int pages) return -ENOMEM; } + if (perf_cpu_map__empty(cpus)) + return mmap_per_thread(evlist, mp); + + return mmap_per_cpu(evlist, mp); +} + +int perf_evlist__mmap(struct perf_evlist *evlist, int pages) +{ + struct perf_mmap_param mp; + struct perf_evlist_mmap_ops ops; + evlist->mmap_len = (pages + 1) * page_size; mp.mask = evlist->mmap_len - page_size - 1; - if (perf_cpu_map__empty(cpus)) - return mmap_per_thread(evlist, &mp); - - return mmap_per_cpu(evlist, &mp); + return perf_evlist__mmap_ops(evlist, &ops, &mp); } void perf_evlist__munmap(struct perf_evlist *evlist) diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h index 4438a19..e5f092f 100644 --- a/tools/perf/lib/include/internal/evlist.h +++ b/tools/perf/lib/include/internal/evlist.h @@ -11,6 +11,7 @@ struct perf_cpu_map; struct perf_thread_map; +struct perf_mmap_param; struct perf_evlist { struct list_head entries; @@ -26,10 +27,17 @@ struct perf_evlist { struct perf_mmap *mmap_ovw; }; +struct perf_evlist_mmap_ops { +}; + int perf_evlist__alloc_pollfd(struct perf_evlist *evlist); int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, void *ptr, short revent); +int perf_evlist__mmap_ops(struct perf_evlist *evlist, + struct perf_evlist_mmap_ops *ops, + struct perf_mmap_param *mp); + /** * __perf_evlist__for_each_entry - iterate thru all the evsels * @list: list_head instance to iterate