From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755723AbdGKIvv (ORCPT ); Tue, 11 Jul 2017 04:51:51 -0400 Received: from terminus.zytor.com ([65.50.211.136]:46743 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755381AbdGKIvs (ORCPT ); Tue, 11 Jul 2017 04:51:48 -0400 Date: Tue, 11 Jul 2017 01:49:25 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, adrian.hunter@intel.com, namhyung@kernel.org, wangnan0@huawei.com, mingo@kernel.org, acme@redhat.com, tglx@linutronix.de, jolsa@kernel.org, dsahern@gmail.com, luto@kernel.org Reply-To: luto@kernel.org, jolsa@kernel.org, dsahern@gmail.com, tglx@linutronix.de, acme@redhat.com, namhyung@kernel.org, hpa@zytor.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org, wangnan0@huawei.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf evsel: Fix attr.exclude_kernel setting for default cycles:p Git-Commit-ID: d37a369790774af66a4aee61a188384d21b17a43 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d37a369790774af66a4aee61a188384d21b17a43 Gitweb: http://git.kernel.org/tip/d37a369790774af66a4aee61a188384d21b17a43 Author: Arnaldo Carvalho de Melo AuthorDate: Mon, 10 Jul 2017 16:08:07 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 10 Jul 2017 16:14:48 -0300 perf evsel: Fix attr.exclude_kernel setting for default cycles:p To allow probing the max attr.precise_ip setting for non-root users we unconditionally set attr.exclude_kernel, which makes the detection work but should be done only for !root, fix it. Cc: Adrian Hunter Cc: Andy Lutomirski Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Fixes: 97365e81366f ("perf evsel: Set attr.exclude_kernel when probing max attr.precise_ip") Link: http://lkml.kernel.org/n/tip-bl6bbxzxloonzvm4nvt7oqgj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 87b4318..f2a1876 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -273,7 +273,7 @@ struct perf_evsel *perf_evsel__new_cycles(void) struct perf_event_attr attr = { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES, - .exclude_kernel = 1, + .exclude_kernel = geteuid() != 0, }; struct perf_evsel *evsel;