Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4363202rdb; Mon, 11 Dec 2023 17:56:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IF51cdW/CXB9l5kiAmxm4iGhW4A6RLmeitzVknCcD+4bWPsBDdhhA7vV55cgtzI2/tyCR7k X-Received: by 2002:a05:6358:15c6:b0:170:17eb:3791 with SMTP id t6-20020a05635815c600b0017017eb3791mr7574668rwh.57.1702346199363; Mon, 11 Dec 2023 17:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702346199; cv=none; d=google.com; s=arc-20160816; b=0RPVHr/qtY49hmKWx5lnFSGgR6urvlY+FBkQwtINHMLvl5bCZdm2DYD1ZBSrxYwKJS gE5S6RdjX5p7WG+QHvH31e6/wiwCkEd1Y3haKoPWgH7M8UE472zyPKzuSBm8YuPaM/24 nje25git+dIRYibPnPOK7TL3PS2trfEo4L/C+Kk4cXDrMMDREYkUoVapDbAZu28EU4eH OjpedY2uswtHoY0dZX5EVS6pzI/09n6OYxLSfSg28rjKfU0msyFQ7FnFd9NZcsJBnWtO OwdbtcE0SBvORuC0AzMwhXiW/N049WeZGsp5XbD84yPmo83W9MewkqeG8tp3rpHi2isT vC4g== 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=DGoCLUUps/2OcBEN76P6Larj1iu8GvGDxR/2EcjTwck=; fh=V+4emReq9ffEPOFoJqkUxPtfhZY/a72dk0NanVmiPdw=; b=QETeBdJK1NQ40W8HcHNUEGle6MQ+X7DSEuhk3HOVoAi1H9NAAMP04gtKKuMbb1Rb6F iK4Pwj9nJOzO/ejdFFmfF64y5Rk0Rq2SmSAqP4wLfIMM6jsiC/R7rB3+GtUpScucs93m E0a4gwo6AYK4qOlcJesKATBJvGdGd7DqgvdhylRrSiXrKXMaAjFg8RkWCodTyWg6uvte QpXKtGKrQ3Vl5W/dGuIrqM9f6kHZlwFohtvNlCkQwZo1XvmWfBzh1jqkagRZLG+svYi/ LVtU6Mh9zqj3e/Z0EL0kzhMKmQpWsbwkolyASeUF6F1W/dUoC6bUlwiaUICktWuh/4az ZQlA== 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 Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id nk21-20020a17090b195500b0028a2fd5be00si93624pjb.67.2023.12.11.17.56.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 17:56:39 -0800 (PST) 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B9C598092481; Mon, 11 Dec 2023 17:56:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231142AbjLLBzw convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Dec 2023 20:55:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbjLLBzu (ORCPT ); Mon, 11 Dec 2023 20:55:50 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00331D1; Mon, 11 Dec 2023 17:55:50 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 4495024E28F; Tue, 12 Dec 2023 09:55:49 +0800 (CST) Received: from EXMBX072.cuchost.com (172.16.6.82) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 12 Dec 2023 09:55:49 +0800 Received: from localhost.localdomain (202.188.176.82) by EXMBX072.cuchost.com (172.16.6.82) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 12 Dec 2023 09:55:45 +0800 From: Ji Sheng Teoh To: CC: , , , , , , , , , , Subject: Re: [PATCH v4 1/2] perf: starfive: Add StarLink PMU support Date: Tue, 12 Dec 2023 09:55:38 +0800 Message-ID: <20231212015538.2310705-1-jisheng.teoh@starfivetech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX072.cuchost.com (172.16.6.82) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 pete.vger.email 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]); Mon, 11 Dec 2023 17:56:19 -0800 (PST) On Mon, 11 Dec 2023 11:54:25 -0600 Rob Herring wrote: > On Thu, Nov 16, 2023 at 10:24 AM Ji Sheng Teoh > wrote: > > > > This patch adds support for StarFive's StarLink PMU (Performance > > Monitor Unit). StarLink PMU integrates one or more CPU cores with > > a shared L3 memory system. The PMU supports overflow interrupt, > > up to 16 programmable 64bit event counters, and an independent > > 64bit cycle counter. StarLink PMU is accessed via MMIO. > > > > Example Perf stat output: > > [root@user]# perf stat -a -e /starfive_starlink_pmu/cycles/ \ > > -e /starfive_starlink_pmu/read_miss/ \ > > -e /starfive_starlink_pmu/read_hit/ \ > > -e /starfive_starlink_pmu/release_request/ \ > > -e /starfive_starlink_pmu/write_hit/ \ > > -e /starfive_starlink_pmu/write_miss/ \ > > -e /starfive_starlink_pmu/write_request/ \ > > -e /starfive_starlink_pmu/writeback/ \ > > -e /starfive_starlink_pmu/read_request/ \ > > -- openssl speed rsa2048 > > Doing 2048 bits private rsa's for 10s: 5 2048 bits private RSA's in > > 2.84s > > Doing 2048 bits public rsa's for 10s: 169 2048 bits public RSA's in > > 2.42s > > version: 3.0.11 > > built on: Tue Sep 19 13:02:31 2023 UTC > > options: bn(64,64) > > CPUINFO: N/A > > sign verify sign/s verify/s > > rsa 2048 bits 0.568000s 0.014320s 1.8 69.8 > > ///////// > > Performance counter stats for 'system wide': > > > > 649991998 starfive_starlink_pmu/cycles/ > > 1009690 starfive_starlink_pmu/read_miss/ > > 1079750 starfive_starlink_pmu/read_hit/ > > 2089405 starfive_starlink_pmu/release_request/ > > 129 starfive_starlink_pmu/write_hit/ > > 70 starfive_starlink_pmu/write_miss/ > > 194 starfive_starlink_pmu/write_request/ > > 150080 starfive_starlink_pmu/writeback/ > > 2089423 starfive_starlink_pmu/read_request/ > > > > 27.062755678 seconds time elapsed > > > > Signed-off-by: Ji Sheng Teoh > > --- > > drivers/perf/Kconfig | 9 + > > drivers/perf/Makefile | 1 + > > drivers/perf/starfive_starlink_pmu.c | 654 > > +++++++++++++++++++++++++++ include/linux/cpuhotplug.h | > > 1 + 4 files changed, 665 insertions(+) > > create mode 100644 drivers/perf/starfive_starlink_pmu.c > > > > diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig > > index 273d67ecf6d2..41278742ef88 100644 > > --- a/drivers/perf/Kconfig > > +++ b/drivers/perf/Kconfig > > @@ -86,6 +86,15 @@ config RISCV_PMU_SBI > > full perf feature support i.e. counter overflow, > > privilege mode filtering, counter configuration. > > > > +config STARFIVE_STARLINK_PMU > > + depends on ARCH_STARFIVE > > + bool "StarFive StarLink PMU" > > + help > > + Provide support for StarLink Performance Monitor Unit. > > + StarLink Performance Monitor Unit integrates one or more > > cores with > > + an L3 memory system. The L3 cache events are added into > > perf event > > + subsystem, allowing monitoring of various L3 cache perf > > events. + > > config ARM_PMU_ACPI > > depends on ARM_PMU && ACPI > > def_bool y > > diff --git a/drivers/perf/Makefile b/drivers/perf/Makefile > > index 16b3ec4db916..e2153aee1e04 100644 > > --- a/drivers/perf/Makefile > > +++ b/drivers/perf/Makefile > > @@ -15,6 +15,7 @@ obj-$(CONFIG_QCOM_L3_PMU) += qcom_l3_pmu.o > > obj-$(CONFIG_RISCV_PMU) += riscv_pmu.o > > obj-$(CONFIG_RISCV_PMU_LEGACY) += riscv_pmu_legacy.o > > obj-$(CONFIG_RISCV_PMU_SBI) += riscv_pmu_sbi.o > > +obj-$(CONFIG_STARFIVE_STARLINK_PMU) += starfive_starlink_pmu.o > > obj-$(CONFIG_THUNDERX2_PMU) += thunderx2_pmu.o > > obj-$(CONFIG_XGENE_PMU) += xgene_pmu.o > > obj-$(CONFIG_ARM_SPE_PMU) += arm_spe_pmu.o > > diff --git a/drivers/perf/starfive_starlink_pmu.c > > b/drivers/perf/starfive_starlink_pmu.c new file mode 100644 > > index 000000000000..272896ab1ade > > --- /dev/null > > +++ b/drivers/perf/starfive_starlink_pmu.c > > @@ -0,0 +1,654 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * StarFive's StarLink PMU driver > > + * > > + * Copyright (C) 2023 StarFive Technology Co., Ltd. > > + * > > + * Author: Ji Sheng Teoh > > + * > > + */ > > + > > +#define STARLINK_PMU_PDEV_NAME "starfive_starlink_pmu" > > +#define pr_fmt(fmt) STARLINK_PMU_PDEV_NAME ": " fmt > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > You probably don't need this header and the implicit includes it makes > are dropped now in linux-next. Please check what you actually need and > make them explicit. > > Rob Thanks Rob, this has changed to '#include ' in v5 submitted recently. https://lore.kernel.org/lkml/20231207142940.1794032-1-jisheng.teoh@starfivetech.com/T/#Z2e.:..:20231207142940.1794032-2-jisheng.teoh::40starfivetech.com:1drivers:perf:starfive_starlink_pmu.c