Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1352189ybg; Wed, 29 Jul 2020 11:52:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuTMKHg1pLVze4DPQsD0Ni2IWYQPJ9yT8gjcIRiSQ1Cn15PPR182YviOzzMfLQbfCMwaTZ X-Received: by 2002:a05:6402:1764:: with SMTP id da4mr14086774edb.187.1596048779480; Wed, 29 Jul 2020 11:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596048779; cv=none; d=google.com; s=arc-20160816; b=RdiWK1ZD0dDdur6oygMGVLAMJHb7apb2RKY9vY5MZ0sgVwgjKnrj98tUXuJrLOtBnY 8gfGe6TtMlWcTnOhA4O2IaHuV4Sy0X6EaFlf0gIQQU7k8wLlmq2abcEiod3829jWavYp pHNP4hm+iQVEBYL7trlk7ZvbiP52/kPNHbafusbhhT0OJ/qFOa9qyTXVD0yyRGOKk9L4 sw6enVnaGGGvcv1dH7TIsPAAsfOwOcDTd3aDAEB/PCOER/anYB2fThpwpCWd5fJA7eVG b15XtQS9LR7D8naLTnsjJOJW/HhmGKKnpj1e3CPx2TiuTSdRxztpOmJhQP+S1Q7lxBqH w/NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=aeVSTe/pP0dx3H+3WXSA7BsKEtYQ8comfOtZKu6QSK4=; b=DdXT8xdeMw10HBzcuNHj0gVougIhg5AZ0R3YcHLwvc0K6tfSQWbUTaV4pAJfloBI+G P5jPAwHxV2fYfzeO7H4pQP44NnTtHAZR7djT/Q3/fNcWvFTnztjLfVz6CDyErsDQH83H iqp2btndna6zgAWNFLOlQgQYFBM4cKcth4mtz1kFT9VhrF7c/T5zdSTRs2YCxCGQ6Uz6 D9ZJwP0oRfvczuth/tqMQooOY7SJLHjjJTGxpgjkUNnAMkvIjj4q0hTqqIATaH6qx9Uu V7EBQCd5u/5Z4bNKqEtBZIMuXU1ayjmHChOyR+ATTEpWA0ToYezILx4/XeW+uTUDLxDf nv0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0qquShLG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si2523695ejc.80.2020.07.29.11.52.36; Wed, 29 Jul 2020 11:52:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0qquShLG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727001AbgG2SwQ (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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