Received: by 10.223.176.5 with SMTP id f5csp2990462wra; Mon, 5 Feb 2018 13:42:32 -0800 (PST) X-Google-Smtp-Source: AH8x2271JjPDcfO7guREv4DVwTv5PPPaJ3dN1ZQBMycauRJUOx5qgzaZWUzGIbPBfa4HBkuiziRv X-Received: by 2002:a17:902:7841:: with SMTP id e1-v6mr216393pln.130.1517866952790; Mon, 05 Feb 2018 13:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517866952; cv=none; d=google.com; s=arc-20160816; b=eZc3AW2IsDQ38rxt+UKkQA3f7OJbfgd58fmsoX12fyYx4IEGWPrizaU+ECogmbNuEl h20MYDYuS/8bj54nlHCvajUEq3HDydaX6y6m6ZJ9g5bdaJiRMnb69Mo3555DWbgkAFRA cxCReF1YI/VbCMj4UdvivHeTGRON09GOnYcjtC0eDd82qZH4Ya+GGLA/twUe5/4sLffK mTW5Zvng/g79PdHV5u91RNzpmVrWKXbGosbwFFVSrWmqOYir2FfESSnhIl4ChneJCksZ lmbewFsMCwJYqDt2rqv4KZvCUNS1Wng0y12PFtj+Q9k2SueM8ap2w3+OrdKvZKniawtQ waJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=aJopiWnKbWHKmm/pKvUDJc0RJdD7ZRa5Ths2GNe1OLI=; b=X3Q6iy5CyMFGD5mP7qbOlVCcMeVUebBOMDPSKh8vWBopYCV9ysg8FSnwCLuiyJUjP2 MrOwqxrdwD/f37/XjOrFPybrO2LzDFj5En5bbqGFCyp2RLGXXal8cA/4ey/8jFmkXlYQ 00axl+XiDWvRyf9yF0ULAUqctjmczVZ4W/Osdl6H4+zvoBbuimwVuR5oJFi0afqHVgjQ 9mQcpG33t9VavEGvcpxscADELO/2nbL7PLoWqkXbM5yxviyfHeiWnPJSTe/2/WV9LFFT PiAQa7Rxm6xs+Tp61BQFJ1mfcqJN+64gKVrmR5H/axzdYdwxwZDBdHe739qnIn/ola5v njYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2-v6si4989893plo.811.2018.02.05.13.42.18; Mon, 05 Feb 2018 13:42:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752580AbeBEVlN (ORCPT + 99 others); Mon, 5 Feb 2018 16:41:13 -0500 Received: from terminus.zytor.com ([65.50.211.136]:35917 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752117AbeBEVkZ (ORCPT ); Mon, 5 Feb 2018 16:40:25 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w15La0Us030982; Mon, 5 Feb 2018 13:36:00 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w15LZxr8030976; Mon, 5 Feb 2018 13:35:59 -0800 Date: Mon, 5 Feb 2018 13:35:59 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Jiri Olsa Message-ID: Cc: mingo@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, dsahern@gmail.com, hpa@zytor.com, jolsa@kernel.org, eranian@google.com, acme@redhat.com, ak@linux.intel.com, tglx@linutronix.de Reply-To: peterz@infradead.org, dsahern@gmail.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org, namhyung@kernel.org, tglx@linutronix.de, ak@linux.intel.com, eranian@google.com, acme@redhat.com, hpa@zytor.com, jolsa@kernel.org In-Reply-To: <20180201083812.11359-2-jolsa@kernel.org> References: <20180201083812.11359-2-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf evsel: Fix period/freq terms setup Git-Commit-ID: 49c0ae80eb32426fa133246200628e529067c595 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 49c0ae80eb32426fa133246200628e529067c595 Gitweb: https://git.kernel.org/tip/49c0ae80eb32426fa133246200628e529067c595 Author: Jiri Olsa AuthorDate: Thu, 1 Feb 2018 09:38:10 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 5 Feb 2018 12:11:58 -0300 perf evsel: Fix period/freq terms setup Stephane reported that we don't set properly PERIOD sample type for events with period term defined. Before: $ perf record -e cpu/cpu-cycles,period=1000/u ls $ perf evlist -v cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME|PERIOD, ... After: $ perf record -e cpu/cpu-cycles,period=1000/u ls $ perf evlist -v cpu/cpu-cycles,period=1000/u: ... sample_type: IP|TID|TIME, ... Setting PERIOD sample type based on period term setup. Committer note: When we use -c or a period=N term in the event definition, then we don't need to ask the kernel, for this event, via perf_event_attr.sample_type |= PERF_SAMPLE_PERIOD, to put the event period in each sample for this event, as we know it already, it is in perf_event_attr.sample_period. Reported-by: Stephane Eranian Signed-off-by: Jiri Olsa Tested-by: Stephane Eranian Cc: Alexander Shishkin Cc: Andi Kleen Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180201083812.11359-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 66fa451..f2f2eaa 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -745,12 +745,14 @@ static void apply_config_terms(struct perf_evsel *evsel, if (!(term->weak && opts->user_interval != ULLONG_MAX)) { attr->sample_period = term->val.period; attr->freq = 0; + perf_evsel__reset_sample_bit(evsel, PERIOD); } break; case PERF_EVSEL__CONFIG_TERM_FREQ: if (!(term->weak && opts->user_freq != UINT_MAX)) { attr->sample_freq = term->val.freq; attr->freq = 1; + perf_evsel__set_sample_bit(evsel, PERIOD); } break; case PERF_EVSEL__CONFIG_TERM_TIME: