From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbbIHHMB (ORCPT ); Tue, 8 Sep 2015 03:12:01 -0400 Received: from mga09.intel.com ([134.134.136.24]:39529 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751803AbbIHHL7 (ORCPT ); Tue, 8 Sep 2015 03:11:59 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,488,1437462000"; d="scan'208";a="784822522" Subject: Re: [PATCH V2 07/14] perf tools: Add evsel->own_cpus To: Jiri Olsa References: <1441636076-31390-1-git-send-email-adrian.hunter@intel.com> <1441636076-31390-8-git-send-email-adrian.hunter@intel.com> <20150908064508.GA20530@krava.brq.redhat.com> Cc: Arnaldo Carvalho de Melo , mingo@kernel.org, kan.liang@intel.com, linux-kernel@vger.kernel.org From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <55EE8996.3010608@intel.com> Date: Tue, 8 Sep 2015 10:09:10 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150908064508.GA20530@krava.brq.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/09/15 09:45, Jiri Olsa wrote: > On Mon, Sep 07, 2015 at 05:27:49PM +0300, Adrian Hunter wrote: >> perf_evlist__propagate_maps() cannot easily tell if an evsel >> has its own cpu map. To make that simpler, keep a copy of >> the PMU cpu map and adjust the propagation logic accordingly. >> >> Signed-off-by: Adrian Hunter >> --- >> tools/perf/util/evlist.c | 5 ++++- >> tools/perf/util/evsel.c | 1 + >> tools/perf/util/evsel.h | 1 + >> tools/perf/util/parse-events.c | 4 ++-- >> 4 files changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c >> index c959c42080e3..6764e0eff849 100644 >> --- a/tools/perf/util/evlist.c >> +++ b/tools/perf/util/evlist.c >> @@ -1111,9 +1111,12 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist) >> * We already have cpus for evsel (via PMU sysfs) so >> * keep it, if there's no target cpu list defined. >> */ >> - if (!evsel->cpus || evlist->has_user_cpus) { >> + if (!evsel->own_cpus || evlist->has_user_cpus) { >> cpu_map__put(evsel->cpus); >> evsel->cpus = cpu_map__get(evlist->cpus); >> + } else if (evsel->cpus != evsel->own_cpus) { >> + cpu_map__put(evsel->cpus); >> + evsel->cpus = cpu_map__get(evsel->own_cpus); > > hum, so (evsel->cpus != evsel->own_cpus) could happen only when: > - evsel->own_cpus != NULL > - we overloaded evsel->cpus with evlist->cpus via perf_evlist__propagate_maps > - we changed evlist->has_user_cpus = false > - we recall perf_evlist__propagate_maps > > I'm missing usecase for that, or something else ;-) That's true but the idea is to establish rules (invariants) that are always true. Like an evsel either has its own cpu map or the same as the evlist.