From patchwork Thu Sep 14 11:22:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 139517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp279725vqi; Thu, 14 Sep 2023 04:33:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+PfggcVvUNGED4s2XboQluJ54/F5RR+dJTtDNIG8MvzpYZuioCSAkxYqVHxWISh92nUmq X-Received: by 2002:a05:6a20:9742:b0:14d:d636:ed3a with SMTP id hs2-20020a056a20974200b0014dd636ed3amr4525973pzc.23.1694691229448; Thu, 14 Sep 2023 04:33:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694691229; cv=none; d=google.com; s=arc-20160816; b=igMhLNcjmDYJvp2cPxXFLEc706EPUsrrNlVjp7+Dz/KOdOvF0MMa1Iw8YzEhJAyHfK PltAfheN+XILv16ZEgffZbPvlJBlxFb917sYycefA5/yl1/h0YKM1fvs1I/4hSc7lkDS MdMTlocM15yuwkJRQcpcc/zveGwwm0e+XfM09oavwZz4BjLJo+h8egGXKRnCf7xAQ4ra XTIQ8X4Ugc1Dd9luQFTua63Y3fEvvEJe08XVyaYUti8gUwm45L1hcSgPkyBLpOXmGG+O G5cKmCYDRM8+ZUXKAs1RYFm7VIrx05hjSPKEsmbePmeumA4b20SEE01lH9Fkdmj66y7/ 03WA== 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=Pon1DH8YjPwpUznUaBirt67Q9d2DiKYSm1z4iqDnCaA=; fh=ko8w2iEBByNlWLnAg6bNI5pex73wZFG+4jwxERcD8TA=; b=zjGMtBtP1v0Jb9aIncGLhRSzlBlPuKZJFqYP0SRhAbOQ0hwXxk5CHZ4aOi64TuHYK/ Frf1a+fAcwKFW/poDCcV32Zo2HvQyhdkdA1wTV1DMcmHdj/3h9Q/YxHaR2qAjfBSLh5b NdHssY1eJNM3h99ozmW/k8kLUiTcWpH2tBKDjrbQaYRABEamHWhdndmW3XulcbgysztF YtqZh1N+YW73LCcgzSrtaTP0a0AChfIoDI8h+Jr+2RDcdixW3VwUFeT/1tbPQndJ/Zuj 1y4ckN+GHiRnzniU8ATo4Rl7T0trLzLhk4SnNWs/MDXsh9+oJ/qC0OQDLpdkClsWNxqg sNEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id eb8-20020a056a004c8800b0068fcccf5c87si1424705pfb.300.2023.09.14.04.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 04:33:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E17A782F0BDC; Thu, 14 Sep 2023 04:25:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232845AbjINLZ3 (ORCPT + 35 others); Thu, 14 Sep 2023 07:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjINLZ1 (ORCPT ); Thu, 14 Sep 2023 07:25:27 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD691A5; Thu, 14 Sep 2023 04:25:23 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RmZgX5RV2z1N7yV; Thu, 14 Sep 2023 19:23:04 +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.31; Thu, 14 Sep 2023 19:25:02 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH v2 1/5] hwtracing: hisi_ptt: Disable interrupt after trace end Date: Thu, 14 Sep 2023 19:22:19 +0800 Message-ID: <20230914112223.27165-2-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230914112223.27165-1-yangyicong@huawei.com> References: <20230914112223.27165-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:25:30 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777012550837901375 X-GMAIL-MSGID: 1777012550837901375 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 Acked-by: Jonathan Cameron --- 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 49ea1b0f7489..428cca54217e 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 Thu Sep 14 11:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 139512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp278861vqi; Thu, 14 Sep 2023 04:32:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrTb+xc9BUVQ9K27ciGUBEr21ACJtGoaqgadAdvfr5cAV53RQEV2QdYKIcj7GkIJ2iK/s0 X-Received: by 2002:a17:902:db0e:b0:1c0:cbaf:6954 with SMTP id m14-20020a170902db0e00b001c0cbaf6954mr2727314plx.25.1694691123878; Thu, 14 Sep 2023 04:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694691123; cv=none; d=google.com; s=arc-20160816; b=MOThgiaJu3o0kq1LhyQ9hGhZp2hK8bxBrh8DSiySedJcAmfRgFLCyeRAuI8cx0xghR xzgxrbD7KEr5kOJ8aGJmKxEU+jKBSVAoX03EseZBxAD1j3LlT7slfVsxFumW7J80MSRp 2DUWY4qHSS5Z6eo5T71grXmnD+RrlYPyu6oblAyXATvxQZEZF0uajUhIUpwQ03cPuvYa ACZQzqQgyFYbOIkxpsrRG4OSsNxnzl4Kmxo3uuLW22yvo5mFk1ZsBmizRRu1gI1Ogyqe 8LN1966kBwZMCRAa/XqEXLMeHYxm3KlMJjiF8c0KQJtc/fQPWuw8vGE2NF4x4si6fmBy Nd5A== 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=S/aSbHmj4LnlvbBGj39ZBWiaaC2Vhr28DaEcCWQcV6Q=; fh=ko8w2iEBByNlWLnAg6bNI5pex73wZFG+4jwxERcD8TA=; b=ZE2OAtBuzLf8e0m+4BtzdPeUUTydOshg8h3dp0noBQYZjfjCNFk4kKXpMmgQm0ivmW jxAV5/wUbeiYImiOxe8bzx3aBVINLqmhkuHPejiYUSwgWAkp2dLoo9/6XGdT1clSIzmy 5N0cWd0GQrqn1FfBjVUgFNDya/SCzcJoOnqoqt5Z556IcfYI4LKPMZyvAGBNAmuWtXtY BpOQkcYn2/ppdwS0bi0DcSoEPIqbITfN6WkQcRP8LrFCsgYk3L3VERVspYU75RpPnuxR wep0iogAchIOqwGfzqi0IDgUCM7FTgSrJMUlzFEwWExPDagx69IS0BPq9hFmJAhm9KXe MwtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b12-20020a170902650c00b001c3f601b6besi1391960plk.642.2023.09.14.04.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 04:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2668F803984E; Thu, 14 Sep 2023 04:26:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235307AbjINLZ6 (ORCPT + 35 others); Thu, 14 Sep 2023 07:25:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234742AbjINLZz (ORCPT ); Thu, 14 Sep 2023 07:25:55 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA441A5; Thu, 14 Sep 2023 04:25:25 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RmZgX1ZwGzgZgH; Thu, 14 Sep 2023 19:23:04 +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.31; Thu, 14 Sep 2023 19:25:02 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH v2 2/5] hwtracing: hisi_ptt: Handle the interrupt in hardirq context Date: Thu, 14 Sep 2023 19:22:20 +0800 Message-ID: <20230914112223.27165-3-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230914112223.27165-1-yangyicong@huawei.com> References: <20230914112223.27165-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:26:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777012440004660399 X-GMAIL-MSGID: 1777012440004660399 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 Acked-by: Jonathan Cameron --- 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 428cca54217e..3041238a6e54 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 Thu Sep 14 11:22: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: 139518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp280368vqi; Thu, 14 Sep 2023 04:35:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCtEzEZ2j/vxbRX8kZyBl3B1OdDbPdaaeG3OLZGs//GHWyT8ba8jI7iTXF/0j1ecXqEhJ1 X-Received: by 2002:a17:902:6b09:b0:1c3:6e38:3940 with SMTP id o9-20020a1709026b0900b001c36e383940mr5195032plk.7.1694691308505; Thu, 14 Sep 2023 04:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694691308; cv=none; d=google.com; s=arc-20160816; b=tq5JJC+53O8T7PmOW0JZOHaYDGZwY6YrdfkOISeytJCsiNk5pbImkllFGyh+O89cq6 CDCUZfylYvAIJqALwHEbbIMyinGppml/G7aZD+4FsfuVazkiWJRM9ZQyii0lr4FszMFr GytVpJLqwJr10XwP27Hp9taXxrFtWhEZnXMHsYJqS5UvuLOgZyzjD1ptmt02iJAt/wSp kAKGsckVvgBMk8eHkv7bTODFgAEWZB6HZ3XYbmZOOL+bC1Wd46RlBllJ6Uz7qs6AX3/s e07k16HeIBaldMfAbIMGOVsV/8Gvo4tzs1kMZL5LzHDHZKqs+n3cxPuuJi7538C/HTqa 4DnQ== 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=d14QcFvdPTUcBgD3vyQiQ44onpEQEIa+7WNttuaPO+M=; fh=ko8w2iEBByNlWLnAg6bNI5pex73wZFG+4jwxERcD8TA=; b=nuz+NJOdGC2kR2KS6kmbfpd3LFqGE5PAy2roqCnl+JJSt512Em4iZ65bD9Ny7jOfsF 4/K4+B7cAhYEGATSYsTjkzOLW98fTaD9mk4G1sB2vFce+J7FzHLfryEjRiNX/c3rXfPZ h/5KGrZ8i/z2HGMYWMfdSmCNF9Jbnwa0ijMNPZRriTWtTJinODmkl5bSrBEeIEevxxw9 xxZm2mBlM1pv/3YoolHK2WJTkQfuK3W8xqB+yZmo2YvjCn9Iroth0p2znJupqCWNceqF FfpbuAKlnm5lcKwpIRQ8vTux8D/JrF6zpeb82bBjGivLje7Xyn7q+hgV9HtoYOBCyHPl +Tzw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u3-20020a170902e5c300b001bf5753e0ccsi1656757plf.119.2023.09.14.04.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 04:35:08 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C3F6D8177E0C; Thu, 14 Sep 2023 04:26:09 -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 S233717AbjINLZx (ORCPT + 35 others); Thu, 14 Sep 2023 07:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbjINLZv (ORCPT ); Thu, 14 Sep 2023 07:25:51 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD86FA8; Thu, 14 Sep 2023 04:25:46 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RmZgY17DLz1N83D; Thu, 14 Sep 2023 19:23:05 +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.31; Thu, 14 Sep 2023 19:25:02 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH v2 3/5] hwtracing: hisi_ptt: Optimize the trace data committing Date: Thu, 14 Sep 2023 19:22:21 +0800 Message-ID: <20230914112223.27165-4-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230914112223.27165-1-yangyicong@huawei.com> References: <20230914112223.27165-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: 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]); Thu, 14 Sep 2023 04:26:09 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777012633026967520 X-GMAIL-MSGID: 1777012633026967520 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 Acked-by: Jonathan Cameron --- 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 3041238a6e54..4f355df8da23 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 Thu Sep 14 11:22: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: 139511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp278747vqi; Thu, 14 Sep 2023 04:31:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4b9SzdgVqYpUsvZ2giQt7A01JgevbU92rZ3sJAxo4ekhdBGpZxPCum4fFMXFYRpukVzCr X-Received: by 2002:a05:6870:a44c:b0:1d5:f070:d518 with SMTP id n12-20020a056870a44c00b001d5f070d518mr6102104oal.52.1694691113487; Thu, 14 Sep 2023 04:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694691113; cv=none; d=google.com; s=arc-20160816; b=EE3JtPv5wJSG6hXfmx2LK81QccuBymv527m3KWZiQmVP8mtH5YgcYmqacKN+8DmyVv er75GbCd3w4+xB1P6REvOOiYOStQmRrW871nxmcutbzWNrGziNrAVSfnPjwuAYJRSdol +fOv+JDWkiDPHIxoTh+LiYIy04CzQzczI3C6kZd9jqG8Y2Xylvfp1UtEAxL34HDCTcjE Cqsat0uOllURy2J0Cx/KNLOVBQNNrD7WKjcYWpOiswwIB9wk2Lok56+0WK+5VuVQvaNT xaptxHuqTNNug0hlnwS5DAz/vWPEZkQ3tlyOGS2ihmrPqEkND014/cbUnfyBoEv54CH5 b8Ag== 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=XmX8aNtjGWEs3JIbe2u092mO+Oz7G06WH9IBH93p42A=; fh=ko8w2iEBByNlWLnAg6bNI5pex73wZFG+4jwxERcD8TA=; b=tECvO001os4YRLUr84Rg8N+mhOCcfmD9WvK9ff3VMVV/vN+T/mkfg1YcK/9YCEjGqH LJbA4B1VX3IVEsYwIXdc/xSlqHLqVqmdgW3qaNe1loCI3op0G0lIpOK+Wuh12mTHVumZ YGLAyCqAvZ6Q6t4r6zP6ffDr0fzRjifGrQ3mchVj9t7yCFFMm0E0PnkJsnm4wQi35mgr mcC5Z8vUl77Jufk8KaDRRhK+5AQKbgrg/BauNNUmC7ti11n13dZiXcl6M4x65jMd86vJ bdWoUc02oEOJdQymwZ4fhmVPWq+uGyohGZlvUYxj3tSOPObxYnBRNOJYOLSJU/5onB6n j03w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id s24-20020a63af58000000b00577581963ccsi1297031pgo.260.2023.09.14.04.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 04:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 12420831D2EC; Thu, 14 Sep 2023 04:26:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233175AbjINLZv (ORCPT + 35 others); Thu, 14 Sep 2023 07:25:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjINLZu (ORCPT ); Thu, 14 Sep 2023 07:25:50 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AEB6CC7; Thu, 14 Sep 2023 04:25:43 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RmZgX4TCkzgZgc; Thu, 14 Sep 2023 19:23:04 +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.31; Thu, 14 Sep 2023 19:25:03 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH v2 4/5] hwtracing: hisi_ptt: Don't try to attach a task Date: Thu, 14 Sep 2023 19:22:22 +0800 Message-ID: <20230914112223.27165-5-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230914112223.27165-1-yangyicong@huawei.com> References: <20230914112223.27165-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:26:02 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777012428983906007 X-GMAIL-MSGID: 1777012428983906007 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 Acked-by: Jonathan Cameron --- 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 4f355df8da23..62a444f5228e 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 Thu Sep 14 11:22: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: 139510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp276469vqi; Thu, 14 Sep 2023 04:27:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFb0nRmo5jMErtn0gUoadnyXscUq5/HQMLJcsNXMEjgA/cwCD6O20iV3CU2tA2v7UKkO1jk X-Received: by 2002:a05:6a00:a90:b0:68e:45df:4648 with SMTP id b16-20020a056a000a9000b0068e45df4648mr5813076pfl.23.1694690845110; Thu, 14 Sep 2023 04:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694690845; cv=none; d=google.com; s=arc-20160816; b=mqHABSEhGhGAM52rUe/UiAMFs2+DFrWz3Mn1neCcmcFhAxR+48XQD2wJh2E1tngrBL inz6pUMYDjxQQ4Dv2V0QQpjseenrtUExWbBJx5ubQBVJwgM4nHP8DxjxEf02aP7cAxPy +1NLfzQRQ/HVsSjHffG0PhffdNyD3APWx/umsKxZpP/RQXxMjaN1WOmVpKQBY66N+wfb +L9Jh32uUygJnoWb6jWxPiaFDotU9C1BkxBCA/ldxtOAiMOX+YGlH869BmhXvR41Jr3l kBgNScSNhx9dXA0W+C1Fi37AzH8p0C3a3McmSmVt1ldhMCgqTye+yQq4SGbdfpo5FATo mtQQ== 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=PSDhbGLLxQXYsgdn5W0IdRgWH88HuV+nuj5zNAStHuM=; fh=ko8w2iEBByNlWLnAg6bNI5pex73wZFG+4jwxERcD8TA=; b=ldAIj9s10wvniZwihN2clUN23iQApZOK4E0r3cqDqUz7bkyzjk9Anfqg9sp2hwAcj4 yR9jo86J66gaHoUpD/94483v4gQ1pRu8Vu/pkGfcPzjil/okWNZnIbrvZDE7haO8gfP1 8pra67EaxCjFqb3+UlGN2rxuAZll0WxWtreyTHhrJExzqMVfCewBPjp8sbY2GkI+65UJ EJ1BtCvksuzmQgSScO6N8GOSzlp4gcqbR6b8VbGK4fW4/PTNn4D6QNrDODa7p5OMefgn JidPIJVeUGLUMbzf9q799mquf0BtWzCxMJWLJFsiAuiRcD4SrtsatKk3R2F5WGVV+rZc qiUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id v70-20020a638949000000b00573f867019fsi1274761pgd.443.2023.09.14.04.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 04:27:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5267981C4A93; Thu, 14 Sep 2023 04:25:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233218AbjINLZj (ORCPT + 35 others); Thu, 14 Sep 2023 07:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbjINLZi (ORCPT ); Thu, 14 Sep 2023 07:25:38 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1610C1FCA; Thu, 14 Sep 2023 04:25:33 -0700 (PDT) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RmZgY48Rzz1N83N; Thu, 14 Sep 2023 19:23:05 +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.31; Thu, 14 Sep 2023 19:25:03 +0800 From: Yicong Yang To: , , , CC: , , , , , , Subject: [PATCH v2 5/5] hwtracing: hisi_ptt: Add dummy callback pmu::read() Date: Thu, 14 Sep 2023 19:22:23 +0800 Message-ID: <20230914112223.27165-6-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20230914112223.27165-1-yangyicong@huawei.com> References: <20230914112223.27165-1-yangyicong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:25:43 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777012147636282946 X-GMAIL-MSGID: 1777012147636282946 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 Acked-by: Jonathan Cameron --- 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 62a444f5228e..c1b5fd2b8974 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);