From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50BCEC77B73 for ; Sat, 27 May 2023 07:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i075boAiSRxCPFcQ6LceZxpUw1nAhL/EimvpKm+0cxw=; b=jOveqX/z3t+CMC SccLeKUknZ68djFH1cGlnLLuxRbTYSii5SWdumLWfP30SvLP2s+z0IxCRw3cllJKx+Er0YjtAZ8AN nxbtOVDQXvN74TgjSTzvPEHBHcqhtqxDxRXiVMxEYyK1c1mBD8XzCMIy7uzPVNuYVnHMM3f8dl3Xq L5VBnaNN2casqHq8jzGy7SgymabTTstxOZ3GnQMTX1Zm6xcwRTdm9jAswF6L55K06SjJ8OJbaCCRE 2/LhGZyfVCip7N8DzeXiKn8Ej6OTTC3UfgBfEku7Uc1z1CVdvHXUL7b9W/UF3nZyiAKRDDymg+7DO p0DVaCklmpRk9ywjjz7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2oXq-0059iJ-1Z; Sat, 27 May 2023 07:40:58 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2oXF-0059UX-2K for linux-arm-kernel@bombadil.infradead.org; Sat, 27 May 2023 07:40:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=nSaQksCEVnEDaXN3VKZfEAQXs7LM72JmREmXfmsPZ08=; b=bMeNvrsq8ECEx4Ncp/+tta22wq hif9lFem59Lztny8Fx/gB5S+iSji3GDnCxBafKLV85rm1DvRJpbUDkWdn2GpRjcTRlvMQQE+hKA0Q yDdvv286zYF9luNNdjUAk113rznCJ1nFBUhCofgIRoahIu8mDUd5192f21tVtprBe/lZ1g4QHgBIH 4kW+pZAzlT9AJi+TwFmDdjNyizzpdES5OXZtGt109E8JOA4DVBU/Hd8Kp53pnUSCI9Igr7rf//CmP i2Vx86U0eVPoYZzaEM3FtEuW+00dFa0lfuHUkR3QD5S6o+R/4+NiwwN/o3EbnN3cAVltm5mk5QRX0 pHvt2XQw==; Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2oGi-009Lje-2E for linux-arm-kernel@lists.infradead.org; Sat, 27 May 2023 07:24:15 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-babb7aaa605so3278601276.3 for ; Sat, 27 May 2023 00:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685172193; x=1687764193; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=nSaQksCEVnEDaXN3VKZfEAQXs7LM72JmREmXfmsPZ08=; b=aTychtkFPXXXaZtgAy5O0ZzWjhhqV7bEL51lpZOXoOBxqvfIhGcaSHMGbFqwP9Ngc+ wqO+JRuarryPdG2qBv/YGZpVmvM5QlnwNYTn1xI9rb9ZocBFIVeDffh2hHj843C1geFa fuX/nAt4TIaGNkoKYt5YAphA44UxHtKQ6SA68hDF47Y1iThkFrm5t9fKGsbjGpkg2h6t rlc43ycR0O/hsxlY6k241jw+kkv8ppTTJh064nj4OjURPabOd//Sr4+YmNyxWeYEBUdM YfRFKny2wYLIv68cvjjL7Sb+UPdCgulsOGfKDDVbwv6OMcl7RorRTKUIpJmXn49jhGjL jm2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685172193; x=1687764193; h=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=nSaQksCEVnEDaXN3VKZfEAQXs7LM72JmREmXfmsPZ08=; b=bFom3k5CTMPDm3gSAllgPKd5+OPqs0qPc8Wo9Em9t025fbFElBXe0r1hz+GQu5wMsy i5ME3DhSSoA1qUQZ55MAE9hy3e7Gt8u+QR/hoYTRTpFlApzdeh0ja3a5D+MagKp82c4r 9nIt4xAOdl2ClBM6G/MJtDyrx/XflNwgpdb3zgkbZKD63IaioXzDcNueNXQaKVY1UrFI k50ZDhhQVYFC0HooPpkVR/nqjPW+pbrSclai1kovgh6+9IyP9FrHrLTMMpwV1Co4jsMf kkDdvL7vLgOOPz2h90knOz5oWWJN6j4i8NHG/q0l/unbcOqupj2L5+IHp0xbK49jMFgj fzug== X-Gm-Message-State: AC+VfDxutppvxaO4Z+0JAtx6ySA4/fjTEe3jjX5p5Ww9Bi//Yvs9wOZ0 qmOHrjb/H2Dr6mZaG7MYke48jSDtLJXT X-Google-Smtp-Source: ACHHUZ6Q8KFmnDXQQJwiBVojBYy3Z6GVSok1hJcxoePeiSvGkW/9JF2ZeO9TL4CovC7wLLfgtlWzmz1qHCkW X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:3b4e:312c:644:a642]) (user=irogers job=sendgmr) by 2002:a25:4582:0:b0:ba8:91c2:268a with SMTP id s124-20020a254582000000b00ba891c2268amr2372187yba.0.1685172193104; Sat, 27 May 2023 00:23:13 -0700 (PDT) Date: Sat, 27 May 2023 00:21:53 -0700 In-Reply-To: <20230527072210.2900565-1-irogers@google.com> Message-Id: <20230527072210.2900565-18-irogers@google.com> Mime-Version: 1.0 References: <20230527072210.2900565-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Subject: [PATCH v5 17/34] perf x86: Iterate hybrid PMUs as core PMUs From: Ian Rogers To: Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Kajol Jain , Jing Zhang , Kan Liang , Zhengjun Xing , Ravi Bangoria , Madhavan Srinivasan , Athira Rajeev , Ming Wang , Huacai Chen , Sandipan Das , Dmitrii Dolgov <9erthalion6@gmail.com>, Sean Christopherson , Ali Saidi , Rob Herring , Thomas Richter , Kang Minchul , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230527_082406_580980_D824A75E X-CRM114-Status: GOOD ( 18.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Rather than iterating over a separate hybrid list, iterate all PMUs with the hybrid ones having is_core as true. Signed-off-by: Ian Rogers Reviewed-by: Kan Liang --- tools/perf/arch/x86/tests/hybrid.c | 2 +- tools/perf/arch/x86/util/evlist.c | 25 +++++++++++++++++-------- tools/perf/arch/x86/util/perf_regs.c | 14 ++++++++++---- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/tools/perf/arch/x86/tests/hybrid.c b/tools/perf/arch/x86/tests/hybrid.c index 941a9edfed4e..944bd1b4bab6 100644 --- a/tools/perf/arch/x86/tests/hybrid.c +++ b/tools/perf/arch/x86/tests/hybrid.c @@ -3,7 +3,7 @@ #include "debug.h" #include "evlist.h" #include "evsel.h" -#include "pmu-hybrid.h" +#include "pmu.h" #include "tests/tests.h" static bool test_config(const struct evsel *evsel, __u64 expected_config) diff --git a/tools/perf/arch/x86/util/evlist.c b/tools/perf/arch/x86/util/evlist.c index 1b6065841fb0..03f7eb4cf0a4 100644 --- a/tools/perf/arch/x86/util/evlist.c +++ b/tools/perf/arch/x86/util/evlist.c @@ -4,7 +4,6 @@ #include "util/evlist.h" #include "util/parse-events.h" #include "util/event.h" -#include "util/pmu-hybrid.h" #include "topdown.h" #include "evsel.h" @@ -12,9 +11,6 @@ static int ___evlist__add_default_attrs(struct evlist *evlist, struct perf_event_attr *attrs, size_t nr_attrs) { - struct perf_cpu_map *cpus; - struct evsel *evsel, *n; - struct perf_pmu *pmu; LIST_HEAD(head); size_t i = 0; @@ -25,15 +21,24 @@ static int ___evlist__add_default_attrs(struct evlist *evlist, return evlist__add_attrs(evlist, attrs, nr_attrs); for (i = 0; i < nr_attrs; i++) { + struct perf_pmu *pmu = NULL; + if (attrs[i].type == PERF_TYPE_SOFTWARE) { - evsel = evsel__new(attrs + i); + struct evsel *evsel = evsel__new(attrs + i); + if (evsel == NULL) goto out_delete_partial_list; list_add_tail(&evsel->core.node, &head); continue; } - perf_pmu__for_each_hybrid_pmu(pmu) { + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + struct perf_cpu_map *cpus; + struct evsel *evsel; + + if (!pmu->is_core) + continue; + evsel = evsel__new(attrs + i); if (evsel == NULL) goto out_delete_partial_list; @@ -51,8 +56,12 @@ static int ___evlist__add_default_attrs(struct evlist *evlist, return 0; out_delete_partial_list: - __evlist__for_each_entry_safe(&head, n, evsel) - evsel__delete(evsel); + { + struct evsel *evsel, *n; + + __evlist__for_each_entry_safe(&head, n, evsel) + evsel__delete(evsel); + } return -1; } diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c index 0ed177991ad0..26abc159fc0e 100644 --- a/tools/perf/arch/x86/util/perf_regs.c +++ b/tools/perf/arch/x86/util/perf_regs.c @@ -10,7 +10,6 @@ #include "../../../util/debug.h" #include "../../../util/event.h" #include "../../../util/pmu.h" -#include "../../../util/pmu-hybrid.h" const struct sample_reg sample_reg_masks[] = { SMPL_REG(AX, PERF_REG_X86_AX), @@ -286,7 +285,6 @@ uint64_t arch__intr_reg_mask(void) .disabled = 1, .exclude_kernel = 1, }; - struct perf_pmu *pmu; int fd; /* * In an unnamed union, init it here to build on older gcc versions @@ -294,12 +292,20 @@ uint64_t arch__intr_reg_mask(void) attr.sample_period = 1; if (perf_pmu__has_hybrid()) { + struct perf_pmu *pmu = NULL; + __u64 type = PERF_TYPE_RAW; + /* * The same register set is supported among different hybrid PMUs. * Only check the first available one. */ - pmu = list_first_entry(&perf_pmu__hybrid_pmus, typeof(*pmu), hybrid_list); - attr.config |= (__u64)pmu->type << PERF_PMU_TYPE_SHIFT; + while ((pmu = perf_pmu__scan(pmu)) != NULL) { + if (pmu->is_core) { + type = pmu->type; + break; + } + } + attr.config |= type << PERF_PMU_TYPE_SHIFT; } event_attr_init(&attr); -- 2.41.0.rc0.172.g3f132b7071-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel