Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp400839ybg; Tue, 28 Jul 2020 08:45:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznh9DToiewhRT5rN+x0mYCTSPBzQUtXgWNBlHGlikamvUuiuM1qSUIaAPXGwPN5xAXdfOE X-Received: by 2002:a17:907:2662:: with SMTP id ci2mr6866816ejc.334.1595951106916; Tue, 28 Jul 2020 08:45:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595951106; cv=none; d=google.com; s=arc-20160816; b=UnkguSyMvYZzi+kaLXiokD9QEhCrc1vQluMD91gvLVqTRwrGFJIRiaG1OQ9ztFqJhz xNJEnBtjKHM8rdLqKVCuGHsTOBnSozsVNlIZTsObm/huBlUeQ4uvkOgy5Hkzv3fuoWnc 7YkmgmYgzS+8tWV7XXIjikFZVTgyXzTqYpkmcdp5USvTub+cDTs7Xk60D/8uxQ/60jIU EYPeiwL6xHPKFflDCqPbAthiK/PyvjYj9U/DDoHYtAnjZq7c2sc3wvhgKl3se4QZTqsb F88EWNCLXvlTDS0tPnwEcJoyOyiUZsK6vqiOBQxuzsZsYkkO9nRNf56eZZvS063oGung 4Sqg== 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=FDf5+25lFZcklL9KwYj+G66FeAA38ciNootaoOX+T3U=; b=d8Z8nBuL4Y3D27tX/FQliNoEfPMz7YO3LBXnljc3579SLnUSgpElbjKuyS/oQPt/4R lCEbkfp4stu83t/B7onfz9QfSw0mfdrYTsk/2pE1+esQT17jS0Vmk6024JGUjvflHxEO eGLeHs/V+ajDJHiYUXtKcmav252/zHpAwfVH2tO2PxUZXzSc0T17GMDf5bgFYnoLEckf 9Yn9Zg9xleiENLNQC7c/Du4yHwTqcaO/MA3b3SOgpABur0R4G/VZZrt6fzLeTfg4gawW QlRcNw1JBBU4GlZm42zf/WI9+7jGJVLYQ3Y1g6QHz3agYiOlW0G1DLauIQ4KGnqHQlQu YzXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TFpgL9vr; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si5819077edx.408.2020.07.28.08.44.43; Tue, 28 Jul 2020 08:45:06 -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=@redhat.com header.s=mimecast20190719 header.b=TFpgL9vr; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731039AbgG1PoE (ORCPT + 99 others); Tue, 28 Jul 2020 11:44:04 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:29718 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730872AbgG1PoC (ORCPT ); Tue, 28 Jul 2020 11:44:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595951041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=FDf5+25lFZcklL9KwYj+G66FeAA38ciNootaoOX+T3U=; b=TFpgL9vrFaOyXOHjYS5+Gmb+nWEo+4LVZZNlm0FBmC/xLDAUNs+JDHViBXkAzYlDKkDKmc +RY8KDNVsIHnH4x78uA1hOKL69CzfDc4DDnt7ew/vwIM8n2hLYAz6ntovuAvuw1h5+zu/6 DNALx/6EZVMTni3qKY0cz+V2T2I5/XI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-423-wdmVKuviMTaLJ2WQ1NolbQ-1; Tue, 28 Jul 2020 11:43:56 -0400 X-MC-Unique: wdmVKuviMTaLJ2WQ1NolbQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58D89E91C; Tue, 28 Jul 2020 15:43:53 +0000 (UTC) Received: from krava (unknown [10.40.192.211]) by smtp.corp.redhat.com (Postfix) with SMTP id 2FF1287B08; Tue, 28 Jul 2020 15:43:47 +0000 (UTC) Date: Tue, 28 Jul 2020 17:43:47 +0200 From: Jiri Olsa To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , 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: <20200728154347.GB1319041@krava> 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 28, 2020 at 01:57:30AM -0700, Ian Rogers wrote: > From: David Sharp > > evsel__config() would only set PERF_RECORD_PERIOD if it set attr->freq > 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 Acked-by: Jiri Olsa thanks, jirka > --- > 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); > > if (opts->no_samples) > attr->sample_freq = 0; > -- > 2.28.0.163.g6104cc2f0b6-goog >