Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1164567rwr; Thu, 27 Apr 2023 13:21:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ozF6T/CigH6ENOUV7R3UAbF5cw03UxRH27BX7ZiuBhH9FPfmh6iuOoi7vdruCDSn0Fs/6 X-Received: by 2002:a17:90a:64c9:b0:247:c0bd:b99a with SMTP id i9-20020a17090a64c900b00247c0bdb99amr3020058pjm.31.1682626880612; Thu, 27 Apr 2023 13:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682626880; cv=none; d=google.com; s=arc-20160816; b=XkEg8rsLL1bAi7venytLVhJygJVJ+Op/FmrV49W9iB1ThnUXDgHz6b2/BDEqJNm4oG mTgbESBFyIFhsqDpM3DIZa23LhjsXiqwa+s8sgKf/6/Z8YdDgyQlxtoHo3CKxagKPgnD bbrDVplExZDMfx12+BjplKH6B+j2oAyJTf8pDldAJsLoegcRybUIx0FBS4GqSPigc8ii URl8ppH2g3LtqBIxs6MN9yZWjwkF85cH4R6BaeZFVyk0p0iqlrGHkWiF91W80ERL3D5f jWnbF4HE6Qi+0XR7DRSZCJY0fMNZur14fif2aOlus5Ph6wUeza3ceinLVYuLwDqoMM+E pTeQ== 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=TT/6xyYKOZwIxIAJFQyi3Y/J89+m8cGnbCvKjSAkRbw=; b=d6fCGv890TLfjRyHLsEDRl77XDeVchJEoLcZ3wuC7xooigPqdaPF1o6Wli5o4l7ffJ D+Stfev4IGuZUE6WaKVmCl9zldRprasMXntYNZ6cj3v6696RRW+kfi4/l9TsF8aRxHFt PQtY8GPfVfdAbCxtWZL+rpi+SEEDyx36vCi5qxYSU9YHCaTHWumOY892Z2vgw24OGW2h emDUn6rq3HDEizLP6Bb1e+oh/40TJ8vOQ1E9bmE7kRO4d//3Z7R/8Ij5mCdW1UkrOChV jl2DRaHwdXGuXstqOR+ZroYsx94xAnTVRxQ6h+VjMozcIHepBZxBUx87pEV4jvg81TAM vefA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ga9laUOl; 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 hg1-20020a17090b300100b0023f4e5dda3csi22080600pjb.7.2023.04.27.13.21.06; Thu, 27 Apr 2023 13:21:20 -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=ga9laUOl; 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 S1344170AbjD0UNO (ORCPT + 99 others); Thu, 27 Apr 2023 16:13:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344185AbjD0UNJ (ORCPT ); Thu, 27 Apr 2023 16:13:09 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1677F46A5; Thu, 27 Apr 2023 13:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682626366; x=1714162366; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=gkgzXX7acwSBnuJ9bdx4m5R1AVWdzJYvB7t1tP5cDvg=; b=ga9laUOlFSTypI2r0ajwWoZ+EaBwaKXXSB2V3UVcMeYZAnNQyqaU/m6/ fOQYMojH1iImLK4ynzJrJkKVEBZNf2WxMFZjMeYkLJT1Mk2rQeuCZXFMH vdvXkCx4tUrI20tFxM2O6+AYnoI6OZxXNhydhP1kgrqCeevg5P1NkSTcJ od4ulSSSm3+E0ChPNJRtCGYhyk0jP6TQBs4iudGXkuqdYdPrKUo4GSwxR ywHLFk/+Z4q7cRl08eddgjC8V7uVUWnrWV0RflQ+XHgo28uvPKmqN6hEo gjTaCkJlK4yCuOScwR6HcVGzweSdDOJP/XR+kGlJ1f1ygilJQEdDZEm5E w==; X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="410619736" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="410619736" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 13:12:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10693"; a="671906819" X-IronPort-AV: E=Sophos;i="5.99,232,1677571200"; d="scan'208";a="671906819" Received: from linux.intel.com ([10.54.29.200]) by orsmga006.jf.intel.com with ESMTP; 27 Apr 2023 13:12:45 -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 76609580377; Thu, 27 Apr 2023 13:12:41 -0700 (PDT) Message-ID: Date: Thu, 27 Apr 2023 16:12:40 -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 17/40] perf evsel: Modify group pmu name for software 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-18-irogers@google.com> From: "Liang, Kan" In-Reply-To: <20230426070050.1315519-18-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: > If we have a group of {cycles,faults} then we need the faults software > event to appear to be on the same PMU as cycles so that we don't split > the group in parse_events__sort_events_and_fix_groups. This case is > relatively easy as cycles is the leader and will have a PMU name. In > the reverse case, {faults,cycles} we still need faults to appear to > have the PMU name of cycles but the old behavior is just to return > "cpu". For hybrid this fails as cycles will be on "cpu_core" or > "cpu_atom", causing faults to be split into a different group. > > Change the behavior for software events so that the whole group is > searched for the named PMU. > > Signed-off-by: Ian Rogers Reviewed-by: Kan Liang Thanks, Kan > --- > tools/perf/util/evsel.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index 1cd04b5998d2..63522322e118 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -829,23 +829,26 @@ bool evsel__name_is(struct evsel *evsel, const char *name) > > const char *evsel__group_pmu_name(const struct evsel *evsel) > { > - const struct evsel *leader; > + struct evsel *leader, *pos; > > /* If the pmu_name is set use it. pmu_name isn't set for CPU and software events. */ > if (evsel->pmu_name) > return evsel->pmu_name; > /* > * Software events may be in a group with other uncore PMU events. Use > - * the pmu_name of the group leader to avoid breaking the software event > - * out of the group. > + * the pmu_name of the first non-software event to avoid breaking the > + * software event out of the group. > * > * Aux event leaders, like intel_pt, expect a group with events from > * other PMUs, so substitute the AUX event's PMU in this case. > */ > leader = evsel__leader(evsel); > - if ((evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) && > - leader->pmu_name) { > - return leader->pmu_name; > + if (evsel->core.attr.type == PERF_TYPE_SOFTWARE || evsel__is_aux_event(leader)) { > + /* Starting with the leader, find the first event with a named PMU. */ > + for_each_group_evsel(pos, leader) { > + if (pos->pmu_name) > + return pos->pmu_name; > + } > } > > return "cpu";