Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp29353lfe; Fri, 15 Apr 2022 17:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGibUBDXDub/GiH5A47kYwZlPv7VElIt+jneVM1dRgBCLb/Duvw3y81ddAUf9LcwQrJQ1i X-Received: by 2002:a17:903:110f:b0:154:c7a4:9371 with SMTP id n15-20020a170903110f00b00154c7a49371mr1292247plh.75.1650070565503; Fri, 15 Apr 2022 17:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650070565; cv=none; d=google.com; s=arc-20160816; b=OvlLNLv+L46Lqks1h7++Kf04xMIqMKQm4T5b5A4ThdO9swYZVJ5w3gFLTZw2HbsQdw pt7CrvRV8zJ5q8BnUyNPIBPow+bvuA1m97XelUu2RZr+Nu1bc/QA0EjMikNvSnkIt/R/ 8vzePacGDCBEY+n9PCQoOFBPzacqox9lr2bPbw1XZrUp2MkjoMEnCIWJdVlLd/hp/aL/ dqGw2+S1SVhst3mzw8LBCBkXU0If1tBPKO1JZaGAo8YJLujmUuoO1AFXEVls0upqCyOb KNKkzb0QHxSULRDKnIWAz+ziljiXDAmhJTcnwc4f40tVhoppJUMWuLQyQsG7OiA4gatM PASg== 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 :mime-version:user-agent:date:message-id:from:references:to:subject :cc; bh=40vSX8u19/2m8mRGsr2RdQnPO6lJ3UrbsYCWJrJ9o24=; b=oykbpGAV2q7+j8oZOEX386O073UmcA0YFA6uvolXu7sVflMv+pmTjCFVPudCQ3vGbi BZs+wCTc6SQfkzOzI384cfBlmS62zBdJ0MxIII/36/N/mHdb79TTEV9SRQfF8qM1ZvWx G4gSdLUngxJv1ggkrqFlAV3LCHUjL8Mhx9UFidtAi0427E1QVszUnFxAID8xPCFc0Sai h3cltebYi7mxngdvnUYQwQpmEN6/g/iC41rpH97pGJEQc87GTycIPC/0ihS/KIE6DwkC pmZv0BwI0tt12i1+Hq6vHahB1gvBzM0yVdxAvqgYkiV3GM0QG7/sFU+4+Qjy4WypoXb2 255g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mw8-20020a17090b4d0800b001cd5b88c619si3382657pjb.32.2022.04.15.17.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:56:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13B01114FE2; Fri, 15 Apr 2022 17:42:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347249AbiDNOLp (ORCPT + 99 others); Thu, 14 Apr 2022 10:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244645AbiDNN1y (ORCPT ); Thu, 14 Apr 2022 09:27:54 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAB2A0BF5; Thu, 14 Apr 2022 06:20:32 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KfKlz56h8zgYFr; Thu, 14 Apr 2022 21:18:39 +0800 (CST) Received: from [10.67.102.169] (10.67.102.169) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Apr 2022 21:20:29 +0800 CC: , , , , Yicong Yang , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v7 0/7] Add support for HiSilicon PCIe Tune and Trace device To: Bjorn Helgaas References: <20220407125841.3678-1-yangyicong@hisilicon.com> From: Yicong Yang Message-ID: <701892ee-de70-e15c-6d9e-083268e94b77@huawei.com> Date: Thu, 14 Apr 2022 21:20:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20220407125841.3678-1-yangyicong@hisilicon.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.102.169] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, Since it's a device about tuning and analyzing PCIe link in your realm and you've given helpful comments in RFC and v1 version, looking forward to see your opnion on this driver as the user interface has changed to perf. Also to confirm that the hotplug problem mentioned in RFC[1] has been resolved in a proper way. [1] https://lore.kernel.org/linux-pci/20200710230913.GA90375@bjorn-Precision-5520/ Thanks. On 2022/4/7 20:58, Yicong Yang wrote: > HiSilicon PCIe tune and trace device (PTT) is a PCIe Root Complex > integrated Endpoint (RCiEP) device, providing the capability > to dynamically monitor and tune the PCIe traffic (tune), > and trace the TLP headers (trace). > > PTT tune is designed for monitoring and adjusting PCIe link parameters. > We provide several parameters of the PCIe link. Through the driver, > user can adjust the value of certain parameter to affect the PCIe link > for the purpose of enhancing the performance in certian situation. > > PTT trace is designed for dumping the TLP headers to the memory, which > can be used to analyze the transactions and usage condition of the PCIe > Link. Users can choose filters to trace headers, by either requester > ID, or those downstream of a set of Root Ports on the same core of the > PTT device. It's also supported to trace the headers of certain type and > of certain direction. > > The driver registers a PMU device for each PTT device. The trace can > be used through `perf record` and the traced headers can be decoded > by `perf report`. The perf command support for the device is also > added in this patchset. The tune can be used through the sysfs > attributes of related PMU device. See the documentation for the > detailed usage. > > Change since v6: > - Fix W=1 errors reported by lkp test, thanks > > Change since v5: > - Squash the PMU patch into PATCH 2 suggested by John > - refine the commit message of PATCH 1 and some comments > Link: https://lore.kernel.org/lkml/20220308084930.5142-1-yangyicong@hisilicon.com/ > > Change since v4: > Address the comments from Jonathan, John and Ma Ca, thanks. > - Use devm* also for allocating the DMA buffers > - Remove the IRQ handler stub in Patch 2 > - Make functions waiting for hardware state return boolean > - Manual remove the PMU device as it should be removed first > - Modifier the orders in probe and removal to make them matched well > - Make available {directions,type,format} array const and non-global > - Using the right filter list in filters show and well protect the > list with mutex > - Record the trace status with a boolean @started rather than enum > - Optimize the process of finding the PTT devices of the perf-tool > Link: https://lore.kernel.org/linux-pci/20220221084307.33712-1-yangyicong@hisilicon.com/ > > Change since v3: > Address the comments from Jonathan and John, thanks. > - drop members in the common struct which can be get on the fly > - reduce buffer struct and organize the buffers with array instead of list > - reduce the DMA reset wait time to avoid long time busy loop > - split the available_filters sysfs attribute into two files, for root port > and requester respectively. Update the documentation accordingly > - make IOMMU mapping check earlier in probe to avoid race condition. Also > make IOMMU quirk patch prior to driver in the series > - Cleanups and typos fixes from John and Jonathan > Link: https://lore.kernel.org/linux-pci/20220124131118.17887-1-yangyicong@hisilicon.com/ > > Change since v2: > - address the comments from Mathieu, thanks. > - rename the directory to ptt to match the function of the device > - spinoff the declarations to a separate header > - split the trace function to several patches > - some other comments. > - make default smmu domain type of PTT device to identity > Drop the RMR as it's not recommended and use an iommu_def_domain_type > quirk to passthrough the device DMA as suggested by Robin. > Link: https://lore.kernel.org/linux-pci/20211116090625.53702-1-yangyicong@hisilicon.com/ > > Change since v1: > - switch the user interface of trace to perf from debugfs > - switch the user interface of tune to sysfs from debugfs > - add perf tool support to start trace and decode the trace data > - address the comments of documentation from Bjorn > - add RMR[1] support of the device as trace works in RMR mode or > direct DMA mode. RMR support is achieved by common APIs rather > than the APIs implemented in [1]. > Link: https://lore.kernel.org/lkml/1618654631-42454-1-git-send-email-yangyicong@hisilicon.com/ > [1] https://lore.kernel.org/linux-acpi/20210805080724.480-1-shameerali.kolothum.thodi@huawei.com/ > > Qi Liu (1): > perf tool: Add support for HiSilicon PCIe Tune and Trace device driver > > Yicong Yang (6): > iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to > identity > hwtracing: Add trace function support for HiSilicon PCIe Tune and > Trace device > hisi_ptt: Add support for dynamically updating the filter list > hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace > device > docs: Add HiSilicon PTT device driver documentation > MAINTAINERS: Add maintainer for HiSilicon PTT driver > > Documentation/trace/hisi-ptt.rst | 303 +++++ > MAINTAINERS | 7 + > drivers/Makefile | 1 + > drivers/hwtracing/Kconfig | 2 + > drivers/hwtracing/ptt/Kconfig | 12 + > drivers/hwtracing/ptt/Makefile | 2 + > drivers/hwtracing/ptt/hisi_ptt.c | 1161 +++++++++++++++++ > drivers/hwtracing/ptt/hisi_ptt.h | 220 ++++ > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 16 + > tools/perf/arch/arm/util/auxtrace.c | 76 +- > tools/perf/arch/arm/util/pmu.c | 3 + > tools/perf/arch/arm64/util/Build | 2 +- > tools/perf/arch/arm64/util/hisi_ptt.c | 195 +++ > tools/perf/util/Build | 2 + > tools/perf/util/auxtrace.c | 4 + > tools/perf/util/auxtrace.h | 1 + > tools/perf/util/hisi-ptt-decoder/Build | 1 + > .../hisi-ptt-decoder/hisi-ptt-pkt-decoder.c | 170 +++ > .../hisi-ptt-decoder/hisi-ptt-pkt-decoder.h | 28 + > tools/perf/util/hisi_ptt.c | 218 ++++ > tools/perf/util/hisi_ptt.h | 28 + > 21 files changed, 2448 insertions(+), 4 deletions(-) > create mode 100644 Documentation/trace/hisi-ptt.rst > create mode 100644 drivers/hwtracing/ptt/Kconfig > create mode 100644 drivers/hwtracing/ptt/Makefile > create mode 100644 drivers/hwtracing/ptt/hisi_ptt.c > create mode 100644 drivers/hwtracing/ptt/hisi_ptt.h > create mode 100644 tools/perf/arch/arm64/util/hisi_ptt.c > create mode 100644 tools/perf/util/hisi-ptt-decoder/Build > create mode 100644 tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c > create mode 100644 tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.h > create mode 100644 tools/perf/util/hisi_ptt.c > create mode 100644 tools/perf/util/hisi_ptt.h >