Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1122127rwr; Thu, 27 Apr 2023 12:39:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5t8mZYrQQ35o6Acnxi5tAfPjv7gQFDIh+MKl8Hqp1kR1oif14gONpN03/araws/6S/GGNh X-Received: by 2002:a17:902:f552:b0:1a9:2c70:e1eb with SMTP id h18-20020a170902f55200b001a92c70e1ebmr2599545plf.36.1682624365947; Thu, 27 Apr 2023 12:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682624365; cv=none; d=google.com; s=arc-20160816; b=G0Y5e6OuD8yf/1anyOmGgcBIRSKBj65plsOq+o4yHwKFYLtpISEg81eFE+TTNc8z3F 9Lu+8gaHEz6LFFLFxg/Q/l0CbeYUN4fzlwhdWnZZsf6pDOxnVnOMjSVq19PQmiYWW4w9 Pc87KbYY4DCOkPiC7/Q9faOvq39CZGpWEpUX6sEaaQq9qMOb0PQexIYhshCOf9Ep6HGS g4Sh7MqXsp9L2yyk27lZNz+SI6Lvy2bTL3RAerjb8HC6WNh1B5sewn3EPuMEX1AFewQd D9tmoFUXTnnmPxb9osgi+YqZCwTLzz0aMNUotinSL4uA0WK2K0o6H5YXOV3u+HzkYDKS HrRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=MFpfDKR2Cy8litTa6mYBIr/X0bHLhgXcySe/iMVG/4I=; b=gMl5V9Pf1tEQiW1+PIQaJMJ5T6Ajr+k9dGxwIa8p1HcMHA9rcQR+IZYB6t3vAcurY3 h2xcx88Z4Hou3NQ4R1xNot1Oix5qLjg96ZNHjZXRITkTCM5SQeWDjfrNCq0I/cLwezhQ F7lpjRuYpANwMAfGHn5l6jS9w6sCCtOTztKQmPB4IikGh5bBrfcBh/OExVF/+3EbPxpd jooMOxPiDvsts9bz/Hq0iDpv0NBlX6/X5GBBgGOjdhwbd6Z79r56bNgDBYt/yZ7FVoOJ mnLoqIrpw2BaD68qK/NgVndNXWVrGx2naIdK1HVR591HOiPxOQconO065y1QK077RiZA QWoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TRfaxdLN; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a170902db0500b00194bcc88b52si20921574plx.363.2023.04.27.12.39.10; Thu, 27 Apr 2023 12:39:25 -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=@intel.com header.s=Intel header.b=TRfaxdLN; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343615AbjD0TjH (ORCPT + 99 others); Thu, 27 Apr 2023 15:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244200AbjD0TjF (ORCPT ); Thu, 27 Apr 2023 15:39:05 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64B1E213A; Thu, 27 Apr 2023 12:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682624344; x=1714160344; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=gAZ1EG7SDVbzwqKuwmJG1508A0ja1sgvVPDk5S/JuME=; b=TRfaxdLNvcanfpUmv6a39yyac3kIoLKsWT4vwibl86M5swFDxHcJcWmB tiToxRPqENkWdcEqkAVrXoYcaLe6f9EIbvwDZHP0StOE6uTLXqIdNZT/G zXzDqmliKaKLpzBBuJ1qqqTVbknwj1gDuwc6fot7fCxsn6O0BxIf8ApVg HqyMiQIQhbRsGzcZwGnEO1pZt+i8zYo/4bXNci0IVD5rbIPRGKRBUK99m 2HD/XFT3VlBAtjVnsWY7PMScWZTviTrm/AT2erYIzDUM18mpx5PTXynLV 2ki1ckEgr2HULSeU5L4RW/rW47UImfa5DXO6JyoX3WwZ9eztH7NuVtreM A==; X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="410609764" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="410609764" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 12:39:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="725063041" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="725063041" Received: from linux.intel.com ([10.54.29.200]) by orsmga008.jf.intel.com with ESMTP; 27 Apr 2023 12:39:02 -0700 Received: from [10.209.41.222] (kliang2-mobl1.ccr.corp.intel.com [10.209.41.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id CD829580377; Thu, 27 Apr 2023 12:38:58 -0700 (PDT) Message-ID: <05b7b1cf-0b77-0e0f-8d02-1c26016fa7d8@linux.intel.com> Date: Thu, 27 Apr 2023 15:38:57 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v1 08/40] perf test: Test more sysfs events Content-Language: en-US To: Ian Rogers , Arnaldo Carvalho de Melo , 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 References: <20230426070050.1315519-1-irogers@google.com> <20230426070050.1315519-9-irogers@google.com> From: "Liang, Kan" In-Reply-To: <20230426070050.1315519-9-irogers@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 2023-04-26 3:00 a.m., Ian Rogers wrote: > Parse events for all PMUs, and not just cpu, in test "Parsing of all > PMU events from sysfs". > > Signed-off-by: Ian Rogers Run the test on Cascade Lake and Alder Lake. It looks good. Tested-by: Kan Liang Thanks, Kan > --- > tools/perf/tests/parse-events.c | 103 +++++++++++++++++--------------- > 1 file changed, 55 insertions(+), 48 deletions(-) > > diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c > index 8068cfd89b84..385bbbc4a409 100644 > --- a/tools/perf/tests/parse-events.c > +++ b/tools/perf/tests/parse-events.c > @@ -7,6 +7,7 @@ > #include "debug.h" > #include "pmu.h" > #include "pmu-hybrid.h" > +#include "pmus.h" > #include > #include > #include "fncache.h" > @@ -2225,49 +2226,24 @@ static int test_pmu(void) > > static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest __maybe_unused) > { > - struct stat st; > - char path[PATH_MAX]; > - struct dirent *ent; > - DIR *dir; > - int ret; > - > - if (!test_pmu()) > - return TEST_SKIP; > - > - snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/events/", > - sysfs__mountpoint()); > - > - ret = stat(path, &st); > - if (ret) { > - pr_debug("omitting PMU cpu events tests: %s\n", path); > - return TEST_OK; > - } > + struct perf_pmu *pmu; > + int ret = TEST_OK; > > - dir = opendir(path); > - if (!dir) { > - pr_debug("can't open pmu event dir: %s\n", path); > - return TEST_FAIL; > - } > + perf_pmus__for_each_pmu(pmu) { > + struct stat st; > + char path[PATH_MAX]; > + struct dirent *ent; > + DIR *dir; > + int err; > > - ret = TEST_OK; > - while ((ent = readdir(dir))) { > - struct evlist_test e = { .name = NULL, }; > - char name[2 * NAME_MAX + 1 + 12 + 3]; > - int test_ret; > + snprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/events/", > + sysfs__mountpoint(), pmu->name); > > - /* Names containing . are special and cannot be used directly */ > - if (strchr(ent->d_name, '.')) > + err = stat(path, &st); > + if (err) { > + pr_debug("skipping PMU %s events tests: %s\n", pmu->name, path); > + ret = combine_test_results(ret, TEST_SKIP); > continue; > - > - snprintf(name, sizeof(name), "cpu/event=%s/u", ent->d_name); > - > - e.name = name; > - e.check = test__checkevent_pmu_events; > - > - test_ret = test_event(&e); > - if (test_ret != TEST_OK) { > - pr_debug("Test PMU event failed for '%s'", name); > - ret = combine_test_results(ret, test_ret); > } > /* > * Names containing '-' are recognized as prefixes and suffixes > @@ -2282,17 +2258,48 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest > if (strchr(ent->d_name, '-')) > continue; > > - snprintf(name, sizeof(name), "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name); > - e.name = name; > - e.check = test__checkevent_pmu_events_mix; > - test_ret = test_event(&e); > - if (test_ret != TEST_OK) { > - pr_debug("Test PMU event failed for '%s'", name); > - ret = combine_test_results(ret, test_ret); > + dir = opendir(path); > + if (!dir) { > + pr_debug("can't open pmu event dir: %s\n", path); > + ret = combine_test_results(ret, TEST_SKIP); > + continue; > } > - } > > - closedir(dir); > + while ((ent = readdir(dir))) { > + struct evlist_test e = { .name = NULL, }; > + char name[2 * NAME_MAX + 1 + 12 + 3]; > + int test_ret; > + > + /* Names containing . are special and cannot be used directly */ > + if (strchr(ent->d_name, '.')) > + continue; > + > + snprintf(name, sizeof(name), "%s/event=%s/u", pmu->name, ent->d_name); > + > + e.name = name; > + e.check = test__checkevent_pmu_events; > + > + test_ret = test_event(&e); > + if (test_ret != TEST_OK) { > + pr_debug("Test PMU event failed for '%s'", name); > + ret = combine_test_results(ret, test_ret); > + } > + > + if (!is_pmu_core(pmu->name)) > + continue; > + > + snprintf(name, sizeof(name), "%s:u,%s/event=%s/u", ent->d_name, pmu->name, ent->d_name); > + e.name = name; > + e.check = test__checkevent_pmu_events_mix; > + test_ret = test_event(&e); > + if (test_ret != TEST_OK) { > + pr_debug("Test PMU event failed for '%s'", name); > + ret = combine_test_results(ret, test_ret); > + } > + } > + > + closedir(dir); > + } > return ret; > } >