Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934215AbeAKO0C (ORCPT + 1 other); Thu, 11 Jan 2018 09:26:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60262 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933486AbeAKO0A (ORCPT ); Thu, 11 Jan 2018 09:26:00 -0500 Date: Thu, 11 Jan 2018 15:25:49 +0100 From: Jiri Olsa To: kan.liang@intel.com Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, jolsa@kernel.org, namhyung@kernel.org, ak@linux.intel.com, yao.jin@linux.intel.com Subject: Re: [PATCH V3 08/12] perf top: check per event overwrite term Message-ID: <20180111142549.GD16655@krava> References: <1513879734-237492-1-git-send-email-kan.liang@intel.com> <1513879734-237492-9-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1513879734-237492-9-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 11 Jan 2018 14:26:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Dec 21, 2017 at 10:08:50AM -0800, kan.liang@intel.com wrote: > From: Kan Liang > > Per event overwrite term is not forbidden in perf top, which can bring > problems. Because perf top only support non-overwrite mode. > > Check and forbid inconsistent per event overwrite term in the evlist. > Make it possible to support either non-overwrite or overwrite mode. > The overwrite mode is forbidden now, which will be removed when the > overwrite mode is supported later. > > Signed-off-by: Kan Liang > --- > tools/perf/builtin-top.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 60 insertions(+) > > diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c > index c6ccda5..4b85e7b 100644 > --- a/tools/perf/builtin-top.c > +++ b/tools/perf/builtin-top.c > @@ -881,6 +881,56 @@ static void perf_top__mmap_read(struct perf_top *top) > perf_top__mmap_read_idx(top, i); > } > > +/* > + * Check per event overwrite term. > + * perf top supports consistent mode for all events. > + * Return -1 if the per event terms set but not consistent. please list the rules for overwrite in the comment are they just top specific? SNIP > + if (evsel == perf_evlist__first(evlist)) > + overwrite = set; > + else > + return -1; > + } > + } > + > + if ((overwrite >= 0) && (opts->overwrite != overwrite)) > + opts->overwrite = overwrite; > + > + return 0; > +} > + > static int perf_top__start_counters(struct perf_top *top) > { > char msg[BUFSIZ]; > @@ -890,6 +940,16 @@ static int perf_top__start_counters(struct perf_top *top) > > perf_evlist__config(evlist, opts, &callchain_param); so perf_evlist__config uses opts->overwrite, which you set in your perf_top_overwrite_check call.. I'd think you need to call it sooner jirka