Received: by 10.213.65.68 with SMTP id h4csp2117393imn; Sun, 8 Apr 2018 20:08:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx49EjqxQSgwtFT1QILsfYC9uUGTKFg3PLWfADK4pXNSojDL6QhEob+LNqplyLtto+wvb7UvD X-Received: by 10.101.98.153 with SMTP id f25mr23484342pgv.6.1523243305072; Sun, 08 Apr 2018 20:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243305; cv=none; d=google.com; s=arc-20160816; b=vtIoaPEW8vGeqPSgtSCfHe/+kkcdH9UHiqPZMEpwNXSbm3pDNkHHmnUGec9a+HCpI/ 1mdHTHn4037umzsjbEgJEQNVKLIeamNUW6iZq70k+rzA+FCBqn4a+g4YjkMH0V9G8F29 G9LE/xRqg6zfkJ996pMd2HHAcsKyNgvH4mPDRq5d7it0GcUR4oWUmUEBlPjvzN6EWMBw TdzDzdbPmVHmzlWbM2Bdv1YHbLBDOirnjhQyQ07h2IL+g91s2QP0oD1NoTAhKmlKkTtj /tecqk9gUFhNvelSGwkOCxhEDaAfA2V2YksxTU8QraFXAKE+FdXeqB39iUU8c5FoBAbP Svaw== 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=76ClGiYnYyXbn2QmKN6KV0ZyforSs1CFkSDiIuluyP4=; b=u+xoLhdNc3xrrk0Z/unUxf4kZZlV1Sg5870L1YGFY8R84Ad7d9e4JtjnJDhT63Ac13 bROi2MA7rSoEXtJHRD6MlhNQUp1fbmYHMkubUR8D/ETRzKOCGuCXU7Jvv3vtKgCpT6wk +Bubm/Dzpwm7ArF1APmQRS47L7sdoJ7qflRRiNZTqirCVKYrmIzmAvVQJJ1OMfTDS9oz 5k+WE4MiBmHJ/l8hdQNw0ox1Hh1v5z3fD7tYqwf27+hkkAn6Bm1eUzpM0YtVnLa3dDJo /XBY61KhevPAYxqcEptMg62NVbEkc1Tjw8AnzMu3KeN8SnnOlWdXzg8aUIC2dXukutA5 flnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=oxbWKwmR; 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 n3-v6si13553275plb.147.2018.04.08.20.07.48; Sun, 08 Apr 2018 20:08:25 -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=oxbWKwmR; 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 S1757548AbeDIB7c (ORCPT + 99 others); Sun, 8 Apr 2018 21:59:32 -0400 Received: from mail-sn1nam01on0103.outbound.protection.outlook.com ([104.47.32.103]:45281 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756483AbeDIAcR (ORCPT ); Sun, 8 Apr 2018 20:32:17 -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=76ClGiYnYyXbn2QmKN6KV0ZyforSs1CFkSDiIuluyP4=; b=oxbWKwmRWwTb2aOeEeSGsL1VfsN+GFYwx/lHMaaIx9OkYtdH5/o/IW7wYLimxKj4HB6jW2b2rDFXSzdwsXFD/Xso+aU/37zN9T5jpWJbxQZcn+J8vPV+fXBFbX5c3NLRYskF4i3TST24bNFowLqIW5mytcW9jWWwHTIshZ/FXDI= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0870.namprd21.prod.outlook.com (10.167.110.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:32:11 +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:32:11 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Arnaldo Carvalho de Melo , Adrian Hunter , Andy Lutomirski , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 207/293] perf evsel: Set attr.exclude_kernel when probing max attr.precise_ip Thread-Topic: [PATCH AUTOSEL for 4.9 207/293] perf evsel: Set attr.exclude_kernel when probing max attr.precise_ip Thread-Index: AQHTz5lHY9sln8VNC0uUfuUwfkHTBg== Date: Mon, 9 Apr 2018 00:25:35 +0000 Message-ID: <20180409002239.163177-207-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0870;7:Kq3b9OLQxRVMzwV+UQYDPfWBFenI18RB2Nxzgc5JIa0bVh25q623St98RPm1YzY0WGS826H6V9EwD6bjU0wTnE0IgWNR/qCSoRBgUrY8oVYv2HfA5EiHluPmvlhcq8KYQohJCE0IrXq3Z7hNNQAgxC2N+h+fMsKDsa4VA20iTVk0m9fyJYF5TrYydfAk+sSfGC6h3p0cO2YSdAdZnaVs/1HjJ5pYFr6WiMNW6OOrcAwQcRZtuauN2Ft1iRyifwVp;20:iOtNc2XmWP9YKxDxQk7zxCsY3OdM3jsOPcrdS740EQnDnhOEO5BBfCfkCMYFb6udvX5kVaKRIAZ4Q6kYk8cl8VdblUbG0i3ekp4TLcB3dFI6/U3k0rEBxJQiqmsgLaG2Cbg1+pQvKux8rPU9dEKV0ugn/GropnnZddcx7uI3v8I= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: b5009054-2951-4a2d-a066-08d59db15570 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0870; x-ms-traffictypediagnostic: DM5PR2101MB0870: 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)(50582790962513)(85827821059158)(42068640409301)(84791874153150)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0870;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0870; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(366004)(396003)(39380400002)(376002)(199004)(189003)(53936002)(2906002)(6512007)(6306002)(102836004)(2616005)(76176011)(14454004)(446003)(10090500001)(11346002)(476003)(39060400002)(486006)(107886003)(2900100001)(97736004)(966005)(66066001)(6506007)(6436002)(106356001)(99286004)(105586002)(3660700001)(6116002)(86612001)(3280700002)(6666003)(2501003)(10290500003)(26005)(8676002)(8936002)(478600001)(68736007)(5250100002)(5660300001)(316002)(4326008)(72206003)(186003)(110136005)(6486002)(7736002)(25786009)(3846002)(86362001)(36756003)(22452003)(81156014)(81166006)(575784001)(305945005)(54906003)(1076002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0870;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: 7hocWithlndeQqaJ2TSYCTAZRBp7yptd1bnKnqc0n879aqJPqgYx/7JmgbwrTjoAguFqmGtiUiKNXyspOeju1sVf/yRVMOJLWpLVh5IyI32HH6DhxkJFTfxy0Wj0I+y6IGkharOHWMxZK2SOLgDdjagBbxRPjw+vfLvv08CQgsmyWnbgyzrLzX5XI/JAV321RowYHa3OIMnwG23wWBNCOrjYROnZ3x6+7PlKFYLz/5faQZqLWuo/9Pw2Y2sWWvy/pWZoeqqyv7RfJRcndTLqBIPQI5anxgGFQ7KGyqpyM6ZcBqA7c+Zpn4GMgmt1Og56uyQQB45f20JMae1040vB8eKjpX1p2L2/axBEspEE71GJsLSfhBwBtq6yGOJTLLb+WC4b/kbk3eZk+nBU4NySqrIuH9Ifsyr9aQevw7MMS7c= 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: b5009054-2951-4a2d-a066-08d59db15570 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:25:35.6596 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0870 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 97365e81366f5ca16a9ce66cff4dd4c5b0d9f4db ] We should set attr.exclude_kernel when probing for attr.precise_ip level, otherwise !CAP_SYS_ADMIN users will not default to skidless samples in capable hardware. The increase in the paranoid level in commit 0161028b7c8a ("perf/core: Change the default paranoia level to 2") broke this, fix it by excluding kernel samples when probing. Before: $ perf record usleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.018 MB perf.data (6 samples) ] $ perf evlist -v cycles:u: sample_freq: 4000, sample_type: IP|TID|TIME|PERIOD, exclude_ker= nel: 1 After: $ perf record usleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.018 MB perf.data (8 samples) ] $ perf evlist -v cycles:ppp: sample_freq: 4000, sample_type: IP|TID|TIME|PERIOD, exclude_k= ernel: 1, precise_ip: 3 = ^^^^^^^^^^^^^ = ^^^^^^^^^^^^^ = ^^^^^^^^^^^^^ $ To further clarify: we always set .exclude_kernel when non !CAP_SYS_ADMIN users profile, its just on the attr.precise_ip probing that we weren't doin= g so, fix it. Cc: Adrian Hunter Cc: Andy Lutomirski Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Fixes: 7f8d1ade1b19 ("perf tools: By default use the most precise "cycles" = hw counter available") Link: http://lkml.kernel.org/n/tip-t2qttwhbnua62o5gt75cueml@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 97fe0c80ff02..1c1291afd6a6 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -258,6 +258,7 @@ struct perf_evsel *perf_evsel__new_cycles(void) struct perf_event_attr attr =3D { .type =3D PERF_TYPE_HARDWARE, .config =3D PERF_COUNT_HW_CPU_CYCLES, + .exclude_kernel =3D 1, }; struct perf_evsel *evsel; =20 --=20 2.15.1