Received: by 10.213.65.68 with SMTP id h4csp2142188imn; Sun, 8 Apr 2018 20:47:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/FmsqFjCpmbPBuQN6VeAyOHLzN7vG4ORgZuGwzoGW5BspC5pdHyOxD+jeBoVYsvxNptIoh X-Received: by 10.99.116.81 with SMTP id e17mr14276245pgn.437.1523245677472; Sun, 08 Apr 2018 20:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523245677; cv=none; d=google.com; s=arc-20160816; b=Ewd/Ye2qWOWVBBi+vDeIQgDnTOhhz/U3Vy0pnellq/YLnQJSvxMZB9hxDyJRkhx5o+ uy2/2KVjxWRU9oHvv1ZqehbAIS/aZ6Pmp87NnfvnPhWA4oD7p9pzd36g/OuoJjCCEr5B lJwRV5YkoD0vuWjfbjjCZpF/RZJAdbVHwtSApdM4pa2YVcBw3tDTYAfxwlEVx0ZBJ89C diZJg760NrwCHPtcbVuBiv/tN4zsoYO3pO+UZSVPBIej/O3SGWURbOzPNTxk7JS+rhX8 7KJ6AJhlGFZKDpyb62/Zx5NBwXifkGpgRcsn80Krb2ss50TXyrCgEIntUf1t83xDgscd EkvQ== 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=bqVwEpvR9TssMuZ4pxi5bZYWlDZQve1R9aFbs4q5hn0=; b=WLztPMnI+jk+8chiQf8qhMI3bqdXuONgMIlCwjMKAmLmTSLCD6mQjp2LenN8SNVL+O Y166n9KNil0w7WkoCM3V45+5pmHp6q4go4OdoRA0ItR0JMiOw/Egcb9bSvrR+wbbNRb8 nfc5hwjRiHT2tD3WF2kNI6xxEn46B+OGYYcDXUmAYc2AzvhCXxe/v5aVu/Y59vIF+PG2 Zwfq+FmwYhNCrYsHomvsv/QhZvfTs6U/aRgawsTiO6dRUMuZhQ3EI3UkK16u/dzVkGkg GfJAaw6td/GWdXB80RAMWmQjCXgIdfo08vqRhoNL0cB1+Y/f6+5cMOhltKjN6q3Ofx3g /VJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=I3uHJ4yj; 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 142si10493536pgg.29.2018.04.08.20.47.20; Sun, 08 Apr 2018 20:47:57 -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=I3uHJ4yj; 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 S1754459AbeDIDmZ (ORCPT + 99 others); Sun, 8 Apr 2018 23:42:25 -0400 Received: from mail-dm3nam03on0097.outbound.protection.outlook.com ([104.47.41.97]:45238 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754272AbeDIAUg (ORCPT ); Sun, 8 Apr 2018 20:20:36 -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=bqVwEpvR9TssMuZ4pxi5bZYWlDZQve1R9aFbs4q5hn0=; b=I3uHJ4yj2h6v6qEr1fP9JperRBZ494/V3ZhEEGH0MC+t16F9O8ejqeZuZH/HJV7soXeLkVY4d3xWToavN1n1EqsesAz3C/BYlo0jydcImNVqxhaUFa/t5XPKfukHPEwbNaaYrkrswzwDENixpihqPacTFwEievRNEM1l3wkvkCE= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0920.namprd21.prod.outlook.com (52.132.132.165) 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:20:25 +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:20:25 +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.15 149/189] perf record: Fix period option handling Thread-Topic: [PATCH AUTOSEL for 4.15 149/189] perf record: Fix period option handling Thread-Index: AQHTz5hUW+hOF5fkK02WiJpk8gifkg== Date: Mon, 9 Apr 2018 00:18:48 +0000 Message-ID: <20180409001637.162453-149-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-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;DM5PR2101MB0920;7:AM5w60bToajAPKqbudhVA1OqWKbjqX2NFhmOajFOVkiI4CODF9okhDMw9uqz7CyJ3K6OJcadEHsmBtVKb2m3YaijB0VHl45LJ0BetiVP8cIcdEY6aMMX8QkwJERj+azke/YKmefRoCqfqCMgCGYwb518InQkgNVU6rtclbbuihm0Z6rNGcCVMmSoOCluJsY4aNmlB+j9Ycxlk6iehxfqVY/9Klx61Dj7ZveE0vo8YIzm0BSuYDvamC9BDTdIAS1K;20:m3+pWLQc4Qu7d0sBCjPcQ3+LrXhKwE66HHbYl7qembpn68LpCxxEf1+8j+7grHzehPT8cPDhUz3rGkzD7ZOdiTmFCBms6UNqJfmMa31maGIPSwTSRyM6ozl/jP1Y293UA408AU2JQpX/YZft3jqv/BkIAz+eogA70vJ99EadL5c= X-MS-Office365-Filtering-Correlation-Id: c055e641-7d66-4e3e-6c96-08d59dafb0e1 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:DM5PR2101MB0920; x-ms-traffictypediagnostic: DM5PR2101MB0920: 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)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0920;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0920; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(396003)(366004)(346002)(376002)(199004)(189003)(66066001)(86362001)(59450400001)(3660700001)(3280700002)(25786009)(76176011)(2900100001)(36756003)(6506007)(2906002)(99286004)(86612001)(6486002)(102836004)(305945005)(1076002)(7736002)(575784001)(97736004)(2616005)(446003)(11346002)(476003)(486006)(26005)(39060400002)(6666003)(6512007)(4326008)(107886003)(6306002)(5660300001)(478600001)(6436002)(105586002)(10290500003)(966005)(5250100002)(22452003)(316002)(186003)(8676002)(110136005)(81166006)(54906003)(6116002)(8936002)(72206003)(53936002)(2501003)(3846002)(68736007)(14454004)(81156014)(10090500001)(106356001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0920;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: I5uSRpioqgUOyWNETBOCHKgEJoLZwVvi1MlaBYxO416lIhuBVWT1iXh1VKZ8RgRCG7qlaNU4ZyusWF2WWtdEehDtF4b4DsFvSXPxl0AuECUG/gqvgwr7YvEaScptfBpmtcCcxiggkDQUnoih8QvQNnp9kuW8jSns/I7Al/+Lclup2r7I+WH8cCF/fOJ1N5mbMmHZUZLmyX+7gHFavOfq13ghtXkyOkBsB6Mg49QVf2ztPVT/kB1bcbVFC0qKINwxxB+BWhUanz+mgjDkFCq01wjvp4T2J2nq7C8PSHXXpIDqQ7nUyOnWqFRDdUYt/DnxEg1/wH/GBWXm3G0QaINS/zF4EqBZ9R5PqCsNHvWbZwJY9v3Cg0Thudgw5B3hz1FbfmjMQae7+C7Ph5YtXHgkbIRiRdm9oouzSdP3amYn2Ao= 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: c055e641-7d66-4e3e-6c96-08d59dafb0e1 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:18:48.4248 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0920 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 003255910c05..2ccb709c0b08 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1533,7 +1533,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 2357f4ccc9c7..cfe46236a5e5 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 784d852c91cc..d23a8c51b307 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -948,9 +948,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. */ @@ -1052,6 +1049,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