Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2544419rdg; Mon, 16 Oct 2023 07:38:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2UTv2+6GdbZee4IiqzfZX83OGhxmxLZech0jtBkFMgKbfmtveJRoxq8r+MKTyCFutO5EL X-Received: by 2002:a17:903:2301:b0:1c5:cf7c:4d50 with SMTP id d1-20020a170903230100b001c5cf7c4d50mr12161947plh.18.1697467103230; Mon, 16 Oct 2023 07:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697467103; cv=none; d=google.com; s=arc-20160816; b=gNf/EXdi68YmfhibbQAz67HVQU+cO9ckdVUoLfMzOYkj+Dko2inKHsDq8sgyCu5Zl3 Jsw1XEMGqZA2tgRIJRCR4PIaOJNQjH7FWINN6D0iX9N8xrdX4vI3WrmDS4xy+ruN8Z01 xTAJ0r/1ZxegJVlyBToUyAB2x6T/VyK7T+T9nuBmYNU4wy2z6u01tltGaFaSECD2q11u TAFaBej6ef7m7WDh5w37a2UNKMj1xwcDPGG9cqI/18iDv7eLdMqDA/XnK8hu7DYoV9+P N5aQ/7qgh/B9YP9H6/sfMYbQXfz5wiQl9bIwac1zALEd1O0JAcrAz2zuPkt4C5bNcxJy GLlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=VlYS9JCvG01ywYFddGIPEhUJCLfAA9TwVaSQe9PrFvs=; fh=8LSgoDXPEfSu/ox0tgu2xJxYqahlcPh05SGoOOn12oc=; b=PjwSlRjvxxxpEdAdl/OC4xiCR1+au/FBxGH/aRPRnxJeSFQ5hqLtg+0qBKflGhw/yC dSZpRbVHKFHYsdof4jEvnDQqFPlvX2xhjY1EnaZTeT+q5FZB3sDS5YVkjO0eLZCwaAIV EnsTgeP9mwPMM+wRpgQTE01A/KZzxBvzpcabgMr39RKHhdmyEjjUTeX0lFxR0T4hdV1k Fhz4LIy9DIfqWAEJ0U23HKKzrLwcH+SUQP2pmf5MgPty1qhF2pni6R8VB3r/GbT6FMjw VW1otDL1JfjyO0UM/BDTWwTM8nUHJC3XKc87FwDhFm/F9VNdoll0kVeVbGCiXLpKfJvj XFEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DrEkikmh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b11-20020a170902d88b00b001b973681493si10244233plz.16.2023.10.16.07.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 07:38:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DrEkikmh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 70F3E807C865; Mon, 16 Oct 2023 07:38:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232143AbjJPOiL (ORCPT + 99 others); Mon, 16 Oct 2023 10:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjJPOiJ (ORCPT ); Mon, 16 Oct 2023 10:38:09 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BCFB9; Mon, 16 Oct 2023 07:38:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BCDEC433C7; Mon, 16 Oct 2023 14:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697467087; bh=I4NzxPNcEzkn00WTlYgKFrsJkje8b0dreIMdCi7RT94=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=DrEkikmhBQrIANHZg5CzSDNJQo082/3eXl1zS7Ed1phG6li8P/T0U2HVFv1djx8OL 6h2cfCZfU5QRuldC1yqNvO2JrHmd302/znP/Q9Mcn3oZxbICAAzo9dwSid26cyx5Vy aJ1jOuBkbmBVbzOjzto2/yfigYQDMTX+8r03WYmPWL9PfjUUt0tHcLEHaX0s7Puepj pRV4+BlOhhFaz1jia/15rIa4aSiIAtw//vbWu3NLe3tiv3cMmwRiAtOV9u3bJ2T9mO d9h4Ih6E+5QTvQHvAemBmX0FxFvRfh6P6IrEDrALYOz524Jm/WjsKj8/Uotpxn9aQi JhazDIoLA+a6g== Date: Mon, 16 Oct 2023 09:38:05 -0500 From: Bjorn Helgaas To: Shuai Xue Cc: chengyou@linux.alibaba.com, kaishen@linux.alibaba.com, yangyicong@huawei.com, will@kernel.org, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, zhuo.song@linux.alibaba.com, renyu.zj@linux.alibaba.com Subject: Re: [PATCH v7 3/4] drivers/perf: add DesignWare PCIe PMU driver Message-ID: <20231016143805.GA1207929@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4147832a-1f24-5993-dfb6-59f420a17481@linux.alibaba.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 07:38:20 -0700 (PDT) On Mon, Oct 16, 2023 at 11:00:13AM +0800, Shuai Xue wrote: > On 2023/10/14 00:30, Bjorn Helgaas wrote: > > On Fri, Oct 13, 2023 at 11:46:44AM +0800, Shuai Xue wrote: > >> On 2023/10/13 00:25, Bjorn Helgaas wrote: > >>> On Thu, Oct 12, 2023 at 11:28:55AM +0800, Shuai Xue wrote: > >>>> This commit adds the PCIe Performance Monitoring Unit (PMU) > >>>> driver support for T-Head Yitian SoC chip. Yitian is based on > >>>> the Synopsys PCI Express Core controller IP which provides > >>>> statistics feature. The PMU is not a PCIe Root Complex > >>>> integrated End Point(RCiEP) device but only register counters > >>>> provided by each PCIe Root Port. > @@ -447,10 +447,10 @@ static int dwc_pcie_pmu_event_add(struct perf_event *event, int flags) > u32 ctrl; > > /* Only one counter and it is in use */ > - if (pcie_pmu->event) > + if (pcie_pmu->event[type]) > return -ENOSPC; > > - pcie_pmu->event = event; > + pcie_pmu->event[type] = event; OK, makes good sense (probably update the comment also, e.g., "one counter of each type"). > } > > If so, I might word this as: > > > > Each Root Port contains one counter that can be used for either: > > > > - Time-Based Analysis (RX/TX data throughput and time spent in > > each low-power LTSSM state) or > > > > - Event counting (error and non-error events for a specified lane) > > > > There is no interrupt for counter overflow. > > Based on above, I change the word to: > > To facilitate collection of statistics the controller provides the > following two features for each Root Port: > > - one 64-bit counter for Time Based Analysis (RX/TX data throughput and > time spent in each low-power LTSSM state) and > - one 32-bit counter for Event counting (error and non-error events for > a specified lane) > > Note: There is no interrupt for counter overflow. Beautiful, that's very clear. Bjorn