Message ID | 20231208025652.87192-1-xueshuai@linux.alibaba.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5213264vqy; Thu, 7 Dec 2023 19:08:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEq6zWEHyufKWzBrRqicWpgJpWnzC/S25+oAAZ13Vof4IKEkDqeUF64DMREtiV0DYHcuqcj X-Received: by 2002:a17:902:6544:b0:1d2:dd72:3b30 with SMTP id d4-20020a170902654400b001d2dd723b30mr1436091pln.98.1702004920805; Thu, 07 Dec 2023 19:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702004920; cv=none; d=google.com; s=arc-20160816; b=QzwJrbBIQdtWNKlMLxx1dV7MRvkgdy3hnxHSqwU8V6d7SPTui6yK3anHQzmGnHWLp4 gkdx+TXtqCJAmh9hjg3jT4nfAk1q9n0u77RJ2Wy6bBSs1cbJICHsNYS9SM42jT07t7Pr cNbRoLag34i+Mkzs4Mxd/QS5ofLQPHfR9SHSv4oM5rYSHJLkLNY0XqeVK3ULnRjhusP7 7sKm6G575wBpt9oMABqX+jbAZLxXqILBrSzw7pv/gk7Y9X4SVR5Q38KCT1T2xvOgpdCC 9ANS1IUtNtX0qlS2F4eeh5MQa6YQodMfqk3SU40Gw7vCbaFgXqQibMU7cl0YF1c1huhc k8bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=zBwRH0TfUIqC9V1gxOmDNDy/fC35I6+FqLkcwVViInM=; fh=2hzC1URdKzP64w5tkSn/w/YwPHt0ac8Eb46OoMsWGDo=; b=EiwXdmdtjFti2VM+mqZmJdoFcXdnMZ/X0jQR042OG30CGkRYa57QmbEsl5gt/o0HgM taSOcaj8BH54Vlz1EODxxF1Med2oqo9BZmTEqvmZu8eP3+uSsOHSJEwG6gWxHtTMYTGS FOggfuWUBpy/AODsqVEqmpvEe2y23XksOMS6hknlXXQ7JViAQBgAtpfMnfpDvS5S/ZNd 8CBniCA1m14BlFN5pZ+eDtZyrFZL0tkW+e3rR3Xx3usgtEnT/GuScXcEYnxnKZNxf32N 4CggFNAhn3nP84fe8OQbSKG05mdffgCXs8liyZ4YGtBa9iuh9fPvzzcK2gqoqAq++spy iBAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id q14-20020a170902dace00b001cfcd2e1294si799682plx.241.2023.12.07.19.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 19:08:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 0FD65836B4E9; Thu, 7 Dec 2023 19:08:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573029AbjLHDIO (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Thu, 7 Dec 2023 22:08:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573048AbjLHDIJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 7 Dec 2023 22:08:09 -0500 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB71211E; Thu, 7 Dec 2023 18:57:02 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0Vy1bwsL_1702004216; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vy1bwsL_1702004216) by smtp.aliyun-inc.com; Fri, 08 Dec 2023 10:56:59 +0800 From: Shuai Xue <xueshuai@linux.alibaba.com> To: ilkka@os.amperecomputing.com, kaishen@linux.alibaba.com, helgaas@kernel.org, yangyicong@huawei.com, will@kernel.org, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com Cc: chengyou@linux.alibaba.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, xueshuai@linux.alibaba.com, renyu.zj@linux.alibaba.com Subject: [PATCH v12 0/5] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Date: Fri, 8 Dec 2023 10:56:47 +0800 Message-Id: <20231208025652.87192-1-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 19:08:36 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784681511699263434 X-GMAIL-MSGID: 1784681511699263434 |
Series |
drivers/perf: add Synopsys DesignWare PCIe PMU driver support
|
|
Message
Shuai Xue
Dec. 8, 2023, 2:56 a.m. UTC
Change Log ========== change sinces v11: - Fix uninitialized symbol 'now' (Per Dan and Will) - Pick up Reviewed-and-tested-by tag from Ilkka for Patch 4/5 change sinces v10: - Rename to pci_clear_and_set_config_dword() to retain the "config" information and match the other accessors. (Per Bjorn) - Align pci_clear_and_set_config_dword() and its call site (Per Bjorn) - Polish commit log (Per Bjorn) - Simplify dwc_pcie_pmu_time_based_event_enable() with bool value (Per Ilkka) - Fix dwc_pcie_register_dev() return value (Per Ilkka) - Fix vesc capability discovery by pdev->vendor (Per Ilkka) - pick up Acked-by tag from Bjorn for Patch 3/5 - pick up Tested-by tag from Ilkka for all patch set changes since v9: - move the &plat_dev->dev to previous line to warp more beautiful (Per Jonathan) - rename error label with the same suffix 'err' (Per Jonathan) - drop unnecessary else branch and return directly (Per Baolin) - warp out set prev_count from dwc_pcie_pmu_set_period (Per Baolin) - use PMU_FORMAT_ATTR to simplify format sysfs stuff (Per Will) - export pci_clear_and_set_dword() to simplify _enable() functions (Per Will) - simplify _read() function by unconditionally calculate with unit in bytes plused if branch for group#1 event (Per Will and Robin) - simplify _update() function by unconditionally mask with 64-bit width plused if branch for lane event (Per Will) - add type sanity check in _init() (Per Will) - test with fuzzing tool before this new version (Per Will) - register a platform device for each PCI device to probe RAS_DES PMU cap (Per Robin) - add dwc_pcie_vendor_ids to extend vendor id for future added device (Per Krishna) - pickup review-by tag from Baolin, Yicong and Jonathan changes since v8: - tidy up doc and pick up Reviewed-by tag in pathc 1/4 (Per Yicong and Jonathan) - rename ras_des as ras_des_offset and remove coment about it (Per Jonathan) - keep exact reverse order of what happened in probe when unregister pmu (Per Jonathan) - remove the hender length check to make the driver more compatible (Per Jonathan) - move unwind of register pmu forward to fix list_del() on something that was never added (Per Jonathan) - use devm_add_action_or_reset() to unwind bus_register_notifier() (Per Jonathan) - use local pdev directly in dwc_pcie_pmu_offline_cpu() and dwc_pcie_pmu_probe() (Per Jonathan) - use the approach of a gotos to handle errors in dwc_pcie_pmu_init() (Per Jonathan) - multiply the counter value at point of read by 16 for group#1 events (Per Jonathan) changes since v7: - add config help with alibaba name (per Bjorn) - remove the ARM64 dependency (per Bjorn and Jonathan) - fix typo and column warp (per Bjorn) - move list_del() after perf_pmu_unregister() (per Bjorn) - reorder the functions by interests (per Bjorn) - rewrite commit log about PMU counters, also update doc (per Bjorn) - extend to support stat time-based analysis and lane event at the same time (per Bjorn and Jonathan) Link: https://lore.kernel.org/linux-arm-kernel/20231012032856.2640-2-xueshuai@linux.alibaba.com/T/ changes since v6: - improve editorial things in doc (Per Jonathan) - change config help to generic text (Per Jonathan) - remove macro to_dwc_pcie_pmu by moving pmu as the first member to struct dwc_pcie_pmu (Per Yicong) - add event type check in dwc_pcie_event_show() to keep consistent with other function (Per Jonathan) - remove intended blank line (Per Yicong) - protect against lower 32 bits of counter overflow by try again trick (Per Jonathan) - call pci_dev_put on all the return branch to keep the refcnt balance (Per Jonathan and Yicong) - use devm_add_action_or_reset() to automatic unwind (Per Jonathan) - fix picking numa-aware context cpu up when offline and offline cpu (Per Jonathan) - simplify online cpu by init pcie_pmu->on_cpu as -1 (Per Jonathan) - add bus_register_notifier() to handle rootport hotplug (Per Yicong) - pick up Acked-by from Bjorn for patch 2/4 (Per Bjorn) Link: https://lore.kernel.org/lkml/20230606074938.97724-1-xueshuai@linux.alibaba.com/T/ changes since v5: - Rewrite the commit log to follow policy in pci_ids.h (Bjorn Helgaas) - return error code when __dwc_pcie_pmu_probe failed (Baolin Wang) - call 'cpuhp_remove_multi_state()' when exiting the driver. (Baolin Wang) - pick up Review-by tag from Baolin for Patch 1 and 3 Link: https://lore.kernel.org/lkml/ZGuSimj1cuQl3W5L@bhelgaas/T/#mba3fa2572dde0deddb40b5b24a31f4df41004bdf changes since v4: 1. addressing commens from Bjorn Helgaas: - reorder the includes by alpha - change all macros with upper-case hex - change ras_des type into u16 - remove unnecessary outer "()" - minor format changes 2. Address commensts from Jonathan Cameron: - rewrite doc and add a example to show how to use lane event 3. fix compile error reported by: kernel test robot - remove COMPILE_TEST and add depend on PCI in kconfig - add Reported-by: kernel test robot <lkp@intel.com> Changes since v3: 1. addressing comments from Robin Murphy: - add a prepare patch to define pci id in linux/pci_ids.h - remove unnecessary 64BIT dependency - fix DWC_PCIE_PER_EVENT_OFF/ON macro - remove dwc_pcie_pmu struct and move all its fileds into dwc_pcie_rp_info - remove unnecessary format field show - use sysfs_emit() instead of all the assorted sprintf() and snprintf() calls. - remove unnecessary spaces and remove unnecessary cast to follow event show convention - remove pcie_pmu_event_attr_is_visible - fix a refcout leak on error branch when walk pci device in for_each_pci_dev - remove bdf field from dwc_pcie_rp_info and calculate it at runtime - finish all the checks before allocating rp_info to avoid hanging wasted memory - remove some unused fields - warp out control register configuration from sub function to .add() - make function return type with a proper signature - fix lane event count enable by clear DWC_PCIE_CNT_ENABLE field first - pass rp_info directly to the read_*_counter helpers and in start, stop and add callbacks - move event type validtion into .event_init() - use is_sampling_event() to be consistent with everything else of pmu drivers - remove unnecessary dev_err message in .event_init() - return EINVAL instead EOPNOTSUPP for not a valid event - finish all the checks before start modifying the event - fix sibling event check by comparing event->pmu with sibling->pmu - probe PMU for each rootport independently - use .update() as .read() directly - remove dynamically generating symbolic name of lane event - redefine static symbolic name of lane event and leave lane filed to user - add CPU hotplug support 2. addressing comments from Baolin: - add a mask to avoid possible overflow Changes since v2 addressing comments from Baolin: - remove redundant macro definitions - use dev_err to print error message - change pmu_is_register to boolean - use PLATFORM_DEVID_NONE macro - fix module author format Changes since v1: 1. address comments from Jonathan: - drop marco for PMU name and VSEC version - simplify code with PCI standard marco - simplify code with FIELD_PREP()/FIELD_GET() to replace shift marco - name register filed with single _ instead double - wrap dwc_pcie_pmu_{write}_dword out and drop meaningless snaity check - check vendor id while matching vesc with pci_find_vsec_capability() - remove RP_NUM_MAX and use a list to organize PMU devices for rootports - replace DWC_PCIE_CREATE_BDF with standard PCI_DEVID - comments on riping register together 2. address comments from Bjorn: - rename DWC_PCIE_VSEC_ID to DWC_PCIE_VSEC_RAS_DES_ID - rename cap_pos to ras_des - simplify declare of device_attribute with DEVICE_ATTR_RO - simplify code with PCI standard macro and API like pcie_get_width_cap() - fix some code style problem and typo - drop meaningless snaity check of container_of 3. address comments from Yicong: - use sysfs_emit() to replace sprintf() - simplify iteration of pci device with for_each_pci_dev - pick preferred CPUs on a near die and add comments - unregister PMU drivers only for failed ones - log on behalf PMU device and give more hint - fix some code style problem (Thanks for all comments and they are very valuable to me) This patchset adds the PCIe Performance Monitoring Unit (PMU) driver support for T-Head Yitian 710 SoC chip. Yitian 710 is based on the Synopsys PCI Express Core controller IP which provides statistics feature. Shuai Xue (5): docs: perf: Add description for Synopsys DesignWare PCIe PMU driver PCI: Add Alibaba Vendor ID to linux/pci_ids.h PCI: Move pci_clear_and_set_dword() helper to PCI header drivers/perf: add DesignWare PCIe PMU driver MAINTAINERS: add maintainers for DesignWare PCIe PMU driver .../admin-guide/perf/dwc_pcie_pmu.rst | 94 +++ Documentation/admin-guide/perf/index.rst | 1 + MAINTAINERS | 7 + drivers/infiniband/hw/erdma/erdma_hw.h | 2 - drivers/pci/access.c | 12 + drivers/pci/pcie/aspm.c | 65 +- drivers/perf/Kconfig | 7 + drivers/perf/Makefile | 1 + drivers/perf/dwc_pcie_pmu.c | 792 ++++++++++++++++++ include/linux/pci.h | 2 + include/linux/pci_ids.h | 2 + 11 files changed, 948 insertions(+), 37 deletions(-) create mode 100644 Documentation/admin-guide/perf/dwc_pcie_pmu.rst create mode 100644 drivers/perf/dwc_pcie_pmu.c
Comments
On Fri, 8 Dec 2023 10:56:47 +0800, Shuai Xue wrote: > Change Log > ========== > change sinces v11: > - Fix uninitialized symbol 'now' (Per Dan and Will) > - Pick up Reviewed-and-tested-by tag from Ilkka for Patch 4/5 > > change sinces v10: > - Rename to pci_clear_and_set_config_dword() to retain the "config" > information and match the other accessors. (Per Bjorn) > - Align pci_clear_and_set_config_dword() and its call site (Per Bjorn) > - Polish commit log (Per Bjorn) > - Simplify dwc_pcie_pmu_time_based_event_enable() with bool value (Per Ilkka) > - Fix dwc_pcie_register_dev() return value (Per Ilkka) > - Fix vesc capability discovery by pdev->vendor (Per Ilkka) > - pick up Acked-by tag from Bjorn for Patch 3/5 > - pick up Tested-by tag from Ilkka for all patch set > > [...] Applied to will (for-next/perf), thanks! [1/5] docs: perf: Add description for Synopsys DesignWare PCIe PMU driver https://git.kernel.org/will/c/cae40614cdd6 [2/5] PCI: Add Alibaba Vendor ID to linux/pci_ids.h https://git.kernel.org/will/c/ad6534c626fe [3/5] PCI: Move pci_clear_and_set_dword() helper to PCI header https://git.kernel.org/will/c/ac16087134b8 [4/5] drivers/perf: add DesignWare PCIe PMU driver https://git.kernel.org/will/c/af9597adc2f1 [5/5] MAINTAINERS: add maintainers for DesignWare PCIe PMU driver https://git.kernel.org/will/c/f56bb3de66bc Cheers,
On 2023/12/14 01:25, Will Deacon wrote: > On Fri, 8 Dec 2023 10:56:47 +0800, Shuai Xue wrote: >> Change Log >> ========== >> change sinces v11: >> - Fix uninitialized symbol 'now' (Per Dan and Will) >> - Pick up Reviewed-and-tested-by tag from Ilkka for Patch 4/5 >> >> change sinces v10: >> - Rename to pci_clear_and_set_config_dword() to retain the "config" >> information and match the other accessors. (Per Bjorn) >> - Align pci_clear_and_set_config_dword() and its call site (Per Bjorn) >> - Polish commit log (Per Bjorn) >> - Simplify dwc_pcie_pmu_time_based_event_enable() with bool value (Per Ilkka) >> - Fix dwc_pcie_register_dev() return value (Per Ilkka) >> - Fix vesc capability discovery by pdev->vendor (Per Ilkka) >> - pick up Acked-by tag from Bjorn for Patch 3/5 >> - pick up Tested-by tag from Ilkka for all patch set >> >> [...] > > Applied to will (for-next/perf), thanks! > > [1/5] docs: perf: Add description for Synopsys DesignWare PCIe PMU driver > https://git.kernel.org/will/c/cae40614cdd6 > [2/5] PCI: Add Alibaba Vendor ID to linux/pci_ids.h > https://git.kernel.org/will/c/ad6534c626fe > [3/5] PCI: Move pci_clear_and_set_dword() helper to PCI header > https://git.kernel.org/will/c/ac16087134b8 > [4/5] drivers/perf: add DesignWare PCIe PMU driver > https://git.kernel.org/will/c/af9597adc2f1 > [5/5] MAINTAINERS: add maintainers for DesignWare PCIe PMU driver > https://git.kernel.org/will/c/f56bb3de66bc > > Cheers, Really a good news for me. Thank you very much:) And thanks to all patient and nice reviewers. Cheers, Shuai