Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp584060rda; Sun, 22 Oct 2023 00:28:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQW0XmR5aaVWqmWE3uiUCzfZz72y9hRtgEKdxAdD4hRQO4J2/GZFKt82b8C+kyeN2rIAK+ X-Received: by 2002:a17:90a:b903:b0:27d:5504:4cc8 with SMTP id p3-20020a17090ab90300b0027d55044cc8mr4744427pjr.9.1697959682824; Sun, 22 Oct 2023 00:28:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697959682; cv=none; d=google.com; s=arc-20160816; b=RWlcXJx2Q8C3wIHePaeqnkrw3a7fQiu2/2rrTQl7jJNMIwHSm+MgfRU49wPL9TPL2j 0sx/boPyF0HdmmsruO1IcoB5bvGhK+Fr4yMzFSXSun1XvsAzaouTP9piNlhULNc3yf7I XN+bDDFEJsjpbqYONBjPjTaLnOTYJX2IdiQMAbfMWNSw3Vvw94Fx+iPsQdpbvQySUtXQ 2NCBwnZ7VCedD7EnwfIfRGGUBxwsd5WwGT20P2kKDoSaOUySweAbo7efGf8v0o0Tm6CM WhRVydjoxPHy9FadNU/n5+cT/WW/rLBj/9N1DUQQdjdjpJDM/U1OUPC3pzvVW1DJ1JM/ UsAg== 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:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=72Qzi6Od7l7jb5nkDf4e0mYh0tjrxt75m1LRI0KCF9c=; fh=zediKXjSPQMZi/2aRDFfIwy0+m2+qZtW/0aeziA5lJw=; b=LVolVu/HRqr2tC4cgRGtvphPzOiQpPFua8ZPqA3JAYtm1sZOEh3+TeAalor10fHUy5 UWdTUEM1wBgfmGIlayqca6eVN3+5y7+TDbCVUFJrINDLAf/PornUw52dUpUbj8NkTIxY BKwvbx8YSnID4Na7aj6ir++UYN7SlOu6c/zDIxf1OUlVMjtiWJ9cxeGyV5wD8sdxrfre zn+tg9nQTSeR1moL95ceejM/iXLC7PO88UxXVlyD7Y0d7NQeqq/WM7S+740dgeUu7ghy N//lWWMo69EpkISgeafm8cC3/ydHUP0/K1URlqLExlWAMJcL/V/Eh4CSo9aWzr/1bnhA y8hw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n16-20020a170902969000b001ca119ef46csi4232690plp.478.2023.10.22.00.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 00:28:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5E454809A75E; Sun, 22 Oct 2023 00:28:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjJVH1c (ORCPT + 99 others); Sun, 22 Oct 2023 03:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjJVH1a (ORCPT ); Sun, 22 Oct 2023 03:27:30 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79635C2; Sun, 22 Oct 2023 00:27:27 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R961e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VubL23W_1697959640; Received: from 30.240.48.65(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VubL23W_1697959640) by smtp.aliyun-inc.com; Sun, 22 Oct 2023 15:27:22 +0800 Message-ID: <673a0032-db43-4708-ac71-c8bef3fd8e56@linux.alibaba.com> Date: Sun, 22 Oct 2023 15:27:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 3/4] drivers/perf: add DesignWare PCIe PMU driver Content-Language: en-US To: Jonathan Cameron , Yicong Yang , Bjorn Helgaas Cc: chengyou@linux.alibaba.com, kaishen@linux.alibaba.com, will@kernel.org, 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 References: <20231020134230.53342-1-xueshuai@linux.alibaba.com> <20231020134230.53342-4-xueshuai@linux.alibaba.com> <20231020174940.0000429e@Huawei.com> From: Shuai Xue In-Reply-To: <20231020174940.0000429e@Huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Sun, 22 Oct 2023 00:28:00 -0700 (PDT) On 2023/10/21 00:49, Jonathan Cameron wrote: > On Fri, 20 Oct 2023 21:42:29 +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 a PCIe >> configuration space register block provided by each PCIe Root Port in a >> Vendor-Specific Extended Capability named RAS D.E.S (Debug, Error >> injection, and Statistics). >> >> 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. >> >> This driver adds PMU devices for each PCIe Root Port. And the PMU device is >> named based the BDF of Root Port. For example, >> >> 30:03.0 PCI bridge: Device 1ded:8000 (rev 01) >> >> the PMU device name for this Root Port is dwc_rootport_3018. >> >> Example usage of counting PCIe RX TLP data payload (Units of bytes):: >> >> $# perf stat -a -e dwc_rootport_3018/Rx_PCIe_TLP_Data_Payload/ >> >> average RX bandwidth can be calculated like this: >> >> PCIe TX Bandwidth = Rx_PCIe_TLP_Data_Payload / Measure_Time_Window >> >> Signed-off-by: Shuai Xue > LGTM other than some really trivial stuff inline if you are doing a v10 > > Reviewed-by: Jonathan Cameron Hi, Jonathan, Thank you for your prompt response. The fact that this [3/4] patch has received a Reviewed-by tag from the community is a momentous milestone for both the patchset itself and for me personally. I am deeply grateful for the time and effort you have dedicated to providing valuable comments, as it has significantly improved the code's quality. I will address the inline comments in the upcoming version v10. However, I kindly request some time to wait for feedback from esteemed reviewers such as Yicong, Bjorn, Will, or anyone else who may find this patchset intriguing. Best Regards and Cheers. Shuai >> + } >> + >> + /* Unwind when platform driver removes */ >> + ret = devm_add_action_or_reset( >> + &plat_dev->dev, dwc_pcie_pmu_remove_cpuhp_instance, >> + &pcie_pmu->cpuhp_node); >> + if (ret) >> + goto out; >> + >> + ret = perf_pmu_register(&pcie_pmu->pmu, name, -1); >> + if (ret) { >> + pci_err(pdev, >> + "Error %d registering PMU @%x\n", ret, bdf); >> + goto out; >> + } >> + >> + /* Cache PMU to handle pci device hotplug */ >> + list_add(&pcie_pmu->pmu_node, &dwc_pcie_pmu_head); >> + pcie_pmu->registered = true; >> + notify = true; >> + >> + ret = devm_add_action_or_reset( >> + &plat_dev->dev, dwc_pcie_pmu_unregister_pmu, pcie_pmu); > > line wrapping is a bit ugly - I would move the &plat_dev->dev to previous line. > and I think you can get away with aligning the rest just after the ( > Actually, I warp this with VSCode automaticlly :( Will move the &plat_dev->dev to previous line. > > > >> +static int __init dwc_pcie_pmu_init(void) >> +{ >> + int ret; >> + >> + ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, >> + "perf/dwc_pcie_pmu:online", >> + dwc_pcie_pmu_online_cpu, >> + dwc_pcie_pmu_offline_cpu); >> + if (ret < 0) >> + return ret; >> + >> + dwc_pcie_pmu_hp_state = ret; >> + >> + ret = platform_driver_register(&dwc_pcie_pmu_driver); >> + if (ret) >> + goto platform_driver_register_err; >> + >> + dwc_pcie_pmu_dev = platform_device_register_simple( >> + "dwc_pcie_pmu", PLATFORM_DEVID_NONE, NULL, 0); >> + if (IS_ERR(dwc_pcie_pmu_dev)) { >> + ret = PTR_ERR(dwc_pcie_pmu_dev); >> + goto platform_device_register_error; >> + } >> + >> + return 0; >> + >> +platform_device_register_error: > > Trivial but I'd standardize on err or error, not mix them. Sorry, will fix it. > >> + platform_driver_unregister(&dwc_pcie_pmu_driver); >> +platform_driver_register_err: >> + cpuhp_remove_multi_state(dwc_pcie_pmu_hp_state); >> + >> + return ret; >> +}