Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1734008rdb; Mon, 2 Oct 2023 21:47:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2G99u3r+f5SkMTS0t/ZQqwx2BdsvfxeLyX0gCxWvze3ohMZGWMbIpExIZkJIFa3Bl6EYT X-Received: by 2002:aca:2208:0:b0:3ae:17af:7387 with SMTP id b8-20020aca2208000000b003ae17af7387mr13556518oic.43.1696308435315; Mon, 02 Oct 2023 21:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696308435; cv=none; d=google.com; s=arc-20160816; b=erVv6zFvTz3/lkd3GGMlhblCznubpqdemMeyRVv7F5et9I9I+xSoIyuuVRxtpkTJZX btZ0sVQ9wgd/XvNY2gSzTriUygVz5671cMXVqg9r99aSgq2YBtz3dTVRj2NU9P54CAjN GacxYB1S5SvOLV55Zvv3usll1hvTdHTxWnjY4r3cGKyhJ9O3GIDtQoIHRkNIcehhu9cn qS+7vL9m3QXHrwlvdUtD1Tix2EnCuKE1lWCuiPHR0p+KLXEhanqs/Cn4WSoKG0aCd98R boEO9p/Bl+F1uSFOUCOAofzAjmQA8hOdVSXNNC2DMQVerhwOU9S54xatMhg5yy7Plwgc /dXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=RQlErh9og4n8bmnaKtFcFBw4sZFPSj5nN6+96pBLgMo=; fh=newNMRy7keZ0y5w0/Wd6Bbu+mKaa9TfuMVeTvbgjwiY=; b=p93ih2dQWDtFmS0yz9EHVdK2TW3Ewu3P6tfZA6b0JWPcuz65sVE/1E3Dtc9P27zXy4 JvxcRtYPONhu7RTKr9ZRf95ArRDAuhyeoODTIcOsOt26J6pJwa4yXRlaxFfpoJQFBc9/ 77GnqRrT4nguolmSfz4oiXWRLu35gtQLTRSbsPjWVQY2aFpSvUHJ1l3NrNNhrbC85v7E NfzDcFZwGkBG8Sk8Dl5PGMDBr/eO8s7yICGK067jg2kYvVI0RlsPKCJZJHCed8VYuY0S IxjOf5JENxYHRfY35cYXljmrAr02c77/OrE/aspTkUTURYAaCR3ExT7081SdKgZIEOwj JoIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id cm14-20020a17090afa0e00b00276c2b21697si8868597pjb.72.2023.10.02.21.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 21:47:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CD1C8822D552; Mon, 2 Oct 2023 21:47:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239107AbjJCErJ convert rfc822-to-8bit (ORCPT + 99 others); Tue, 3 Oct 2023 00:47:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239136AbjJCErH (ORCPT ); Tue, 3 Oct 2023 00:47:07 -0400 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0E9D3; Mon, 2 Oct 2023 21:47:04 -0700 (PDT) Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-27734d76e1bso316273a91.2; Mon, 02 Oct 2023 21:47:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696308424; x=1696913224; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SAqDrWh5okAg7A4rwUqEIqw966pHJE6DnlfG9T172Og=; b=C3kbFTb2LPG45VemVUALv9/iRhcnt4KufMK50bYhhkB1i6IUqCNuaFrb2H3Sa58q19 zvtqIhXSxD1CcGr7uk/4QBIxrNUhlKMQ5sxFcpKweyuhUDFjTbY3d/BKAjtHmw5UeL0k suX/epbIuRzSsv0x3MZgNoJPb1+Iw4fWpZwJXXizha9SASzuvJlehoUPR9MD0Q1/QS7w puaL518lsGJyW2ozwjesaHa/y4EkJqv1mbb0EEuf5I5vHuTke5owYqQbNfpLsM+95yYY KsGGQkygm2FBNdFJs8SXdKhygh0N+WD/aLij3swnbZ9I1fvkaHFs8K4X9aL3qS7eoCTP aR/Q== X-Gm-Message-State: AOJu0YxLUYGHtyIpYMZWcjMR+Dh0v38fjYufNXBZjS8hQT+ny5+9Fuva u8htxVQU+q62JjHaFZ9J+cNqHk2as4mIaw4Sv3A= X-Received: by 2002:a17:90a:6c41:b0:268:15dd:c5c7 with SMTP id x59-20020a17090a6c4100b0026815ddc5c7mr10411882pjj.40.1696308423944; Mon, 02 Oct 2023 21:47:03 -0700 (PDT) MIME-Version: 1.0 References: <20230930060206.2353141-1-irogers@google.com> In-Reply-To: <20230930060206.2353141-1-irogers@google.com> From: Namhyung Kim Date: Mon, 2 Oct 2023 21:46:52 -0700 Message-ID: Subject: Re: [PATCH v1] perf test: Avoid system wide when not privileged To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 21:47:14 -0700 (PDT) Hi Ian, On Fri, Sep 29, 2023 at 11:02 PM Ian Rogers wrote: > > 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 While I'm ok with the change, I wonder why it doesn't have the same code structure as in the stat_all_metrics.sh which checks the actual result. Acked-by: Namhyung Kim Thanks, Namhyung > --- > 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 >