Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1416685pxb; Sun, 11 Apr 2021 19:17:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy64SytlONAYc2SJSOitXKi5kcsd4UITrTCrYpHcuAzKUM/tRDJZMmnlyx/Lr9p6i1mvU87 X-Received: by 2002:a50:ee88:: with SMTP id f8mr18119749edr.69.1618193860329; Sun, 11 Apr 2021 19:17:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618193860; cv=none; d=google.com; s=arc-20160816; b=ArmfwHKDmNnUdleIeTH+4YAfMxEh1B5QIJxTTIAwsh74ZPNuPlhgNcuxnEwHRE/tdN 91cJL94ayNHhEC6xs82PGt0Ufu0kF/8+0SxydSrELvY3uQKwf8dFNhlnMM/v4zlHjulO 82GN1a1F9mROF+ATeF9ROG6u5iofywPDdCkin8zJ0l4Rg4e3TR3ez+FXubOyerItCUrR QNt9RrzZlcULJZgcZsOTxRVbb/ZWvbPOPRVYKtZ2u3fA3alFOEPYjgFETKdkNtamdxYQ UKuG+hpGIpaO6bgdh/93yazr3Ie3LYZluErqsytz2IMntdNMKE3I94F1kseg5tllCjSp ZiWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=mqCi5AibDrGSilJ6ttyYhdYqQdY9NJYp3Fdd2BTjmiM=; b=GtvHifU8RO9428tgfiGe8q16kgqwS2tMe9gxMztJGFkNFN9aDPQRyVKsN5K53eCqeO BBlCblOxIOIK3JIEj6TTumcp+9NSjNhw1yFIfAgjI8xKyxSfXHF+Lb7GCh+aMwzm3ysw 5eTNTecK56Z1X49Ujerg5QUxTIc2Rs6hgfe9/6PMulvpChTPLfINqBTri5T01ekuBSaj D4zqagV64/sBan4QoUUm6EgjYq2LUqzTMsGWLXLM4f3gx6jqzQq0G9PeBhXIlRKhMMu3 KOyIWpz+L30wFOPpw1GFPD/YS0UZWSAOlQ7146wkrczDBH4HG3mjZocttPOsx0niVkVG 0Ffw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si7238921ejg.244.2021.04.11.19.17.18; Sun, 11 Apr 2021 19:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236302AbhDLCBy (ORCPT + 99 others); Sun, 11 Apr 2021 22:01:54 -0400 Received: from mga01.intel.com ([192.55.52.88]:11707 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235543AbhDLCBx (ORCPT ); Sun, 11 Apr 2021 22:01:53 -0400 IronPort-SDR: 9yroIMTLsRBYzKEhkx4nkWTu3DjzE5Y2LjMioZu+zsK/Cn/6pSfDF2naGPVPmDCmVjkLKXldVf QoBHhecjmVsg== X-IronPort-AV: E=McAfee;i="6000,8403,9951"; a="214551143" X-IronPort-AV: E=Sophos;i="5.82,214,1613462400"; d="scan'208";a="214551143" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2021 19:01:35 -0700 IronPort-SDR: gQy0LhDHM+J5x278/CsruSjKQmU3l9RVn25wXZ4Vs9GurjDZGI3NQWaFizUdbjNlccMj0JM/gU mDti7+eQy+bw== X-IronPort-AV: E=Sophos;i="5.82,214,1613462400"; d="scan'208";a="451229238" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.238.4.6]) ([10.238.4.6]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2021 19:01:33 -0700 Subject: Re: [PATCH v3 11/27] perf pmu: Support 'cycles' and 'branches' inside hybrid PMU To: Jiri Olsa Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com References: <20210329070046.8815-1-yao.jin@linux.intel.com> <20210329070046.8815-12-yao.jin@linux.intel.com> From: "Jin, Yao" Message-ID: Date: Mon, 12 Apr 2021 10:01:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On 4/9/2021 9:48 PM, Jiri Olsa wrote: > On Mon, Mar 29, 2021 at 03:00:30PM +0800, Jin Yao wrote: >> On hybrid platform, user may want to enable the hardware event >> only on one PMU. So following syntax is supported: >> >> cpu_core// >> cpu_atom// >> >> # perf stat -e cpu_core/cpu-cycles/ -a -- sleep 1 >> >> Performance counter stats for 'system wide': >> >> 6,049,336 cpu_core/cpu-cycles/ >> >> 1.003577042 seconds time elapsed >> >> It enables the event 'cpu-cycles' only on cpu_core pmu. >> >> But for 'cycles' and 'branches', the syntax doesn't work. > > because the alias is not there.. but there's: > cpu/cpu-cycles/ > cpu/branch-instructions/ > > doing the same thing.. what's wrong with that? > > I have a feeling we discussed this in the previous > version.. did I give up? ;-) > Yes, we discussed this in previous threads. :) Now I'm fine to keep the original behavior. Because the syntax 'cpu/cycles/' and 'cpu/branches/' are not supported by current perf. > SNIP > >> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c >> index beff29981101..72e5ae5e868e 100644 >> --- a/tools/perf/util/pmu.c >> +++ b/tools/perf/util/pmu.c >> @@ -916,6 +916,35 @@ static int pmu_max_precise(const char *name) >> return max_precise; >> } >> >> +static void perf_pmu__add_hybrid_aliases(struct list_head *head) >> +{ >> + static struct pmu_event pme_hybrid_fixup[] = { >> + { >> + .name = "cycles", >> + .event = "event=0x3c", >> + }, >> + { >> + .name = "branches", >> + .event = "event=0xc4", >> + }, >> + { >> + .name = 0, >> + .event = 0, >> + }, > > if you really need to access these 2 events with special name, > why not add it through the json.. let's not have yet another > place that defines aliases ... also this should be model specific > no? > Yes, defining in json is a good idea if we really need to support 'cpu/cycles/' and 'cpu/branches/'. Anyway, I will drop this patch in next version. Thanks Jin Yao > jirka >