From patchwork Wed Aug 9 08:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 133152 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2699427vqr; Wed, 9 Aug 2023 03:30:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGg6Chbv4ZIwkPdLW2GtKaVKFeNb6eo4TueCYh7nnJK4nvf1SvErezuoCXRXi7oP/oXGcX1 X-Received: by 2002:a17:906:4e:b0:99c:bb4d:f59e with SMTP id 14-20020a170906004e00b0099cbb4df59emr1620333ejg.63.1691577050164; Wed, 09 Aug 2023 03:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691577050; cv=none; d=google.com; s=arc-20160816; b=s6+fDGV2w30Jy4tV5CJNcMdCdekU49o6ZTLh38e8a4hDzlcTh/hTeWbi5YWH6+qwyQ sSZF60YTCNMdGfO0RBcQ6BX3W6vYEBM2hHABts12Ym2Z4L8rGcAvJvRU/d7nkWLy6sWC pM68XitmbKrE5KQvB4mnBCw1v+AzsIRnI9x+I4vPH9gItFxQiRhGmhiCGplpj/BM3E0z DfgYajHJQk/ArVbKcrj3sKXMs6WqG7LHNJROFO+Hgfq5yKjXnujoqc4O3E5g8w+TgNaK t0qTNkP1oMv79r0EXTfX1yXmBzgRHjxTz2lonFJdaURhOS3WfcRQ9ZHn4sZmwxmUoMEB scfA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WNWLAG2f+Ji61N9O9iruqbhN25zKAUKlGRr+0g31uuQ=; fh=3Xa+Ca9QE4oHBLojfhmHw+QI2cJx6cXgOgG4DAxRTgs=; b=Qfic2Y5k02KW226jG/QnvGzVO6Csx/WMAbk0JsI9Gp2b1zGZCVJ+ybW0gHW4mofvN2 nozHR8jLnEYP18bikN8ISqkOdqjcLYMkjRxzpnWMfl1WDu9P5eCbHFfXt7BQCNDJUl3n /oEU8iS73QC9E2eDQqTYEdSNDB1e11/lBa1LCRyWK3oL9/lLT+6pX15KJzqb6HzkCj84 uqvmVRk+LWsBuu8vB75SC7FQi0hRR9hQJT+Zh8WuhUmvWMBnaTdQQpUJcJdUBzSRrciL y1Nn9lVK5iYphIlh+wW5Tx5ER/Gkd9l62xnbQ8KEfkD/Ahg+JyiVeSNmoPcq73oJc2hd MAnA== 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 o14-20020a1709061b0e00b0099bc8c11d20si8542613ejg.248.2023.08.09.03.30.25; Wed, 09 Aug 2023 03:30:50 -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 S231901AbjHIIUp (ORCPT + 99 others); Wed, 9 Aug 2023 04:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjHIIUl (ORCPT ); Wed, 9 Aug 2023 04:20:41 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC3610FE; Wed, 9 Aug 2023 01:20:41 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RLNHS2JX9zVl7M; Wed, 9 Aug 2023 16:18:44 +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.27; Wed, 9 Aug 2023 16:20:38 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH 1/5] hwtracing: hisi_ptt: Disable interrupt after trace end Date: Wed, 9 Aug 2023 16:18:21 +0800 Message-ID: <20230809081825.11518-2-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230809081825.11518-1-yangyicong@huawei.com> References: <20230809081825.11518-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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: INBOX X-GMAIL-THRID: 1773747097368043868 X-GMAIL-MSGID: 1773747097368043868 From: Yicong Yang On trace end we disable the hardware but leave the interrupt unmasked. Mask the interrupt to make the process reverse to the start. No actual issue since hardware should send no interrupt after disabled. Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 4 ++++ drivers/hwtracing/ptt/hisi_ptt.h | 1 + 2 files changed, 5 insertions(+) diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c index ba081b6d2435..5f0a8e653ae8 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.c +++ b/drivers/hwtracing/ptt/hisi_ptt.c @@ -183,6 +183,10 @@ static void hisi_ptt_wait_dma_reset_done(struct hisi_ptt *hisi_ptt) static void hisi_ptt_trace_end(struct hisi_ptt *hisi_ptt) { writel(0, hisi_ptt->iobase + HISI_PTT_TRACE_CTRL); + + /* Mask the interrupt on the end */ + writel(HISI_PTT_TRACE_INT_MASK_ALL, hisi_ptt->iobase + HISI_PTT_TRACE_INT_MASK); + hisi_ptt->trace_ctrl.started = false; } diff --git a/drivers/hwtracing/ptt/hisi_ptt.h b/drivers/hwtracing/ptt/hisi_ptt.h index e17f045d7e72..46030aa88081 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.h +++ b/drivers/hwtracing/ptt/hisi_ptt.h @@ -47,6 +47,7 @@ #define HISI_PTT_TRACE_INT_STAT 0x0890 #define HISI_PTT_TRACE_INT_STAT_MASK GENMASK(3, 0) #define HISI_PTT_TRACE_INT_MASK 0x0894 +#define HISI_PTT_TRACE_INT_MASK_ALL GENMASK(3, 0) #define HISI_PTT_TUNING_INT_STAT 0x0898 #define HISI_PTT_TUNING_INT_STAT_MASK BIT(0) #define HISI_PTT_TRACE_WR_STS 0x08a0 From patchwork Wed Aug 9 08:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 133123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2655109vqr; Wed, 9 Aug 2023 01:52:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjTOpR03Lq0RO4o/WXE6gmzeK7B3QH4V8nNvn5mUe+nLYUz1+7oP0xCK4VMHpLZ2xVtldD X-Received: by 2002:a19:380a:0:b0:4fe:958:88ac with SMTP id f10-20020a19380a000000b004fe095888acmr1270274lfa.6.1691571130100; Wed, 09 Aug 2023 01:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691571130; cv=none; d=google.com; s=arc-20160816; b=euR56jCMgOy+fGwauuWS7WpjDv+M+UrTjR0KIOS/bY7vZw1exGilS13+XFK2TJ3i73 h/cDnkYXO1uqQ2K4mQ7cbKk38bf1tEA1jlul6ItgBkDZUhaKMCPIqpl++wqQ0cpcoAKg pSHNmg32m+FdiM+NsgXfMPuXwQMyR0CjHa4bpi2hjrq8K3Dx0YlflHFvdyYcbS54IKmx hJ/5M3dasWRCWEVPTcPl+xRwtVS9nZYorc9UDSUVF0VpCvkz5+zBEFb6hlncBfO3cw6v nS26scjoLUkq37fI+9eMizlnZlHI7SRSNNuRs5/ys1/XqR75ellBi3hqCgNNoH7XfIEy Jwcw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vZaXbPgnXsVJZIZF76FR/fB0IrGJfjaJQqrFMYTLiXU=; fh=3Xa+Ca9QE4oHBLojfhmHw+QI2cJx6cXgOgG4DAxRTgs=; b=Ncbb+qG9ux29whdZOxSkxZoI9XloJA5cH1TwopAJfvSDxR6BYBnqpPpnKyzth5vTiq 82BF+MATjEOJ/hIZRGRdpLANR/1H9ZMr2P3qIZ7W0c3rNBJPetQish56MAXgJ7W8cRYq AMT1TX+WGarQtOLnQBAnTZggbVXjz2XV8CGHy1CwRnWawGQGRY26Vv+Q5I+UC7gOdNzn akhCQHxEaWB+zAPV3KFiPvMbFvI4HsVv3w6nNWT3nndec0a4Wa61kRVXgBHYkdJcAEuc o/qit87hKFrZoiO0aGP9BC1vJjV/mzvQ1EkPXuDdyXpZECI/qtwLV5Vbg7+nsAgZbuz/ MBDg== 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 c25-20020a056402121900b0052337f4212bsi4147199edw.108.2023.08.09.01.51.45; Wed, 09 Aug 2023 01:52:10 -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 S231908AbjHIIUs (ORCPT + 99 others); Wed, 9 Aug 2023 04:20:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbjHIIUm (ORCPT ); Wed, 9 Aug 2023 04:20:42 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25EE41703; Wed, 9 Aug 2023 01:20:42 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RLNFf5Jtmz9tjF; Wed, 9 Aug 2023 16:17:10 +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.27; Wed, 9 Aug 2023 16:20:39 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH 2/5] hwtracing: hisi_ptt: Handle the interrupt in hardirq context Date: Wed, 9 Aug 2023 16:18:22 +0800 Message-ID: <20230809081825.11518-3-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230809081825.11518-1-yangyicong@huawei.com> References: <20230809081825.11518-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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: INBOX X-GMAIL-THRID: 1773740889454917492 X-GMAIL-MSGID: 1773740889454917492 From: Yicong Yang Handle the trace interrupt in the hardirq context, make sure the irq core won't threaded it by declaring IRQF_NO_THREAD and userspace won't balance it by declaring IRQF_NOBALANCING. Otherwise we may violate the synchronization requirements of the perf core, referenced to the change of arm-ccn PMU commit 0811ef7e2f54 ("bus: arm-ccn: fix PMU interrupt flags"). In the interrupt handler we mainly doing 2 things: - Copy the data from the local DMA buffer to the AUX buffer - Commit the data in the AUX buffer Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c index 5f0a8e653ae8..89638ed96cf9 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.c +++ b/drivers/hwtracing/ptt/hisi_ptt.c @@ -346,9 +346,9 @@ static int hisi_ptt_register_irq(struct hisi_ptt *hisi_ptt) return ret; hisi_ptt->trace_irq = pci_irq_vector(pdev, HISI_PTT_TRACE_DMA_IRQ); - ret = devm_request_threaded_irq(&pdev->dev, hisi_ptt->trace_irq, - NULL, hisi_ptt_isr, 0, - DRV_NAME, hisi_ptt); + ret = devm_request_irq(&pdev->dev, hisi_ptt->trace_irq, hisi_ptt_isr, + IRQF_NOBALANCING | IRQF_NO_THREAD, DRV_NAME, + hisi_ptt); if (ret) { pci_err(pdev, "failed to request irq %d, ret = %d\n", hisi_ptt->trace_irq, ret); From patchwork Wed Aug 9 08:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 133156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2702919vqr; Wed, 9 Aug 2023 03:38:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZyugKEBE0xmD1Z2qChOqkZ82ajZTT1znDHaB7T89JYM0lfNSUs95mLBaw2Kc/OIUslmHu X-Received: by 2002:a17:906:5dd8:b0:994:522f:3f4a with SMTP id p24-20020a1709065dd800b00994522f3f4amr1811419ejv.29.1691577492474; Wed, 09 Aug 2023 03:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691577492; cv=none; d=google.com; s=arc-20160816; b=GuqRRHOCWU6MUcCBV2vieKN2Rd08HXzVJvF8ee3HW12NIp4k0rkQxqqLCLCeHJH8eg 0e7jRyU2TWtADYb3/2gK7flqmxDZ6Y/t/xIwEIb9+R1dV9H5iwwLXIArhI8Ea2rvaIZF 1HTDgPADmfe7x4IFzGwy9H19s4Eh1aE0fDsclqoRiONflwhsaqTCzhUkpCVSZq62Bh6q 1RGTsT+PAo0647RSrvaVhtW0cCo6NumNZsPYF856AUgjcaJBMoi9dJYpVZXbRWmOWE5M lgcs2bwIw6ublTMaZ67B1wYbOxawLh7HDUk5e6E510oQHCnxeUqRWiNpS07dvcFpElGp B2VQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=byQ4K/lZ03ybZ2H5i0kNUfquLRpDZcjopIru8yJ4Yfs=; fh=3Xa+Ca9QE4oHBLojfhmHw+QI2cJx6cXgOgG4DAxRTgs=; b=FbLHVJ2aRI9hki/lq/JMerh+LsWLH7ZR4n2GVTBG6zud2HWBN3unXtRLc4AkZ6GraI KlsgQsNWmCP3uQ6wLOcOlZsA2Ah6sDhc3Rx4IiAYANiB5uJm7GPzUwJ5V374uuWJbeCV u4G4Ykd5REOjAh+DKec3b5FJWYoN8fQVHBh/JflwmzpaaX4KiXYB4Na3aUw0dZ1cs1J4 ZyUqNNiFV3AV/HOq7Muy7Xdxc766bfOfLPOFaS4phx03UF2uhxMYwTTv0ZB2RPKsyigl KDiyzhG5NbTBLOQ+dCzknarB/Ek/wyMSF3yAFmBAz/CmlP0LoU+p+5sH1i+hp9w8dXLk 5O0g== 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 kq15-20020a170906abcf00b00977eb8d769bsi8801908ejb.289.2023.08.09.03.37.48; Wed, 09 Aug 2023 03:38: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 S231905AbjHIIUq (ORCPT + 99 others); Wed, 9 Aug 2023 04:20:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjHIIUm (ORCPT ); Wed, 9 Aug 2023 04:20:42 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 947BB10FF; Wed, 9 Aug 2023 01:20:41 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RLNJH6G7NzmXZF; Wed, 9 Aug 2023 16:19:27 +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.27; Wed, 9 Aug 2023 16:20:39 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH 3/5] hwtracing: hisi_ptt: Optimize the trace data committing Date: Wed, 9 Aug 2023 16:18:23 +0800 Message-ID: <20230809081825.11518-4-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230809081825.11518-1-yangyicong@huawei.com> References: <20230809081825.11518-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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: INBOX X-GMAIL-THRID: 1773747560541596174 X-GMAIL-MSGID: 1773747560541596174 From: Yicong Yang Currently during the PTT trace, we'll only commit the data to the perf core when its full, which means after 4 interrupts and totally 16MiB data while the AUX buffer is 16MiB length. Then the userspace gets notified and handle the data. The driver cannot apply a new AUX buffer immediately until the committed data are handled and there's enough room in the buffer again. This patch tries to optimize this by commit the data in every interrupts in a 4MiB granularity. Then the userspace can have enough time to consume the data and there's always enough room in the AUX buffer. Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c index 89638ed96cf9..3aba7bb6e548 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.c +++ b/drivers/hwtracing/ptt/hisi_ptt.c @@ -274,15 +274,14 @@ static int hisi_ptt_update_aux(struct hisi_ptt *hisi_ptt, int index, bool stop) buf->pos += size; /* - * Just commit the traced data if we're going to stop. Otherwise if the - * resident AUX buffer cannot contain the data of next trace buffer, - * apply a new one. + * Always commit the data to the AUX buffer in time to make sure + * userspace got enough time to consume the data. + * + * If we're not going to stop, apply a new one and check whether + * there's enough room for the next trace. */ - if (stop) { - perf_aux_output_end(handle, buf->pos); - } else if (buf->length - buf->pos < HISI_PTT_TRACE_BUF_SIZE) { - perf_aux_output_end(handle, buf->pos); - + perf_aux_output_end(handle, size); + if (!stop) { buf = perf_aux_output_begin(handle, event); if (!buf) return -EINVAL; From patchwork Wed Aug 9 08:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 133130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2659562vqr; Wed, 9 Aug 2023 02:01:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsXOnIb/Ala5w9LL9Oax2gH29+xsjBRu6xgF8xcxX/bY4LF75SAqxaXMvWJ3RGCN/lVa22 X-Received: by 2002:a05:6a21:7896:b0:13d:7f7b:1926 with SMTP id bf22-20020a056a21789600b0013d7f7b1926mr13776471pzc.11.1691571713094; Wed, 09 Aug 2023 02:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691571713; cv=none; d=google.com; s=arc-20160816; b=tCPCkW0nNR08FlZrKUFjWNLU/BOuqgSbDCCWB+QQC/nK1ff2WdiI772Lg+tau+dh00 bw/cqMk4v9D2yUdVrGE4IP+RFele+1ddmmDZNXb9WYD3TurBMNjjnRiKeFI+vVuQbhND T3gilNZVm3AtXZ1xqXpEIl/seLdDSnFnS6/ttjihjTmaUchFvIrk4kvAzKtrg0LdbOCC 2YSSFUHhyhN0Ghg59riwF4KfqJox1mWoi6LHO5Xm2PZjAztRkE8Zwy9qLYYA7e/h1xUb oWbiEhs9quMC/T69G5lXP7ZdQ4ucVS/q1cSRB5BMP4fJpmZd9qCFS9a/c1rzpHBVxW71 0c8A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=x087soijnmln3LgB0ue3X8EJHWuIdV9ftW8A22sVdnI=; fh=3Xa+Ca9QE4oHBLojfhmHw+QI2cJx6cXgOgG4DAxRTgs=; b=y18HYm8FyxQIsIytu9Eij1q5ra/iMJ8BFMvOLYRD6ar/hZnT3NchpXFLEV61E7yaNt UbTTtvXpumPkxrRmHtfxlEBJBGlDqzlKLSnCn9bjVW5otFVJjfBlxygqCvXQ1mS/XH0U BauRO2C9+gp31Umn0oTN5oM17/7GjNGRQZ3rDZSdJpd/eJhG1fLRCo6Kbc1CuRNjr8Z5 DWKDF1ACHovVJ3KPUNZ4VyZjkMBpZxXUBnVaKmn6TO5RRXdsgSeHakswDynJFGONRmqg DsNu2nnPPQBk5kupp/mCB+mUNcZhVnmpBsvtCcAmXGRfd5Swf1/Gc56vW+DNtFts0o2J WYlw== 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 i14-20020a636d0e000000b00564514df654si8686569pgc.895.2023.08.09.02.01.39; Wed, 09 Aug 2023 02:01:53 -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 S231922AbjHIIUu (ORCPT + 99 others); Wed, 9 Aug 2023 04:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231718AbjHIIUn (ORCPT ); Wed, 9 Aug 2023 04:20:43 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 682F11705; Wed, 9 Aug 2023 01:20:42 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RLNJJ0XFBzmXZJ; Wed, 9 Aug 2023 16:19:28 +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.27; Wed, 9 Aug 2023 16:20:39 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH 4/5] hwtracing: hisi_ptt: Don't try to attach a task Date: Wed, 9 Aug 2023 16:18:24 +0800 Message-ID: <20230809081825.11518-5-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230809081825.11518-1-yangyicong@huawei.com> References: <20230809081825.11518-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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: INBOX X-GMAIL-THRID: 1773741500884296794 X-GMAIL-MSGID: 1773741500884296794 From: Yicong Yang PTT is an uncore PMU and shouldn't be attached to any task. Block the usage in pmu::event_init(). Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c index 3aba7bb6e548..916686c6a9c8 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.c +++ b/drivers/hwtracing/ptt/hisi_ptt.c @@ -1003,6 +1003,9 @@ static int hisi_ptt_pmu_event_init(struct perf_event *event) return -EOPNOTSUPP; } + if (event->attach_state & PERF_ATTACH_TASK) + return -EOPNOTSUPP; + if (event->attr.type != hisi_ptt->hisi_ptt_pmu.type) return -ENOENT; From patchwork Wed Aug 9 08:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 133137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2668828vqr; Wed, 9 Aug 2023 02:21:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnAQKtr4ypbNlEH1ODvQVbl15mS/eor3/tt4y/cN8BBfyVhQf41ql9bO/herQg+YVJN+OC X-Received: by 2002:ac2:4ed1:0:b0:4fe:8c4:44f4 with SMTP id p17-20020ac24ed1000000b004fe08c444f4mr1235706lfr.62.1691572869163; Wed, 09 Aug 2023 02:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691572869; cv=none; d=google.com; s=arc-20160816; b=I8wYZNFuJk9ATsDiLLVnq561twf/14Kljxkz0J97RZ8lyhXYyt7/jigIQwIFgG6P09 pb52zYkLXutFVivlPqjho7l+xVzUToF5rKrfoQdu450EJuU4gaxdyGGaB8G37Nvd71Kb 2oGMGgcbsfGNzP/ywu9ZhyKZ/2gaRfobqF9abOlJB6Fi0ngkyugZE9+wgF4+wsefpile lOp4IQpopSzF31dIa/AEBVdiOSJ3qK1kCI3PqHjt/aHJzdQzl3wFF1KL5ao22oZ0uLJU pLuPLd2HVkXZXOSXF5rvGpCumcJaMfHVcj2qxm/DR6DT3Jhdwl6Mu2uqhFsUG+wXaIoU /b+A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=w/fNHbtGj2Bu8O8gxQWi2U3T6eSNUgt3I41QbTr71JA=; fh=3Xa+Ca9QE4oHBLojfhmHw+QI2cJx6cXgOgG4DAxRTgs=; b=TDJwnvZFJJ8nzmwjlsGCtffJtAimXtoxHpqDZ28pykbxjZGSazGEuD6SsGqMpa+Yrx fq+A5wM/32XrwAXYaAW4NvVqNk6CtWZim7Z8E66zrcWzMt5EQ5Kn+L8GTLOHggqpqB86 oL37tJiylyFWeLenvYGOxCrtbINLaX9G6YC9R+DQEpKZaRY4b8wn63p53OTlu/0WNj43 X6vZKeGhUi+VjOFEtYWZ+J9rYjPjvs8Md6AyZbnIuYxe5kKibkS6XYm4ikc5ENryBfTl BBhq3G33uC+I+FRhGdN1P4YTCC1bSAT8o5wxV+bIgfPiXM7vvJqpQ9IFZvFbNlgmhK0l J/KA== 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 d4-20020a05640208c400b005231e7a8671si7908986edz.614.2023.08.09.02.20.45; Wed, 09 Aug 2023 02:21:09 -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 S231936AbjHIIUy (ORCPT + 99 others); Wed, 9 Aug 2023 04:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbjHIIUo (ORCPT ); Wed, 9 Aug 2023 04:20:44 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4212FE7D; Wed, 9 Aug 2023 01:20:43 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RLNJJ29p6zmXZQ; Wed, 9 Aug 2023 16:19:28 +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.27; Wed, 9 Aug 2023 16:20:39 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH 5/5] hwtracing: hisi_ptt: Add dummy callback pmu::read() Date: Wed, 9 Aug 2023 16:18:25 +0800 Message-ID: <20230809081825.11518-6-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230809081825.11518-1-yangyicong@huawei.com> References: <20230809081825.11518-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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: INBOX X-GMAIL-THRID: 1773742712996188912 X-GMAIL-MSGID: 1773742712996188912 From: Junhao He When start trace with perf option "-C $cpu" and immediately stop it with SIGTERM or others, the perf core will invoke pmu::read() while the driver doesn't implement it. Add a dummy pmu::read() to avoid any issues. Signed-off-by: Junhao He Signed-off-by: Yicong Yang --- drivers/hwtracing/ptt/hisi_ptt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c index 916686c6a9c8..7392e039b8c1 100644 --- a/drivers/hwtracing/ptt/hisi_ptt.c +++ b/drivers/hwtracing/ptt/hisi_ptt.c @@ -1184,6 +1184,10 @@ static void hisi_ptt_pmu_del(struct perf_event *event, int flags) hisi_ptt_pmu_stop(event, PERF_EF_UPDATE); } +static void hisi_ptt_pmu_read(struct perf_event *event) +{ +} + static void hisi_ptt_remove_cpuhp_instance(void *hotplug_node) { cpuhp_state_remove_instance_nocalls(hisi_ptt_pmu_online, hotplug_node); @@ -1227,6 +1231,7 @@ static int hisi_ptt_register_pmu(struct hisi_ptt *hisi_ptt) .stop = hisi_ptt_pmu_stop, .add = hisi_ptt_pmu_add, .del = hisi_ptt_pmu_del, + .read = hisi_ptt_pmu_read, }; reg = readl(hisi_ptt->iobase + HISI_PTT_LOCATION);