Received: by 10.192.165.148 with SMTP id m20csp541281imm; Wed, 25 Apr 2018 03:59:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49goXPB+YgD1hREYvI4rX96rD6WB47/nxMSRHrI6g9wzALTINx7RyEks4uXECZvOLPxREtK X-Received: by 2002:a17:902:aa90:: with SMTP id d16-v6mr28691516plr.189.1524653980021; Wed, 25 Apr 2018 03:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524653979; cv=none; d=google.com; s=arc-20160816; b=Annn5WmQ5ZT+Dss699Y4V4d323gDsZIjcYl06m6X9mK9P1oQgrctjyziJ2CWVMRzOS bo0rnFCrsdUoJNB7Zw9CFzPX48DbAYKKMXPI1utH3J1yHtkHvCt69XazwRoTknXM+/Z+ KWF74UiysuRjEgkBn98VKlkJb4EIjqrQEQvtsLHl1QG7qu9pS9j5yzTHPrXUxefv9XZG NgQebJ57/1RYfyOrsx10jgjFWtOKjDdP+Q2Dl0QwmBs11PKVsMclGoWVwlT13LC8XTLr yzXmYOlH4lz5PllUE6kV0idTxc0T+dOEiJBBD2Kc2kuQjaxf329CE6wL5kkvtMmAXD+1 xaiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=PT3NIdFtJAVRo3hSK6TVG8omgL8nP1s77qQ2qrduMbQ=; b=uCf9R/55FtVm067ILwMYJTle+FZjf/HRZfukFPM9zzIIk5XR3BYrW2bWQf93fuw3WV e1mh6VxxOzqKlug7SS4R4fZkJzzSox877Hx/BOHG/pF9vhK7GmuD2rvHvKVOfva1uS9p CzcXxmG6FFXCwRPO02yrEz0pfTyp60FpQrtv6kM7J9npfHnOAHfcufiOEbfLHbC7GQjp HeloTAK+P2ZDkCrV0jOOG2tC0roRJ1DDtEEugA5fUGwqDZidpOOPEq2/cOftw0BVszNH 871F6st8sMr0cM4794FUe/BoONHX4J14+q5qW4Bw8NLFGbA3Pfk84AuU2yR9VgD8VEIv lUqg== 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 d9si12378607pge.290.2018.04.25.03.59.25; Wed, 25 Apr 2018 03:59:39 -0700 (PDT) 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 S1754178AbeDYK60 (ORCPT + 99 others); Wed, 25 Apr 2018 06:58:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52828 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754159AbeDYKm6 (ORCPT ); Wed, 25 Apr 2018 06:42:58 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CB1D95A7; Wed, 25 Apr 2018 10:42:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , Jiri Olsa , Alexander Shishkin , Andi Kleen , David Ahern , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 138/183] perf evsel: Fix period/freq terms setup Date: Wed, 25 Apr 2018 12:35:58 +0200 Message-Id: <20180425103248.083184263@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiri Olsa [ Upstream commit 49c0ae80eb32426fa133246200628e529067c595 ] 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 Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+) --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -736,12 +736,14 @@ static void apply_config_terms(struct pe 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: