Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1268709pxv; Fri, 25 Jun 2021 09:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPYU7Svx8DONU+mhLmIffViK5S1Zg1vMSxsSFqNO3QeBlb7xm73OzOmdUbvYhFhe/v2OQf X-Received: by 2002:a17:906:4786:: with SMTP id cw6mr11953348ejc.353.1624636972839; Fri, 25 Jun 2021 09:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624636972; cv=none; d=google.com; s=arc-20160816; b=XDpWY2L5mOjg2vZ3G2jmkhJBa93jBpwJH18vaOroXUB7Lc+f86SUtChX/nkixNG+Xv WGUeWktJDpW0FSWZMmsVl1djchXDA0jYqAyyBM+Y60yoEwRPYHE/s+ykLTH3imbrEI0L dvG4VMkcyQI53Rmw8CCXR2jG4ft77Vn8ASEf+SvrUEHBokrNuW4yHDmLd6J0ew7l7HEi 3JbQBO3McqeRhwW6E5Oej8mX79Hbs8eDEewAJWgegqoCv/6zFiN1m5WTAO3RJXOBCSyP hM784M8kKXlY0d9nPSTl6Uy+Bzor5lSrQ6DbdPjKuOXv/SA52xf7rRTLmvGVLyNfhvq8 WWQA== 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; bh=v5OxO2uXqsp0PLpi9KFT6oeG3+V+8E8KDhES3ahvCvQ=; b=A4LRLZRV9hBGT/5ppDHUpaB4O2lhlA1tQIFNBALByULwlVVAZDMpJWljE5OhGisbFv EYStF8qo/qI2vpB7naVrsa7WCi9x1LLq/CUj5TbRZ3s1FKiihTTVbZYS5DWyyDiN23zN vZUL/ZdHJ9q+8hBmi1ZK+VJqbV7FqV2FpNilrdg3dixMWCRt0HvRebu47IxJlBTozE97 6ZxyHRWtBbBR0YZXckymL/OL11mom6b/8j1x9lBUW8d/pd2JLLugBQy06yADjDigMHkS t/Z3EErHOZ34y/aGmdOXnNZ+C6LSo5Ag76gKTKCWpL9SXcXPYoEH0VE/ZIlzLPQatAZ4 bb0w== 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si6468106edo.20.2021.06.25.09.02.27; Fri, 25 Jun 2021 09:02:52 -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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbhFYQCg (ORCPT + 99 others); Fri, 25 Jun 2021 12:02:36 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3305 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbhFYQCg (ORCPT ); Fri, 25 Jun 2021 12:02:36 -0400 Received: from fraeml706-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GBLzw2hKqz6G8jp; Fri, 25 Jun 2021 23:50:04 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml706-chm.china.huawei.com (10.206.15.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 25 Jun 2021 18:00:13 +0200 Received: from [10.47.26.115] (10.47.26.115) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 25 Jun 2021 17:00:12 +0100 Subject: Re: [PATCH v7 2/2] drivers/perf: hisi: Add driver for HiSilicon PCIe PMU To: Qi Liu , , , CC: , , , , References: <1624532384-43002-1-git-send-email-liuqi115@huawei.com> <1624532384-43002-3-git-send-email-liuqi115@huawei.com> From: John Garry Message-ID: <485dcb90-01bc-766a-466a-f32563e2076f@huawei.com> Date: Fri, 25 Jun 2021 16:53:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <1624532384-43002-3-git-send-email-liuqi115@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.26.115] X-ClientProxiedBy: lhreml723-chm.china.huawei.com (10.201.108.74) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/2021 11:59, Qi Liu wrote: > + > +/* > + * Events with the "dl" suffix in their names count performance in DL layer, > + * otherswise, events count performance in TL layer. > + */ > +static struct attribute *hisi_pcie_pmu_events_attr[] = { > + HISI_PCIE_PMU_EVENT_ATTR(bw_rx_mwr, 0x010004), > + HISI_PCIE_PMU_EVENT_ATTR(bw_rx_mrd, 0x100005), > + HISI_PCIE_PMU_EVENT_ATTR(bw_tx_mwr, 0x010005), > + HISI_PCIE_PMU_EVENT_ATTR(bw_tx_mrd, 0x200004), > + HISI_PCIE_PMU_EVENT_ATTR(lat_rx_mwr, 0x000010), > + HISI_PCIE_PMU_EVENT_ATTR(lat_rx_mrd, 0x020010), > + HISI_PCIE_PMU_EVENT_ATTR(lat_tx_mrd, 0x000011), > + HISI_PCIE_PMU_EVENT_ATTR(bw_rx_dl, 0x010084), > + HISI_PCIE_PMU_EVENT_ATTR(bw_tx_dl, 0x030084), > + NULL > +}; > + > +static struct attribute_group hisi_pcie_pmu_events_group = { > + .name = "events", > + .attrs = hisi_pcie_pmu_events_attr, > +}; > + > +static struct attribute *hisi_pcie_pmu_format_attr[] = { > + HISI_PCIE_PMU_FORMAT_ATTR(event, "config:0-15"), > + HISI_PCIE_PMU_FORMAT_ATTR(subevent, "config:16-23"), > + HISI_PCIE_PMU_FORMAT_ATTR(thr_len, "config1:0-3"), > + HISI_PCIE_PMU_FORMAT_ATTR(thr_mode, "config1:4"), > + HISI_PCIE_PMU_FORMAT_ATTR(trig_len, "config1:5-8"), > + HISI_PCIE_PMU_FORMAT_ATTR(trig_mode, "config1:9"), > + HISI_PCIE_PMU_FORMAT_ATTR(port, "config2:0-15"), > + HISI_PCIE_PMU_FORMAT_ATTR(bdf, "config2:16-31"), > + NULL > +}; I am just wondering how this now works. So if the user programs the following: ./perf stat -v -e hisi_pcieX/lat_rx_mrd/ Then the value (incremented) in HISI_PCIE_CNT (I think that's the right one) is returned as the event count. But one would expect bandwidth from that event, while we only return here the delay cycles - how is the count in HISI_PCIE_CNT_EXT exposed, so userspace can do the calc for bw? Thanks, John