Message ID | 20231012032856.2640-1-xueshuai@linux.alibaba.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp957979vqb; Wed, 11 Oct 2023 20:29:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5FuyyIODN9nY90zB9W4P2AfkRqe+qSQmrHlhMGf1aWiKe17HOC1hiJe3H1SsjSYL3ASJ+ X-Received: by 2002:a17:902:d4cd:b0:1bb:9e6e:a9f3 with SMTP id o13-20020a170902d4cd00b001bb9e6ea9f3mr25828202plg.4.1697081375172; Wed, 11 Oct 2023 20:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697081375; cv=none; d=google.com; s=arc-20160816; b=UwafP/JGFDt9doP8DXsgrMYS9EaSdlQA66h6g6bFc4z3KX51avTFJprSEQEPCjFF8T r5AMti+KEJTd4u9MNrHcCy0la89IiF38OVgaX3s6wBQ96jVsE7CBs9cKwwRH00ODarfm TtHbnBUjq5OT4tBQ7FV+fglxKmQA0I7o3B3akYi8bu92Cunfra+l+wkrZJUZq+briBcS SFETDmcuLNRULv21Seac4DwGMgXlHhyQtd5RbJ7s/qFpjSUGqk9umJYRBvVviGgesNky iyr1HPHJ0ImqpRDYAdR1vrLE2GEfLKnr4r1mBOuYvxlR+EiXCE+qIq5Oc6d/aY7rG2Ei qG9w== 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=uWxTQh4KPkOGMy0eleazpUDIPL5j7OUesFn2BU58gek=; fh=YXkgGQjdwWXuBCaq3y30jhH9NVaym0uEtdyVivwN948=; b=S8+pcrjsHX0fgM1tQGlz4WIcWLD/fmzuSn+BSSfpIX1hdqucmq7N1rnVy/Uo0Xl+qX DlmkUFOcCZzWhrjjFCs6iYMr9zfK6RHiQtq2gzJSeREhaXCl5Uth/TJ35UDw/a8lOH2h 2wkqJ5UeBsOJ5KGdcNm0iIKsTyalu7LhCbeIzvM5NdrlJlF2QBiSFoQgsg7D3V6mM0hj dGdODb87uZYIqWJj1nDoSqVOK1K3QznOqCoRYUVK/OCg3iYxpBbAC+pxgBvFElYDSqmx TwdH0w6+sefUR7a12RT+c3PMHgm3n2iNn7S9RZIASXevGoO2K9wmsatR07HPAeJPSu/T CdqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id o12-20020a170902d4cc00b001c9b5d2c3fasi1234001plg.523.2023.10.11.20.29.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:29:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 27E7E801E752; Wed, 11 Oct 2023 20:29:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376784AbjJLD3L (ORCPT <rfc822;kartikey406@gmail.com> + 18 others); Wed, 11 Oct 2023 23:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234050AbjJLD3K (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 11 Oct 2023 23:29:10 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 378B3A9; Wed, 11 Oct 2023 20:29:08 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0Vtyvp29_1697081342; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vtyvp29_1697081342) by smtp.aliyun-inc.com; Thu, 12 Oct 2023 11:29:05 +0800 From: Shuai Xue <xueshuai@linux.alibaba.com> To: chengyou@linux.alibaba.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: 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 v7 0/4] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Date: Thu, 12 Oct 2023 11:28:52 +0800 Message-Id: <20231012032856.2640-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.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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 11 Oct 2023 20:29:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779518800027577654 X-GMAIL-MSGID: 1779518800027577654 |
Series |
drivers/perf: add Synopsys DesignWare PCIe PMU driver support
|
|
Message
Shuai Xue
Oct. 12, 2023, 3:28 a.m. UTC
Change Log ========== change 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) Cover Letter ========== 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 (4): docs: perf: Add description for Synopsys DesignWare PCIe PMU driver PCI: Add Alibaba Vendor ID to linux/pci_ids.h 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/perf/Kconfig | 7 + drivers/perf/Makefile | 1 + drivers/perf/dwc_pcie_pmu.c | 762 ++++++++++++++++++ include/linux/pci_ids.h | 2 + 8 files changed, 874 insertions(+), 2 deletions(-) create mode 100644 Documentation/admin-guide/perf/dwc_pcie_pmu.rst create mode 100644 drivers/perf/dwc_pcie_pmu.c