From patchwork Mon Nov 14 21:07:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 20033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2367754wru; Mon, 14 Nov 2022 13:12:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4pshlzL3rtYo6J0P3uOm7Z6kqqxWoW3nmETDhiWLd7nTdzKTJ8dvJp0v8cYZO4mXGh7th4 X-Received: by 2002:a17:906:ae53:b0:78b:15dc:2355 with SMTP id lf19-20020a170906ae5300b0078b15dc2355mr11524760ejb.306.1668460374462; Mon, 14 Nov 2022 13:12:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668460374; cv=none; d=google.com; s=arc-20160816; b=wZ8GmfWkOrJqxVcMYkaMevOgtPpAvbW2aJAilg0TZrw5S9KZdTY/BZqIU7yaP3hNk4 rWpIcAFrja3p6BESW0mw3dJSms3lErHQj7rQZXIXJwr71WNGZfVhQukDNzo03PAhpxXE UajZul4ZDu0vWZvGTqtkle8x01glNK6LQ4gfiHsjjmeP2Xyet0OBg+/y8E/nzx80/FvE sNx5WS9gOdpoMMcCleKN/hVsbk8HoqvGc1lhgAGTSe0Bn4+dKL/z5cQsrpduWApBuZzu oIL4rMCzo7Ut1cKnaTnB/gGczwDQHL6Z5LHP4Lk6qVjt3Td3ZG2cYYHMDeU79dwfIgxI pJEg== 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=2OZhfmPm3XVkECYqwzYQM5F2KZdnyo2PlgH8Orm1zuI=; b=oDKND10p7831lYEPEDEk9D9GxYQEbh1I3xb0NNKTK+7imHtbuPMI2UaiFlkHhZ9yx3 9sbBqu03ur3sKRheNU0eYfV5So1naQoJYe/xMWR9kWSEpfrX2bv8O3CDywbrR0wwDnXt XS4NNyYn/5KEwTuMsXhkWrXyupFpYqKQLHrjQgulht/P7oQDvSpAlkKrPwUZD4INkCOT BJnMLaUpLXjJqe3nnAmZADnWYu3pYEBzLfJFD5SvTJg5rgrTq+beL0D1LqcuAn9IvnpU l2FVi3OMbyTDSdGka3o1lATXy1MCsVhsp9MNbnxigha3Jkf/qd319UFppLoA9VG99KuI +nTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d03dpv19; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a50ee08000000b00461b84a010fsi8987073eds.295.2022.11.14.13.12.30; Mon, 14 Nov 2022 13:12:54 -0800 (PST) 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=20210112 header.b=d03dpv19; 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 S237346AbiKNVH6 (ORCPT + 99 others); Mon, 14 Nov 2022 16:07:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237361AbiKNVHz (ORCPT ); Mon, 14 Nov 2022 16:07:55 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB6E095A3 for ; Mon, 14 Nov 2022 13:07:48 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-360b9418f64so114894457b3.7 for ; Mon, 14 Nov 2022 13:07:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2OZhfmPm3XVkECYqwzYQM5F2KZdnyo2PlgH8Orm1zuI=; b=d03dpv19fKYHRy/o0sTKt3d1Ucz5gD7WCqPFOeFJ2EEnrgHjP1F7o+EV5XjAH7uKXx QlhalH9ep4BgRvy+zz8yAUsQpMYQICs3LDhHwH+q5UgWdAFRboeOgd3gMH2tYFWsbrir cG4OYvkuz0+LBYsnJca4j/6wqAc5/FoKYNwrRbFeCYbtO2extKFVChEEuuP97gu1F4fI YlTRuFCf+JNRttBeHgxKWCxX3NgIWs+sZqDWiZOUtj4kn2NerPrZJua9Y6GmjZVdtqBG N6lPgMczC485QLYAXnM1iuRs4lqjm3b/CbiA6x/obus990if35GiEg2TDCzz9DfLnPBR gVvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=2OZhfmPm3XVkECYqwzYQM5F2KZdnyo2PlgH8Orm1zuI=; b=YW0WSUaOi8HjHOKCxvtc3FPwe+oWIT3+rLwdcA6VlCOD0oyqMm/5sSJy4HNgkc3JFa v6pyFO5RhZCKv57tkn/WGXsaWz/vj29UUZ6znKBYPuaV4qOL9kaPG0rnhw3svowynLlm IQ0tJoLS6Dr6K5kGBGVJ+DYCrjWndG2ZLIwdGVnSAwT+Q+C0Q2PjyPQnFzVamPDi/v4l gZ9hbKt4VL2M+Skc6ZmvXKKuF4leUvWodGJNCqzEho8mZpPTOVgzNoDmHUk++N8yvgtM 9ZoJSM7BK+oOPBxSbjJslPo3qO9a3r97nCMtoqCU5Gphh15vOq4uF9HeCPfq390x4Xbt 0T1g== X-Gm-Message-State: ANoB5pnFdhc449GoM2X5C0XMj4o6jNPVw3HoqYNvV85zPXPHH90/C7FI CL/Ctr2jNsqQOmf6EgWZqFpBi7f2RN+5 X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:553:438f:b86a:87f]) (user=irogers job=sendgmr) by 2002:a81:78ca:0:b0:381:22a0:d706 with SMTP id t193-20020a8178ca000000b0038122a0d706mr6329985ywc.440.1668460067934; Mon, 14 Nov 2022 13:07:47 -0800 (PST) Date: Mon, 14 Nov 2022 13:07:14 -0800 In-Reply-To: <20221114210723.2749751-1-irogers@google.com> Message-Id: <20221114210723.2749751-2-irogers@google.com> Mime-Version: 1.0 References: <20221114210723.2749751-1-irogers@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH v3 01/10] perf pmu: Remove is_hybrid member From: Ian Rogers To: Weilin Wang , Perry Taylor , Caleb Biggers , Leo Yan , Adrian Hunter , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Sandipan Das , Kajol Jain , Zhengjun Xing , Kan Liang , Ravi Bangoria , Xin Gao , Rob Herring , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Stephane Eranian , Ian Rogers 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,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749507505666299051?= X-GMAIL-MSGID: =?utf-8?q?1749507505666299051?= Replace usage with perf_pmu__is_hybrid. Suggested-by: Kan Liang Signed-off-by: Ian Rogers --- tools/perf/util/evsel.c | 5 +---- tools/perf/util/evsel.h | 2 +- tools/perf/util/pmu.c | 3 +-- tools/perf/util/pmu.h | 1 - tools/perf/util/stat.c | 11 +++-------- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index cdde5b5f8ad2..ca6abb64c91d 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -3124,11 +3124,8 @@ void evsel__zero_per_pkg(struct evsel *evsel) } } -bool evsel__is_hybrid(struct evsel *evsel) +bool evsel__is_hybrid(const struct evsel *evsel) { - if (evsel->pmu) - return evsel->pmu->is_hybrid; - return evsel->pmu_name && perf_pmu__is_hybrid(evsel->pmu_name); } diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 989865e16aad..467bb0b32fef 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -498,7 +498,7 @@ struct perf_env *evsel__env(struct evsel *evsel); int evsel__store_ids(struct evsel *evsel, struct evlist *evlist); void evsel__zero_per_pkg(struct evsel *evsel); -bool evsel__is_hybrid(struct evsel *evsel); +bool evsel__is_hybrid(const struct evsel *evsel); struct evsel *evsel__leader(struct evsel *evsel); bool evsel__has_leader(struct evsel *evsel, struct evsel *leader); bool evsel__is_leader(struct evsel *evsel); diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 6a86e6af0903..48e7be6f3baa 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -980,7 +980,6 @@ static struct perf_pmu *pmu_lookup(const char *lookup_name) pmu->is_uncore = pmu_is_uncore(name); if (pmu->is_uncore) pmu->id = pmu_id(name); - pmu->is_hybrid = is_hybrid; pmu->max_precise = pmu_max_precise(name); pmu_add_cpu_aliases(&aliases, pmu); pmu_add_sys_aliases(&aliases, pmu); @@ -992,7 +991,7 @@ static struct perf_pmu *pmu_lookup(const char *lookup_name) list_splice(&aliases, &pmu->aliases); list_add_tail(&pmu->list, &pmus); - if (pmu->is_hybrid) + if (is_hybrid) list_add_tail(&pmu->hybrid_list, &perf_pmu__hybrid_pmus); pmu->default_config = perf_pmu__get_default_config(pmu); diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 68e15c38ae71..0d556d02ce52 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -40,7 +40,6 @@ struct perf_pmu { __u32 type; bool selectable; bool is_uncore; - bool is_hybrid; bool auxtrace; int max_precise; struct perf_event_attr *default_config; diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 3a432a949d46..acf0edf5fdd1 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -604,15 +604,10 @@ static void evsel__merge_aliases(struct evsel *evsel) } } -static bool evsel__should_merge_hybrid(struct evsel *evsel, struct perf_stat_config *config) +static bool evsel__should_merge_hybrid(const struct evsel *evsel, + const struct perf_stat_config *config) { - struct perf_pmu *pmu; - - if (!config->hybrid_merge) - return false; - - pmu = evsel__find_pmu(evsel); - return pmu && pmu->is_hybrid; + return config->hybrid_merge && evsel__is_hybrid(evsel); } static void evsel__merge_stats(struct evsel *evsel, struct perf_stat_config *config)