Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1493093pxy; Mon, 2 Aug 2021 03:04:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG4kfWsqF6bbKoEinQbChk/uLwBStN1nJLErGk+qG17TdEM+5PVEdHNzUDrjDGiAd5Hxtk X-Received: by 2002:a02:866a:: with SMTP id e97mr13829044jai.35.1627898693063; Mon, 02 Aug 2021 03:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627898690; cv=none; d=google.com; s=arc-20160816; b=vQ5C93e1aq6AamOb2sk7MNHu6EBnMHsKotXkbI7uj4K0PHzBZFAb6KeCVbc/+R3EHT O/XBLgHh/k5XugabO7bm5irDHYDIMAeSAOXPHzHJ4kbdW9afkWpYmuRIHtQ+VxnQ87DU 5fIuXrMseISKoVoQtT1N4+pF3caXw7Xd3qUx2xitmSq5oss++vwBDa1jbAmc5U8CPfeT gqsos1pmmn1BED11tq7wpYP/dg7AH9G1BhT+AH5Yd4j4MNQUzP8lqknn2aFZTwVUM5Ln d8ycrwBgAajrOcy8fJlsl5OOM6uuvhmjVKqy7Z1XinJakuQ9lulz55Vy8VsiarkuCpR1 inMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=1qiv/yQcMB6WqBNsZnGEmTOaIJ2Wtg+rgqWrDWrmRuY=; b=rK6iZAaZYnr7oO3ft/3cJDfbGxQMy4K34WrSHRuNBDQmS90g4+eSiZtM1jeHfaIiiH tn2MRASwlh+6y3dnX5hqBboFLpDF4mPkM+yswcc3DQVfq09lHYSWh+f06k4ITu8dl6FZ cTk3BibYzI+MefgnxaNpubFPVesEOojjDzjysckEsg9gn/I/nbkgWzj35f2DZ44jfPUz JvHTtlZIUUDr3Syo7E7EUx0WsX9XJpVipi5DD19npcSmtN3UWJGCG3xXOqUTfCil1S+F 2oiLLtDQce5NqME1PG8qCV0rbTR/EendZCx5dOqr6EjwLnzAAKM0j7X0zJJnQ7fRDJlO vQwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ezmi1wtf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v17si12804061ilo.17.2021.08.02.03.04.39; Mon, 02 Aug 2021 03:04:50 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ezmi1wtf; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233218AbhHBKEE (ORCPT + 99 others); Mon, 2 Aug 2021 06:04:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:55622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231669AbhHBKED (ORCPT ); Mon, 2 Aug 2021 06:04:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C918760F5A; Mon, 2 Aug 2021 10:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627898634; bh=akReKGJUqE3T64EJM+sE0hSyoy5AfOsjmjai1ezNn5I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ezmi1wtfv/KUeKUM4cWKnsBrT1UVQqZ99WYWoodlr9a3ajFZ830A0vV1SIhMa9+mX hMpZe7GAxG0ZVY2LmlKqsCQi4+kTNIXT/+t2u5NhbXtynIjy45G1Jq60nabDhTHhej iQ3Y9NC33LTE53lU0gYndDXz+W++7+lD5HpwvNv4vvoljyTZ9jC1g+BfHy4JJ7N0k0 fX3YmLUYy0kXszLEJZ4mFtu1RWPuna8UZIuC/Eo/3SmDZpovf+7tnNmIaQ/1LQG8nQ GmNZ1Ohxpt6GHlz3nt7PNR/eIuYYwq/rpOxk5UZRPggVp8dpsLaEkonG+uEPkM+CjE phdlt3g6I7tkQ== Date: Mon, 2 Aug 2021 11:03:43 +0100 From: Will Deacon To: Qi Liu Cc: mark.rutland@arm.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, zhangshaokun@hisilicon.com Subject: Re: [PATCH v8 2/2] drivers/perf: hisi: Add driver for HiSilicon PCIe PMU Message-ID: <20210802100343.GA27282@willie-the-truck> References: <20210728080932.72515-1-liuqi115@huawei.com> <20210728080932.72515-3-liuqi115@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210728080932.72515-3-liuqi115@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 28, 2021 at 04:09:32PM +0800, Qi Liu wrote: > PCIe PMU Root Complex Integrated End Point(RCiEP) device is supported > to sample bandwidth, latency, buffer occupation etc. > > Each PMU RCiEP device monitors multiple Root Ports, and each RCiEP is > registered as a PMU in /sys/bus/event_source/devices, so users can > select target PMU, and use filter to do further sets. > > Filtering options contains: > event - select the event. > subevent - select the subevent. Hmm, I was hoping that you would expose all the events as proper perf_events and get rid of the subevents entirely. Then userspace could do things like: // Count number of RX memory reads $ perf stat -e hisi_pcie0_0/rx_memory_read/ // Count delay cycles $ perf stat -e hisi_pcie0_0/latency/ // Count both of the above (events must be in the same group) $ perf stat -g -e hisi_pcie0_0/latency/ -e hisi_pcie0_0/rx_memory_read/ Note that in all three of these cases the hardware will be programmed in the same way and both HISI_PCIE_CNT and HISI_PCIE_EXT_CNT are allocated! So for example, doing this (i.e. without the '-g'): $ perf stat -e hisi_pcie0_0/latency/ -e hisi_pcie0_0/rx_memory_read/ would fail because the first event would allocate both of the counters. All you need to do is check the counter scheduling constraints when accepting an event group in the driver. No need for subevents at all. Does that make sense? Will