Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp994315pxb; Sat, 17 Apr 2021 03:22:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrrG5Es5sszJ3+r9om7SR9Y+f5KKQv3dw0IOc03J32JSlCw7dh6OLaSs6/UY7AJPFJ/16a X-Received: by 2002:a63:ed12:: with SMTP id d18mr3010516pgi.20.1618654950837; Sat, 17 Apr 2021 03:22:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618654950; cv=none; d=google.com; s=arc-20160816; b=YHFheNl2dXOtVtFFDKMTHygjW/6biXzQBZVELkH9l1alZwSc0liB7IH3+10pRfiN3R glE7YkMJ4oYoBPPcbV9bDghH0DdUWUssTg4KE2mii/ZZVBOFuv5p0J4yH68GBqSnCPYD 3SVikqTGOS5i9vUabfNrkvGAxyNy/fqC9V5CBF1ZGWf1bbUM3K2m+2lO8AvZXRfrVJ1g rPHDUqyS9oiGm4rc88AZ9f3MitfHRFKbDEyFvCg0tWrroWQ4M10nzn73ONkfSyt06PND BIPiuQBxS5LzEfTWUcSJnyATIlUfgDlLiH75TR1u0d27nvtQ2D0/CUcDmpaOgZMqPgin wwmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=ARxptzw39rmLHGjvURiByReWYEnNgLf7lfV8a0fazLQ=; b=tU9dhJLLdYM+n7oqKygH25icDjUD2/Wd/96sD6scF0Rpj4D/D/CYptRwgm1vDUhEOu sG0W4V8Yn+fKiLZhD6NgJRIhqaH8cFI+fqhja/9Pqq3OxPe+8u/+Vx0XABP5JL++8vvw ZnuyU751Sp01zswobkq5XPND59ZvT6LJVWcdRT+jdayuRJcK37nNCF7AnhdwjaHxzBrL ELE1uUgFDASIY9nlkgc6JmIIQVa+RNVhA8rFVOV2tSL9YaKKX4EAX5arhjCJy43jzap5 hAc5Z4fUnBn64hZ726JrtekGFzb56gQigBEttXxuBc4c6VuiF1EAyzjPtO6lb0PTZT40 Spyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm5si9292318pjb.25.2021.04.17.03.22.19; Sat, 17 Apr 2021 03:22:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236147AbhDQKUk (ORCPT + 99 others); Sat, 17 Apr 2021 06:20:40 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:17357 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236093AbhDQKU1 (ORCPT ); Sat, 17 Apr 2021 06:20:27 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FMptC5ng1z7vcT; Sat, 17 Apr 2021 18:17:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Sat, 17 Apr 2021 18:19:49 +0800 From: Yicong Yang To: , , , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH RESEND 0/4] Add support for HiSilicon PCIe Tune and Trace device Date: Sat, 17 Apr 2021 18:17:07 +0800 Message-ID: <1618654631-42454-1-git-send-email-yangyicong@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [RESEND with perf and coresight folks Cc'ed] 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. We use debugfs to expose the interface. For tune, one parameter is a debugfs file and user can set/get the value by reading/writing the file. For trace, we have several control files for the user to configure the trace parameters like filters, TLP type and format, the desired trace data size and so on. There is one data file for dumping the traced data to the user. The traced data maybe hundreds of megabytes so sysfs cannot support. The reason for debugfs rather than character device is that we don't want to have additional userspace tools. The operation through debugfs is easier and a bit like ftrace. The reason for not using perf is because there is no current support for uncore tracing in the perf facilities. We have our own format of data and don't need perf doing the parsing. The setting through perf tools doesn't seem to be friendly as well. For example, we cannot count on perf to decode the usual format BDF number like ::., which user can use to filter the TLP headers through the PTT device. A similar approach for implementing this function is ETM, which use sysfs for configuring and a character device for dumping data. Greg has some comments on our implementation and doesn't advocate to build driver on debugfs [1]. So I resend this series to collect more feedbacks on the implementation of this driver. Hi perf and ETM related experts, is it suggested to adapt this driver to perf? Or is the debugfs approach acceptable? Otherwise use sysfs + character device like ETM and use perf tools for decoding it? Any comments is welcomed. [1] https://lore.kernel.org/linux-pci/1617713154-35533-1-git-send-email-yangyicong@hisilicon.com/ Yicong Yang (4): hwtracing: Add trace function support for HiSilicon PCIe Tune and Trace device hwtracing: 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 | 326 +++++++ MAINTAINERS | 7 + drivers/Makefile | 1 + drivers/hwtracing/Kconfig | 2 + drivers/hwtracing/hisilicon/Kconfig | 11 + drivers/hwtracing/hisilicon/Makefile | 2 + drivers/hwtracing/hisilicon/hisi_ptt.c | 1636 ++++++++++++++++++++++++++++++++ 7 files changed, 1985 insertions(+) create mode 100644 Documentation/trace/hisi-ptt.rst create mode 100644 drivers/hwtracing/hisilicon/Kconfig create mode 100644 drivers/hwtracing/hisilicon/Makefile create mode 100644 drivers/hwtracing/hisilicon/hisi_ptt.c -- 2.8.1