Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp379152rwr; Wed, 26 Apr 2023 00:09:01 -0700 (PDT) X-Google-Smtp-Source: AKy350bExk+n6dwZCkLhkuqSKsQBHzVuc/4sJTnZ7GHdlrlSD0uOAK7TvEBWvaYsRvym1Q2jNhvT X-Received: by 2002:a05:6a00:23d1:b0:63e:fb6d:a1c0 with SMTP id g17-20020a056a0023d100b0063efb6da1c0mr11114006pfc.33.1682492941191; Wed, 26 Apr 2023 00:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682492941; cv=none; d=google.com; s=arc-20160816; b=TEH4QENMyYt1uGaAqhNQ+2sPI+tw3M/ErVJhNnIwm35vez+Rk1ERMV1K6BfPg/urXS y/E4F/87ajP69m4TXu+AzVHi8EQozLTD133cu+VbJ5R1pdmzG0P8z9gjx88qHV2I3z9v j6JoyXgoJnZiRWoBYVdsa7nsBEUPDtcEeY6MIVj7dgMXD6O9lHmcF5FXfhQY7UtUETc4 cWKlf4j9SlYlFERnUJA+TGWTX32HaErUZ82DHQS2EiKRMybMFRNXiCVf0cCTLrU7Iu2R jSkOo5jkkUY4Gx1GmQHEJH/X0Rvesddy3EITi5ruxwzmAHJ/3gswCSnCBuNaciLCiqfE Tq4Q== 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=jCecFHyWQNvHuSdHOLhofsJDyWJSs+06+TmI+QyaYN0=; b=yS4yrx1YdkVieGaH9/ni+zyIPSrJT/pMFFudqUP6Wh7knNs3QuGtSxrcHJx+vfnHi4 YKRjvzvXIHjxgk156/xujB9avHnUNC7g4eCoZutmlxetq/KQOOkcKJ1StjZqvSALx6ap bQbZksH4fasoxTtE/J6RbLGqY7Tjk2MfRdKE+4B59qko0KQ31WaNLWWXdZ1Ue4dowMXG nIeaqXSS9jp2nx4ixrH+Yr14zg9PG4cwUwYWx8abi9o21KzNzoOCDN4xF63dEAPuDb5i ixjlO1MG2O1oT6GzhzApLIY8rSimCV5T3OIWBhoZbwO2MrxwvDbhChQEHuoXpaU/uG17 KwKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=gVSbPwm9; 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 e16-20020aa798d0000000b0063b84b5b53asi15105451pfm.9.2023.04.26.00.08.47; Wed, 26 Apr 2023 00:09:01 -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=gVSbPwm9; 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 S239831AbjDZHFY (ORCPT + 99 others); Wed, 26 Apr 2023 03:05:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239870AbjDZHEy (ORCPT ); Wed, 26 Apr 2023 03:04:54 -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 B3228469D for ; Wed, 26 Apr 2023 00:03:44 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-54f87c0a000so115013097b3.3 for ; Wed, 26 Apr 2023 00:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682492613; x=1685084613; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=jCecFHyWQNvHuSdHOLhofsJDyWJSs+06+TmI+QyaYN0=; b=gVSbPwm9D++gi16FNhrLrEpbJ4BaXZJo0eStxrpKxGYv1ewUpb7O1ryFcx0Bdpnwtn w3FTA7rf4nK5usLkFfxLN5rpzeT5NhrPB1RwBe8oEjT9foVHO9xl41XuYTFc3ekU9Erg Gx5BjF/recceXW4EOrgjT25VFMF3N1vtfwnQsRYoVifEhhnjjxnwZUHmaJMR5fdUIdbV 9OdZyzC9CPhA62OyTeIIpLSH4H+btZ/thE7SbMXJm6kp1Tw3deTgGFRxtIoE+k0Fj6Lz KQ2bTe/NAkHJIaCmmyBY7+kXLx6D/yRpLsn4LE2oiw2eBYmKv4JrnlDxIt5McOuBTkjd ovuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682492613; x=1685084613; 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=jCecFHyWQNvHuSdHOLhofsJDyWJSs+06+TmI+QyaYN0=; b=GLf2sJ9G8JOAgixcxJSJzArt5Ksa9W5zcAl/1DUpU+AiadqKCrNySDwNldzQOrvTIn 4I4N9BYZsRHp8/GXwqLLUxqmKjm65241GImIkJeEaqoHBONuM0DSjLs8mOLRxnzERqBt IYPqtHWmOseLIY6HHrQ5ibHKysu2mqM4+3zaMt9vBj0x3DF08aHhM1kIQ8IjmUNCyN0h bEs0g4/CeC0mpho30qKLJ0sX/tvjCptTGxowRgsIIi1DJQdBgmlbtK6zizeYIRsfbWVe 6WZu+9dWIgfX5dd7xV9Ympq3dhCEZdkTwulVD4dCoFkrul95I14ZJ3DlZqgszqCGEmOY G7eg== X-Gm-Message-State: AAQBX9cKC012t43Zo2SWrpsYSs3HkoBtXcQeicknHxhdEzwj4wfmbYL3 sJMZanP6T92wsnzCdFK9QgvrDwR0J+P0 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:144f:e890:2b29:48d9]) (user=irogers job=sendgmr) by 2002:a81:b725:0:b0:555:f33e:e346 with SMTP id v37-20020a81b725000000b00555f33ee346mr10340975ywh.6.1682492613034; Wed, 26 Apr 2023 00:03:33 -0700 (PDT) Date: Wed, 26 Apr 2023 00:00:29 -0700 In-Reply-To: <20230426070050.1315519-1-irogers@google.com> Message-Id: <20230426070050.1315519-20-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 19/40] perf test x86 hybrid: Don't assume evlist order 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=unavailable 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 Switch to a loop rather than depend on evlist order for raw events test. Signed-off-by: Ian Rogers --- tools/perf/arch/x86/tests/hybrid.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/perf/arch/x86/tests/hybrid.c b/tools/perf/arch/x86/tests/hybrid.c index 0f99cfd116ee..66486335652f 100644 --- a/tools/perf/arch/x86/tests/hybrid.c +++ b/tools/perf/arch/x86/tests/hybrid.c @@ -11,6 +11,11 @@ static bool test_config(const struct evsel *evsel, __u64 expected_config) return (evsel->core.attr.config & PERF_HW_EVENT_MASK) == expected_config; } +static bool test_perf_config(const struct perf_evsel *evsel, __u64 expected_config) +{ + return (evsel->attr.config & PERF_HW_EVENT_MASK) == expected_config; +} + static int test__hybrid_hw_event_with_pmu(struct evlist *evlist) { struct evsel *evsel = evlist__first(evlist); @@ -93,22 +98,15 @@ static int test__hybrid_group_modifier1(struct evlist *evlist) static int test__hybrid_raw1(struct evlist *evlist) { - struct evsel *evsel = evlist__first(evlist); + struct perf_evsel *evsel; - if (!perf_pmu__hybrid_mounted("cpu_atom")) { - TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a)); - return TEST_OK; - } + perf_evlist__for_each_evsel(&evlist->core, evsel) { + struct perf_pmu *pmu = perf_pmu__find_by_type(evsel->attr.type); - TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries); - TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a)); - - /* The type of second event is randome value */ - evsel = evsel__next(evsel); - TEST_ASSERT_VAL("wrong config", test_config(evsel, 0x1a)); + TEST_ASSERT_VAL("missing pmu", pmu); + TEST_ASSERT_VAL("unexpected pmu", !strncmp(pmu->name, "cpu_", 4)); + TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, 0x1a)); + } return TEST_OK; } -- 2.40.1.495.gc816e09b53d-goog