Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp374308rwr; Wed, 26 Apr 2023 00:04:31 -0700 (PDT) X-Google-Smtp-Source: AKy350aboQ0Rx+deRVHE1ure/ahTZZUQS4t9r6FG8+Yz9nh0xYWv5g95Yij9Ylf/7tZ3T4E3Q1uw X-Received: by 2002:a17:90b:3507:b0:247:eae:1783 with SMTP id ls7-20020a17090b350700b002470eae1783mr19138010pjb.45.1682492671536; Wed, 26 Apr 2023 00:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682492671; cv=none; d=google.com; s=arc-20160816; b=pxuBSD26ZDmzPn23G07mFzxoh8Zzmy5CTSRDmeuZOcONXfZp3pyiR8YA+ViFJgUXH/ QDnJEP6Y2WFqjGXkRgoObHKOkea7cOwHXqG7u3khzQY1w/1wV8MTPMHgAZXukDflKGyH /ItNqn3daybcToZxatxkjWZcNCr0OHNRTBsgqFi4eyO+k4O6FMtj7ZsFIyOC3P/rMcz/ UrPwJelP1YsAX17nX+dClCQkum+lNlMTSSD6PmoDwAF0Cqn0utcbfOZRaVJ3UlRgLUtJ 9BCwysyxbWawBjZMlg7eNsGSEl69VOCauQKdkr6nxyqR+shMEqNWAf51MTweepw1qI5E ADrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=/EqV6ROsM4xqPMDxDdZxTjIhMdyygru22Sq7RFV4HJk=; b=mdAaMtLZCTwKpr2Dtg94+jmZFmGrW9rOk5a/Tq6WMZsPrJS8aO5Y969quglDc3nmOr 1oddvYf6Kz73cvh+t2sp2kY+8X/R0DqZGD1TedTboaQ8JW/1WGZ7W9Bb+Qbg0g30Nkmp 3lKsbVSKt8O0dh5PQLFGKlIGcjpKFoxK055tQTzSGZfYsG/LF6juoXgKInmWc5yjyrE0 xvXFoRM6V4g0ILNvQMm9zYgHoMzHTICNttlVDSZ7ohV9we5MLxGCq8sdE3hxEq5nfx2v ODBBavouQNr5Rf3ff5y+gdWufk3kn7M7TglzSqGBAtep+rT2BaSp/yDlPO37crwJ7XwP 91Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=a1rQK22S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lp4-20020a17090b4a8400b0024b342f5239si18090996pjb.95.2023.04.26.00.04.15; Wed, 26 Apr 2023 00:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=a1rQK22S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239813AbjDZHDk (ORCPT + 99 others); Wed, 26 Apr 2023 03:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239757AbjDZHC5 (ORCPT ); Wed, 26 Apr 2023 03:02:57 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5552449A for ; Wed, 26 Apr 2023 00:02:15 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-555bffbd109so101570657b3.1 for ; Wed, 26 Apr 2023 00:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682492534; x=1685084534; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=/EqV6ROsM4xqPMDxDdZxTjIhMdyygru22Sq7RFV4HJk=; b=a1rQK22SCV68D5GRHhokTQZEsHOGEwQf0pAUVz9tVBZVzw4H4i9keDpVMX/gGYqHey g7VBfmFfr2FAH2eXPshJTgylzg3CSqdOwHXmPY42QbzIiMi4eHNvwlUILbpt/TbFGqWj pU/3gO96SvDr5CONL4ccQVZ4G2B0GaDa4YZMsIe152cE6Ec9oQqUv7sx5ZHB8lUwKWPy E8EpY0PDwTH7MwAhZSZvuF7T3dzNSDFZMW1tqjXieH06BbJHO2bok5V15URMr5KH+ffN 9T3/13G0cv6BSuyN0sNzlXXFj1VZxlDrffNu8Q2vn7s8RyhNCdeaz97N81PiR+lUu8+g IIaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682492534; x=1685084534; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/EqV6ROsM4xqPMDxDdZxTjIhMdyygru22Sq7RFV4HJk=; b=EPlKxoranUZwSyzVOv+VS/g45dBK4U40vV0kaj5IlcCONzzhILGwEdeXhSgyCVDE7Z ff53cNMIes/pIefzQhK/oo8Obs1g4wdS2wk2UWCvJ0af0R3kCNK6AVLQfRV0YSEatpvX 0Uxwov1+etLIdu/MMGaGKBPJ0tQEwDZuZPi4kT1Ph/Ph322tPrzW4bLnqSsVRJgQDIRz nv91kGKbNGNzoFroQP1HVMmndbv0BWKo+F8+NWpaMH0/tBAS5jiHEeqTh/wUeiZzTWn1 InBauOO2xrKv3vW5PomwGrNcWVWyp0pkMapP8CbmL4vjoWnv/fOclzxaug4lT/Tn4Du1 gVIg== X-Gm-Message-State: AAQBX9fSkWmEp5cI0BcO6MSUWYmg4HvKdU/TTafE8KXgYH8fYrdwaTp4 ccyNjKTaBNIBhqNUat2h1FnAkI2haUFv X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:144f:e890:2b29:48d9]) (user=irogers job=sendgmr) by 2002:a81:aa4b:0:b0:54f:b95f:8999 with SMTP id z11-20020a81aa4b000000b0054fb95f8999mr9088991ywk.6.1682492534461; Wed, 26 Apr 2023 00:02:14 -0700 (PDT) Date: Wed, 26 Apr 2023 00:00:19 -0700 In-Reply-To: <20230426070050.1315519-1-irogers@google.com> Message-Id: <20230426070050.1315519-10-irogers@google.com> Mime-Version: 1.0 References: <20230426070050.1315519-1-irogers@google.com> X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Subject: [PATCH v1 09/40] perf test: Use valid for PMU tests From: Ian Rogers To: Arnaldo Carvalho de Melo , Kan Liang , Ahmad Yasin , Peter Zijlstra , Ingo Molnar , Stephane Eranian , Andi Kleen , Perry Taylor , Samantha Alt , Caleb Biggers , Weilin Wang , Edward Baker , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Florian Fischer , Rob Herring , Zhengjun Xing , John Garry , Kajol Jain , Sumanth Korikkar , Thomas Richter , Tiezhu Yang , Ravi Bangoria , Leo Yan , Yang Jihong , James Clark , Suzuki Poulouse , Kang Minchul , Athira Rajeev , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ian Rogers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham 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 Rather than skip all tests in test__events_pmu if PMU cpu isn't present, use the per-test valid test. This allows the running of software PMU tests on hybrid and arm systems. Signed-off-by: Ian Rogers --- tools/perf/tests/parse-events.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 385bbbc4a409..08d6b8a3015d 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -1430,6 +1430,11 @@ static int test__checkevent_config_cache(struct evlist *evlist) return TEST_OK; } +static bool test__pmu_cpu_valid(void) +{ + return !!perf_pmu__find("cpu"); +} + static bool test__intel_pt_valid(void) { return !!perf_pmu__find("intel_pt"); @@ -1979,21 +1984,25 @@ static const struct evlist_test test__events[] = { static const struct evlist_test test__events_pmu[] = { { .name = "cpu/config=10,config1,config2=3,period=1000/u", + .valid = test__pmu_cpu_valid, .check = test__checkevent_pmu, /* 0 */ }, { .name = "cpu/config=1,name=krava/u,cpu/config=2/u", + .valid = test__pmu_cpu_valid, .check = test__checkevent_pmu_name, /* 1 */ }, { .name = "cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/", + .valid = test__pmu_cpu_valid, .check = test__checkevent_pmu_partial_time_callgraph, /* 2 */ }, { .name = "cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2/ukp", + .valid = test__pmu_cpu_valid, .check = test__checkevent_complex_name, /* 3 */ }, @@ -2209,21 +2218,6 @@ static int test__terms2(struct test_suite *test __maybe_unused, int subtest __ma return test_terms(test__terms, ARRAY_SIZE(test__terms)); } -static int test_pmu(void) -{ - struct stat st; - char path[PATH_MAX]; - int ret; - - snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/format/", - sysfs__mountpoint()); - - ret = stat(path, &st); - if (ret) - pr_debug("omitting PMU cpu tests\n"); - return !ret; -} - static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest __maybe_unused) { struct perf_pmu *pmu; @@ -2305,9 +2299,6 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest static int test__pmu_events2(struct test_suite *test __maybe_unused, int subtest __maybe_unused) { - if (!test_pmu()) - return TEST_SKIP; - return test_events(test__events_pmu, ARRAY_SIZE(test__events_pmu)); } -- 2.40.1.495.gc816e09b53d-goog