From patchwork Tue Jun 6 14:22:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 10361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3440721vqr; Tue, 6 Jun 2023 07:34:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66V6MgIgCXx1SCGPPdVrhmCX/iisnuY0efBUeFrRt/bpALMf/LA0IiYrbLH2bsPxaFl5Jp X-Received: by 2002:ad4:5dea:0:b0:626:3bf8:aef0 with SMTP id jn10-20020ad45dea000000b006263bf8aef0mr2698541qvb.23.1686062052275; Tue, 06 Jun 2023 07:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686062052; cv=none; d=google.com; s=arc-20160816; b=WR8kdlcbBv3PwJA8VssmDwKPnvd5+Eif+nRclgEpdVWv5G+nJ+pIq3ZC1im3f30eFQ eVoQkLAuiRGVF7rIKSLO5nmWZBsxLcPGmEYqSc6obxdBdWT6jgUKy1Nvz/F5Rs1LAgnT yjvid3ec5fTXJUaY4EfvtAa7Cp5m/IHd+joNf0uyk4F2HPVTANM/1Jbdtse6bcHUPPTl 0TdF+yiMCdnTppdfGFlZ+K41YSfqW5z6YD8gbvcFEuqzF5bxzqffv5s8r9+5CLcYnSmw QpA9HPfsS4sKuPcxYtnpWePXINUXmcV+2sKP0Mp88uixAnzyAOYUcdRStlD4zAyxLvXH RIzQ== 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=pMUfSa1PASKrD43d7I34YF2VI69C7udp4Wwjied8Ao4=; b=JzWNYV3NnCmtklmX/o134qSejXNSE+w1j2TVahM6tX1Z+AgsB6NOcTjYMSMfkmWIdv sUY932IQBQgBI0iANFTEZufZg7COyAwoK9tkfNNa93Re6a5gctn0oSfgTKnomH+Rw1za QTNJY/1k9Ka3pMkYBdtWyejM5luoOYB45ngQp16RGDSJ4YCRVxmlC6qpIqkENsC2yG/g YEKmKOUtNl0L4YD4YXjK1kZhOsHJSf+2hlo8zu/zOR8KqkcifnQSkFHRW2Ef7iB25Wh4 LPy02mu+zZUF1sexhCsatR+5pcZIBFpvPpCTE7cNOs2pQSS9+ytX0gBOGcLZmzDftg/K zgBA== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t7-20020ad45bc7000000b0061b637a64e9si6305594qvt.336.2023.06.06.07.33.58; Tue, 06 Jun 2023 07:34:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233338AbjFFOYX (ORCPT + 99 others); Tue, 6 Jun 2023 10:24:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237012AbjFFOYS (ORCPT ); Tue, 6 Jun 2023 10:24:18 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41ABD12D; Tue, 6 Jun 2023 07:24:16 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QbCNl0811z1c0Hx; Tue, 6 Jun 2023 22:22:31 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) 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.2507.23; Tue, 6 Jun 2023 22:24:12 +0800 From: Yicong Yang To: , , , , , CC: , , , , , Subject: [PATCH v4 0/5] Improve PTT filter interface and some fixes Date: Tue, 6 Jun 2023 22:22:39 +0800 Message-ID: <20230606142244.10939-1-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] 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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767964202379367441?= X-GMAIL-MSGID: =?utf-8?q?1767964202379367441?= From: Yicong Yang This series tends to improve the PTT's filter interface in 2 aspects (Patch 2&3): - Support dynamically filter updating to response to hotplug Previous the supported filter list is settled down once the driver probed and it maybe out-of-date if hotplug events happen later. User need to reload the driver to update list. Patch 1/2 enable the driver to update the list by registering a PCI bus notifier and the filter list will always be the latest. - Export the available filters through sysfs Previous user needs to calculate the filters and filter value using device's BDF number, which requires the user to know the hardware well. Patch 3/3 tends to export the available filter information through sysfs attributes, the filter value will be gotten by reading the file. This will be more user friendly. In order to support above function, this series also includes a patch 1/4 to factor out the allocation and release function of PTT filters. Also includes an improvement and a fixs. Patch 4 tends to set proper PMU capability to avoid collecting unnecessary data to save the storage. Patch 5 fix an improper use of pci_irq_vector() which have potential problem. Change since v3: - Addressed the comment from Jonathan. Add tags for Patch 1 and 4. Thanks. - Add one bugfix in Patch 5/5 Link: https://lore.kernel.org/linux-pci/20230523093228.48149-1-yangyicong@huawei.com/ Change since v2: - Fix one possible issue for dereferencing a NULL pointer Link: https://lore.kernel.org/linux-pci/20230331070310.5465-1-yangyicong@huawei.com/ Change since v1: - Drop the patch for handling the cpumask since it seems to be redundant - Refine of the codes per Jonathan - Add Patch 1/4 for refactor the filters allocation and release - Thanks the review of Jonathan. Link: https://lore.kernel.org/linux-pci/d496ee4f-641a-a726-ab3f-62b587422b61@huawei.com/T/#m47e4de552d69920035214b3e91080cdc185f61f5 Yicong Yang (5): hwtracing: hisi_ptt: Factor out filter allocation and release operation hwtracing: hisi_ptt: Add support for dynamically updating the filter list hwtracing: hisi_ptt: Export available filters through sysfs hwtracing: hisi_ptt: Advertise PERF_PMU_CAP_NO_EXCLUDE for PTT PMU hwtracing: hisi_ptt: Fix potential sleep in atomic context .../ABI/testing/sysfs-devices-hisi_ptt | 50 ++ Documentation/trace/hisi-ptt.rst | 12 +- drivers/hwtracing/ptt/hisi_ptt.c | 442 ++++++++++++++++-- drivers/hwtracing/ptt/hisi_ptt.h | 56 +++ 4 files changed, 522 insertions(+), 38 deletions(-)