Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp254675rdb; Sat, 30 Sep 2023 03:21:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgmoTo0aMLVAundW7ByMXd7Idb90xJjY9uBS3tOAA2yInMDLKAdkITgCRFo4ECvLwFSapH X-Received: by 2002:a05:6a21:3b45:b0:163:a3ce:a699 with SMTP id zy5-20020a056a213b4500b00163a3cea699mr964808pzb.57.1696069271338; Sat, 30 Sep 2023 03:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696069271; cv=none; d=google.com; s=arc-20160816; b=pZAOFC8UUK93hI5uVTvxYHKM7Hrv3rhEQwQSV0Au/OfwGVSpVq0aVXItlVJHxheWo2 gvToBILsadkxhgEuPvne2N+mN2ViQFfzlTof1xpAwhUgQ2EkYFx7knsjC+IFycJgZN0/ bUJzOEElzR/S3bTgiXMOIKt5XifhySVKR2iQoLRjHEHGKqr+QRX4J+d2jWvBw8/w0zki 1nf6u4isr9KjXpzBmNyEAMtMbjLg5KsvlWMcFDSzCLnlU81xAubABGVnK73EIlnuqVaG RDOQDNlnboJ2BI0APRJlEqmz/q0miUbW1MpXGcXG3Y0Np+Te7vLs1n4D0ya54nfSYm3J NTig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:mime-version:message-id:date :dkim-signature; bh=cU4DkRhMMObnbg1TBpXu9txqpW0yzEXEW8Tp/xyl+oo=; fh=M03QQq2BGgAHjQvEE5ebB9F7AIwQdsROrtXDdf41UXo=; b=otNOyjxijsWmISYCUcuvxn/JNjYSIar1X8JuPG6XXDIbYXvrUqX0mZXxY+8oyXHN4D GPWG0SJjcpbg8LEbe3uiOev6B6A9VUeyeGOhtrfouDtF9q6En/9C9KNHDuiIqBt4642k obuUyVBtez+TQqz5bNMdkPVSlnjlp3ttr0XhHU5xmkjFqZQtgT+6JQCWsFXMFEUe9TR3 LD4KXjLGZyF6QEFZNCQaxyKf1AWJBOk0a9NDp7n4xaWWuvzLRA3A/kwOsm2XdIjonBE/ ZHfrDMFvzhDBa5wRb9HWNCfL1cdoKDSvP8crJc51K4nii0NWJh6R9I+EC7EywkG6hJrZ noKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bpXV+zYv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id li16-20020a170903295000b001bc02b730f3si20734765plb.242.2023.09.30.03.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 03:21:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bpXV+zYv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 41C51829AA0E; Fri, 29 Sep 2023 23:02:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234021AbjI3GCN (ORCPT + 99 others); Sat, 30 Sep 2023 02:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbjI3GCM (ORCPT ); Sat, 30 Sep 2023 02:02:12 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D43581A7 for ; Fri, 29 Sep 2023 23:02:10 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d85fc108f0eso21303941276.2 for ; Fri, 29 Sep 2023 23:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696053730; x=1696658530; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=cU4DkRhMMObnbg1TBpXu9txqpW0yzEXEW8Tp/xyl+oo=; b=bpXV+zYvE2cxvvl/1gaUgMyixQrwB9VJf9L/hMb/ZCrF3qId+BcBMnPxwHno/uMte0 xln6OCBfwF48UVrNn8kcTQcdnfJb2F+VGcukTjgB6WMsymSwrVg8hgs+JJiPo3N+0LC2 qFys8HXBhqU8d+WMC9aFrLQn5crc2JeG6jbjYo852TLTU+A+JLt7Q79hBpN9Ceg8TPMq 749eJrUWTKAQb4KdsJ6oNE5xK/TkBhDyrndjmTngDInxu18fB+q9l0KxvEqJbu8l/UlH 8o9Y90auqIpqdLUkucz4O0+wMPQcwW/1epwFnV0yb7pksGpGAJ+GOkAa/CIMg1NtFE9E Rn+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696053730; x=1696658530; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cU4DkRhMMObnbg1TBpXu9txqpW0yzEXEW8Tp/xyl+oo=; b=Zf6VpWei6gHrXPeeOK3LDpVdxOU4TRNQ5cYyRgWRX+JanQQeCrRvtfiQogCntPG7vY kdlsQn3fE+1If30fmIEDYodb4P7ScWTG5q6HLbyIvuqY51BgGfAzjE/AJwY5j43swavj +/HOryK3VHGdwkcpMN74d4srwLYf4DjrcCTtsUsLjlRh0ow35n5sazDYosnFfi0ayh56 CuvSJKqcVqs6SSzcA4EB92rOwgy2eeeyMIEFu40pTqafhTWPpR7v123cQLbpxVhJJfdT /7q3QD7FLPVGfVhJHV1AjBS81ilRIyFrpTUtUZx+s7lmedpjmhal5aXpPOvNhfQPHnAR WAGQ== X-Gm-Message-State: AOJu0YyauTC20oLbwOryzpbG4osrQVd9PHxdxZEPzvYMoyegaMg5Qg4U wGriOX0o+EiH+nBmd9IUy4v6Rq6TUZXg X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:fdf7:6873:7ca4:e9e5]) (user=irogers job=sendgmr) by 2002:a25:d0a:0:b0:d35:bf85:5aa0 with SMTP id 10-20020a250d0a000000b00d35bf855aa0mr88172ybn.4.1696053729995; Fri, 29 Sep 2023 23:02:09 -0700 (PDT) Date: Fri, 29 Sep 2023 23:02:06 -0700 Message-Id: <20230930060206.2353141-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.582.g8ccd20d70d-goog Subject: [PATCH v1] perf test: Avoid system wide when not privileged From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 29 Sep 2023 23:02:53 -0700 (PDT) Switch the test program to sleep that makes more sense for system wide events. Only enable system wide when root or not paranoid. This avoids failures under some testing conditions like ARM cloud. Signed-off-by: Ian Rogers --- tools/perf/tests/shell/stat_all_metricgroups.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh index cb35e488809a..f3e305649e2c 100755 --- a/tools/perf/tests/shell/stat_all_metricgroups.sh +++ b/tools/perf/tests/shell/stat_all_metricgroups.sh @@ -4,9 +4,21 @@ set -e -for m in $(perf list --raw-dump metricgroups); do +function ParanoidAndNotRoot() +{ + [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ] +} + +system_wide_flag="-a" +if ParanoidAndNotRoot 0 +then + system_wide_flag="" +fi + +for m in $(perf list --raw-dump metricgroups) +do echo "Testing $m" - perf stat -M "$m" -a true + perf stat -M "$m" $system_wide_flag sleep 0.01 done exit 0 -- 2.42.0.582.g8ccd20d70d-goog