From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F434C433E1 for ; Wed, 29 Jul 2020 18:52:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FEE720838 for ; Wed, 29 Jul 2020 18:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596048738; bh=X2GAMQ3RIXB69rXlNng75zFV3IhgrTburC3Gs/D1yUo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=WTGWtlc523WroOxJLYgrdd3Vir5qCYCaDRWcp+0qhxUhLctAL2FH1r8S6qaR/SHRb nxmh/fF0I68WM/10Oy5Y5XP9r4MP5yORk94d4eHY3csYr6uqKGrtH3n0sQV4KcmT9W DOBZVxF58wFyctLt7pDxSVSOvA/tyT1V/qJV5aHI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbgG2SwQ (ORCPT ); Wed, 29 Jul 2020 14:52:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:50252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbgG2SwP (ORCPT ); Wed, 29 Jul 2020 14:52:15 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 046D72075D; Wed, 29 Jul 2020 18:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596048735; bh=X2GAMQ3RIXB69rXlNng75zFV3IhgrTburC3Gs/D1yUo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0qquShLGWf9uf/R0aFWS6yJCF4oe+DjfWxvCgVH5a4PxSbv6kinVZ2bPUcuDqE2Ef 3xmCYVUvr0b5f4uYukyQnmx6lbnT4J0Yz6EnWT7t8uEQkVCPZTiyweyFVyM0P40cyw n0kY0p72PSwig5blFpb/EI4z2cZS7P/bN8V8n3j0= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 0661340E57; Wed, 29 Jul 2020 15:52:13 -0300 (-03) Date: Wed, 29 Jul 2020 15:52:12 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , Adrian Hunter , Andi Kleen , Athira Rajeev , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Stephane Eranian , David Sharp Subject: Re: [PATCH v2 1/5] perf record: Set PERF_RECORD_PERIOD if attr->freq is set. Message-ID: <20200729185212.GB433799@kernel.org> References: <20200728085734.609930-1-irogers@google.com> <20200728085734.609930-2-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200728085734.609930-2-irogers@google.com> X-Url: http://acmel.wordpress.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Em Tue, Jul 28, 2020 at 01:57:30AM -0700, Ian Rogers escreveu: > From: David Sharp > > evsel__config() would only set PERF_RECORD_PERIOD if it set attr->freq There is no such thing as 'PERF_RECORD_PERIOD', its PERF_SAMPLE_PERIOD, also... > from perf record options. When it is set by libpfm events, it would not > get set. This changes evsel__config to see if attr->freq is set outside of > whether or not it changes attr->freq itself. > > Signed-off-by: David Sharp > Signed-off-by: Ian Rogers > --- > tools/perf/util/evsel.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index ef802f6d40c1..811f538f7d77 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -979,13 +979,18 @@ void evsel__config(struct evsel *evsel, struct record_opts *opts, > if (!attr->sample_period || (opts->user_freq != UINT_MAX || > opts->user_interval != ULLONG_MAX)) { > if (opts->freq) { > - evsel__set_sample_bit(evsel, PERIOD); > attr->freq = 1; > attr->sample_freq = opts->freq; > } else { > attr->sample_period = opts->default_interval; > } > } > + /* > + * If attr->freq was set (here or earlier), ask for period > + * to be sampled. > + */ > + if (attr->freq) > + evsel__set_sample_bit(evsel, PERIOD); Why can't the libpfm code set opts? With this patch we will end up calling evsel__set_sample_bit(evsel, PERIOD) twice, which isn't a problem but looks strange. - Arnaldo > > if (opts->no_samples) > attr->sample_freq = 0; > -- > 2.28.0.163.g6104cc2f0b6-goog > -- - Arnaldo