Received: by 10.213.65.68 with SMTP id h4csp2120898imn; Sun, 8 Apr 2018 20:13:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48N42nI/MmC008YjrA1zVxCyP+xPU2i7/arX1wKFHTWiPnGjdxIl60Cc9aruLukWOtHV3NF X-Received: by 2002:a17:902:5497:: with SMTP id e23-v6mr6955834pli.308.1523243593998; Sun, 08 Apr 2018 20:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243593; cv=none; d=google.com; s=arc-20160816; b=0x5DvdMiCYF0197zN8D39vZgGHaWEpleQg7nZOhWfQJsDEUyur2GjqhqUHlSs9q+15 kK8kXa3xI6o6qkCUXmuQqViNUcihpTKwHG5GL51TX78NIsIviieECje1wSZuQ1UTO08f gTtUvM/jezqH+3fX/87MEFROQPXa7pIdl59ctE7NkkTlDtvYOlaIj3a7UP85kkU4BSjY xxfLbRqrg0dS/1dULDw/AGhX30IYzxJgJr8p+uXLF8oVqlugWpp/eQm4rNCLhPQ82ely ZXg/F1FN/WI7jxft3nwTMRNeDGUU3ULaCNMI8vzU+Pu1RO/xr/kDCuDROPWBf1eVvvpf 2/CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=iSFoO/pc+IxBY+yeCyRq8vW4Owm1reBoKClP37TyZ0g=; b=h+VNXEwoU7/Mirq1HJO3MsK/IHTQpY8+AG/vM2FTMPwMERgOPiXLRT3no+Pa5UI5m4 34ExyetKmZ9nKTUP7N600DfDGYA0VhyQtkPkXSa+9Csdr9RayGPrFRiWbU6wcl/E5+Eg 68Q2Gkc9+9lzDC3lhbshr+66QmwUzVvHkNXX7cv+8dbew4sGJgfUBJLSbjTpUhuiZovz k/8QPf3UTrZbaaz1peRAh39t0HJ3bg8xJ2zYANX1VX6h5zwJrYSRskk+2HB2pXOUhkBX GXqbtWb//EhzT9vvJwBpzA9nl9WWjLXDEsBl1OYQ2M/CPrZxbzKH4W7OviEFV/vqIn5r jzXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=BEIize3s; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si12131883pff.361.2018.04.08.20.12.37; Sun, 08 Apr 2018 20:13:13 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=BEIize3s; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758167AbeDIC6C (ORCPT + 99 others); Sun, 8 Apr 2018 22:58:02 -0400 Received: from mail-bn3nam01on0139.outbound.protection.outlook.com ([104.47.33.139]:14848 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755213AbeDIAZh (ORCPT ); Sun, 8 Apr 2018 20:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=iSFoO/pc+IxBY+yeCyRq8vW4Owm1reBoKClP37TyZ0g=; b=BEIize3s4xaTNXrUNwDRCgc6WhMNeVCxo22qQA/43nt0Esb8Mb1wRT/eVNyJNEcTUNHoLHG3jUV8i/JS++s6S1kL2pIMLkJ/lvu7IC2vltIUvtLiDYYlobBVjb+1gUcVE9bVUE1JGJ91KfovnbDdGm9G/JfyO51MySpHLvYlkK8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1013.namprd21.prod.outlook.com (52.132.133.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:25:31 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:25:31 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Jiri Olsa , Alexander Shishkin , Andi Kleen , David Ahern , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 125/161] perf record: Fix period option handling Thread-Topic: [PATCH AUTOSEL for 4.14 125/161] perf record: Fix period option handling Thread-Index: AQHTz5i4aE/9EYG0oEe6zzW+rK7y+A== Date: Mon, 9 Apr 2018 00:21:35 +0000 Message-ID: <20180409001936.162706-125-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1013;7:JLDDNsWyncFl4Cx08bE+Oaf0KT+tqqCNREaZaPAA1BmETf0mEUjd3XlMbhusypG64ciCehjBx6e533u2j0EezHQp+zttZW5PgQmRFfk0s6hShK3TKIg5oIZ9kN3plzjlrLUNil9aVqYw8zv9CuJI/nENL3z8HmLCbU0b4EA2GGGk52Q+1EJrXpT/FUt8WP7ctKVEmDzE2bnFf9YeY0wwH884FJQAGVrU/tG8ssBR5/oNeAWGnIPV2ceOWGIOwTJK;20:gSuwQWf57+x2pY/djTtJYREwIG+o7+iIZk7Fuph5Ouoruu73zRok7z1zks8jHT1BY+XvRjs+TC0kfmU7iTDAeVl9CYIMUqjHuxFwbFs0AAsofWxZ1KutwJ5kPpXu66ia51ifj0avYbdUrWesHQM5yw8Nqtp8OXy5czUx2PO+TVQ= X-MS-Office365-Filtering-Correlation-Id: c8795498-65ca-4e8c-f448-08d59db06736 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1013; x-ms-traffictypediagnostic: DM5PR2101MB1013: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158)(211936372134217)(42068640409301)(153496737603132)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1013;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1013; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(366004)(376002)(396003)(39860400002)(39380400002)(189003)(199004)(3280700002)(2616005)(8936002)(7736002)(476003)(446003)(11346002)(53936002)(3660700001)(86362001)(86612001)(81156014)(2906002)(186003)(81166006)(105586002)(1076002)(8676002)(26005)(97736004)(25786009)(6306002)(6512007)(3846002)(68736007)(72206003)(106356001)(5660300001)(6486002)(6116002)(966005)(14454004)(4326008)(305945005)(6436002)(2501003)(5250100002)(10290500003)(478600001)(2900100001)(59450400001)(22452003)(110136005)(39060400002)(316002)(99286004)(66066001)(10090500001)(107886003)(76176011)(102836004)(54906003)(6506007)(36756003)(486006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1013;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5KP8ca6yRK8wAgHLGtX7oV79w5GP3ajlX+0Xxqki1wv7pfQLZChLw9e0PboKyvcQro2pZ6STcxaQHm53Dc49JFpBNnTwlOcOz9WS2hzWLtH3PEomTYFwtf1n+UwQOGLCLyQXD0qryWKIFFjSBIhCQsCknYS4tdBI5n2IUpp63MPMYriUUbUVM4+XBmZMb5gBBjGuMvIRLrINvgYwo+RvqzMOQpIE1TXwql8YrXL1EdsFgANA2UcsYMmP2s5RHxB+iy+5NdV8txL6j+chOGXfR9q3I9eckuiwaNmZrY0VdMtKNyvnXjyJsNcXzauZf7JltoUVjs0iXuKinTQUdnfaJ09wykwt8HbTc0lWovNprRVF8tDGqnKVIqQL3P5eEqc2DsTwM5NQ5GDSRagboF/v+l/Tscz/qLi47HxkL3wp26g= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8795498-65ca-4e8c-f448-08d59db06736 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:21:35.8936 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1013 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa [ Upstream commit f290aa1ffa45ed7e37599840878b4dae68269ee1 ] Stephan reported we don't unset PERIOD sample type when --no-period is specified. Adding the unset check and reset PERIOD if --no-period is specified. Committer notes: Check the sample_type, it shouldn't have PERF_SAMPLE_PERIOD there when --no-period is used. Before: # perf record --no-period sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.018 MB perf.data (7 samples) ] # perf evlist -v cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type:= IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, en= able_on_exec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1= , mmap2: 1, comm_exec: 1 # After: [root@jouet ~]# perf record --no-period sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.019 MB perf.data (17 samples) ] [root@jouet ~]# perf evlist -v cycles:ppp: size: 112, { sample_period, sample_freq }: 4000, sample_type: I= P|TID|TIME, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_e= xec: 1, task: 1, precise_ip: 3, sample_id_all: 1, exclude_guest: 1, mmap2: = 1, comm_exec: 1 [root@jouet ~]# Reported-by: Stephane Eranian Signed-off-by: Jiri Olsa Tested-by: Arnaldo Carvalho de Melo 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-3-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/builtin-record.c | 3 ++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 11 ++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 0c95ffefb6cc..272ff4b5e80e 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1611,7 +1611,8 @@ static struct option __record_options[] =3D { OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time, &record.opts.sample_time_set, "Record the sample timestamps"), - OPT_BOOLEAN('P', "period", &record.opts.period, "Record the sample period= "), + OPT_BOOLEAN_SET('P', "period", &record.opts.period, &record.opts.period_s= et, + "Record the sample period"), OPT_BOOLEAN('n', "no-samples", &record.opts.no_samples, "don't sample"), OPT_BOOLEAN_SET('N', "no-buildid-cache", &record.no_buildid_cache, diff --git a/tools/perf/perf.h b/tools/perf/perf.h index f75f3dec7485..55086389fc06 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h @@ -50,6 +50,7 @@ struct record_opts { bool sample_time_set; bool sample_cpu; bool period; + bool period_set; bool running_time; bool full_auxtrace; bool auxtrace_snapshot_mode; diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 4c31a22bbaa0..7c335d84becf 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -943,9 +943,6 @@ void perf_evsel__config(struct perf_evsel *evsel, struc= t record_opts *opts, if (target__has_cpu(&opts->target) || opts->sample_cpu) perf_evsel__set_sample_bit(evsel, CPU); =20 - if (opts->period) - perf_evsel__set_sample_bit(evsel, PERIOD); - /* * When the user explicitly disabled time don't force it here. */ @@ -1047,6 +1044,14 @@ void perf_evsel__config(struct perf_evsel *evsel, st= ruct record_opts *opts, apply_config_terms(evsel, opts); =20 evsel->ignore_missing_thread =3D opts->ignore_missing_thread; + + /* The --period option takes the precedence. */ + if (opts->period_set) { + if (opts->period) + perf_evsel__set_sample_bit(evsel, PERIOD); + else + perf_evsel__reset_sample_bit(evsel, PERIOD); + } } =20 static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int n= threads) --=20 2.15.1