Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37028393rwd; Tue, 11 Jul 2023 08:33:31 -0700 (PDT) X-Google-Smtp-Source: APBJJlGOu5NFrp8OGrIp1O+Xiw/p2eftBIwPahDJLBJGOqig2WIruhMItCrBrNYPZEdtfQCPJxke X-Received: by 2002:a05:6358:70e:b0:135:4c43:f4fc with SMTP id e14-20020a056358070e00b001354c43f4fcmr13143553rwj.8.1689089611162; Tue, 11 Jul 2023 08:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689089611; cv=none; d=google.com; s=arc-20160816; b=zmHVxPyBIdjBxEyTFGXzjvOVl9+zAleV0JFZzVqH7IsP0LW0AMKTW/AKwaQODvLf2a SolT2PFrJKI/vHazEIetppq43PxjmGVWg5Rdl6Okfban2rO7OmlPgsJX+o82mBcyRPIX EGAomrH8xMdHfRXXohn5lGJxhjP7s5DpLDdqZDQye0/6O7DHiDu98BT0l16y+HTBxLm/ yJ/Wmt3FHvx9Sz0CYowYG4ElIgVTIlA7EiscR77DaqO85aITro5y3Mbaz3BtTBMmSNW2 E+4i/KXUEp5HBUdXbten81yNdrJDC52uERkWW9wZpk3R+PRTaMqeuV86yXM8ikeKZR1M D71g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ELbRN/LifTQ/7zfClfcRkCTRTEOE/j2wLv/6DGZBUz4=; fh=KIJb2tSrGvHsNw/ST26N+zo34S72sfZ5JtcWqKjS1Lc=; b=LcLllUXE3iM1VQLUzxVvK/NHe7gh34QfveqbQyUseb+rU28TwWqfcNmouQ0S9xRh0g OBHpFBg90nvzz4a3CscKxQ2tif6mJLpcg1KK0oyceV3na2r+iuoTE8Do2quZ8U2H8pzw khJaOmQp0J2CFtt2Wl6UEYqqVgHqij3IO0Y90qtHrm8qX1KX9WXbBlAO4dE8W6W4YYit fp3oq/UNmDaJdHJGf/4B7d32o8cqcxwsns2C6VcNP5dTVT/+OWOE8qx02Ytj7p1gf76k qF1QU2Nwo/pH0oedzlu3S+gcsab55/gwBlnkLShHJK+n63b5KV8adkdBo9cISkP2rPNn wfXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bHShCj9W; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a635e07000000b0055bc3404854si1536123pgb.757.2023.07.11.08.33.17; Tue, 11 Jul 2023 08:33:31 -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; dkim=pass header.i=@sifive.com header.s=google header.b=bHShCj9W; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231458AbjGKPJ3 (ORCPT + 99 others); Tue, 11 Jul 2023 11:09:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbjGKPI6 (ORCPT ); Tue, 11 Jul 2023 11:08:58 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 490DAA0 for ; Tue, 11 Jul 2023 08:08:57 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2b6ff1ada5dso93010101fa.2 for ; Tue, 11 Jul 2023 08:08:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1689088135; x=1691680135; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ELbRN/LifTQ/7zfClfcRkCTRTEOE/j2wLv/6DGZBUz4=; b=bHShCj9WG6pWGVLraRILWTJ5Y6Mng+dA241HQjJRiFC35Gq1C/o5NW6At9jKzg/rbX Zqokjm0nSV5C4DYOXykaXAsu32+8OkBgyjAE4UuMzsJqVnpFMREp+43yARPuzrWVvnqP 4JSK+5PwF1fY/5hcE/B7w1V4JrnX142QDccqWs4eAZ83DYQ5Etg9/pJV+h9iwON/dpSb Efw8rDIr7GVWNglfdYQjccwsfKpqH7BhHMrA35G7xEoSGEh7G5fSwXA8dmLiDufUwcfk nVvAKnFlI6ihu4nxJpkF4BAHv//PG48mX8nsoijXRUKtIQJT+JCQjVflSVZvglMin8TM Og3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689088135; x=1691680135; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ELbRN/LifTQ/7zfClfcRkCTRTEOE/j2wLv/6DGZBUz4=; b=ioM9naAuAWpxPtKMlNoFbraHdU9uRkufgqUv5qYoOMS4AlETX/4xViHw5bbEhhviA0 yQWnuXZdw7DfcnQP3XRF+/2sNJvH6DC0oJ++BcdZFJ3NYEevWzpI7/bKDpAVu7MePiY7 o8TncjdshNJnpn/11jA9xgfGNSDX5zbYr33U7x8NzuLmY6Vue9hKGmd2ymXqcv8ELAxz GYgwBm9izWijntf4oTQYkKK6pWRNumoFdPXa4K9kui92wJs45WxnFqtV+3oBlOjJq/Sm IavzxX1SjrFjJfaqccZIpRLY56MEExcRBtSPoCGRbShK/suvT9zo74gdt3NAA0pP1kG/ emaQ== X-Gm-Message-State: ABy/qLZMYy020uTFyIN3KTO18ZPKDZ2fGUfWrjhMaNXsSC8ZdFPGbHJI D4Z9A2hRYmX7JpEkwewMITLl15OPUuux9V075rbCHA== X-Received: by 2002:a2e:b0c6:0:b0:2b6:fa3f:9230 with SMTP id g6-20020a2eb0c6000000b002b6fa3f9230mr11813753ljl.46.1689088135367; Tue, 11 Jul 2023 08:08:55 -0700 (PDT) MIME-Version: 1.0 References: <20230616063210.19063-1-eric.lin@sifive.com> <20230616063210.19063-3-eric.lin@sifive.com> <20230616-revision-speed-a83dc926b334@wendy> <74385f9d-ed8d-8906-13e3-b3091dae7993@codethink.co.uk> In-Reply-To: <74385f9d-ed8d-8906-13e3-b3091dae7993@codethink.co.uk> From: Eric Lin Date: Tue, 11 Jul 2023 23:08:44 +0800 Message-ID: Subject: Re: [PATCH 2/3] soc: sifive: Add SiFive private L2 cache PMU driver To: Ben Dooks Cc: will@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Conor Dooley Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Hi Ben, On Tue, Jul 11, 2023 at 4:41=E2=80=AFPM Ben Dooks wrote: > > On 20/06/2023 04:14, Eric Lin wrote: > > On Fri, Jun 16, 2023 at 6:13=E2=80=AFPM Conor Dooley wrote: > >> > >> On Fri, Jun 16, 2023 at 02:32:09PM +0800, Eric Lin wrote: > >>> From: Greentime Hu > >>> > >>> This adds SiFive private L2 cache PMU driver. User > >>> can use perf tool to profile by event name and event id. > >>> > >>> Example: > >>> $ perf stat -C 0 -e /sifive_pl2_pmu/inner_acquire_block_btot/ > >>> -e /sifive_pl2_pmu/inner_acquire_block_ntob/ > >>> -e /sifive_pl2_pmu/inner_acquire_block_ntot/ ls > >>> > >>> Performance counter stats for 'CPU(s) 0': > >>> > >>> 300 sifive_pl2_pmu/inner_acquire_block_btot/ > >>> 17801 sifive_pl2_pmu/inner_acquire_block_ntob/ > >>> 5253 sifive_pl2_pmu/inner_acquire_block_ntot/ > >>> > >>> 0.088917326 seconds time elapsed > >>> > >>> $ perf stat -C 0 -e /sifive_pl2_pmu/event=3D0x10001/ > >>> -e /sifive_pl2_pmu/event=3D0x4001/ > >>> -e /sifive_pl2_pmu/event=3D0x8001/ ls > >>> > >>> Performance counter stats for 'CPU(s) 0': > >>> > >>> 251 sifive_pl2_pmu/event=3D0x10001/ > >>> 2620 sifive_pl2_pmu/event=3D0x4001/ > >>> 644 sifive_pl2_pmu/event=3D0x8001/ > >>> > >>> 0.092827110 seconds time elapsed > >>> > >>> Signed-off-by: Greentime Hu > >>> Signed-off-by: Eric Lin > >>> Reviewed-by: Zong Li > >>> Reviewed-by: Nick Hu > >>> --- > >>> drivers/soc/sifive/Kconfig | 9 + > >>> drivers/soc/sifive/Makefile | 1 + > >>> drivers/soc/sifive/sifive_pl2.h | 20 + > >>> drivers/soc/sifive/sifive_pl2_cache.c | 16 + > >>> drivers/soc/sifive/sifive_pl2_pmu.c | 669 +++++++++++++++++++++++= +++ > >> > >> Perf drivers should be in drivers/perf, no? > >> > > > > Hi Conor, > > > > Yes, I see most of the drivers are in the drivers/perf. > > > > But I grep perf_pmu_register(), it seems not all the pmu drivers are > > in drivers/perf as below: > > > > arch/arm/mach-imx/mmdc.c:517: ret =3D > > perf_pmu_register(&(pmu_mmdc->pmu), name, -1); > > arch/arm/mm/cache-l2x0-pmu.c:552: ret =3D > > perf_pmu_register(l2x0_pmu, l2x0_name, -1); > > ... > > drivers/dma/idxd/perfmon.c:627: rc =3D perf_pmu_register(&idxd_pmu->pmu= , > > idxd_pmu->name, -1); > > drivers/fpga/dfl-fme-perf.c:904:static int > > fme_perf_pmu_register(struct platform_device *pdev, > > drivers/fpga/dfl-fme-perf.c:929: ret =3D perf_pmu_register(pmu, = name, -1); > > ... > > drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c:549: ret =3D > > perf_pmu_register(&pmu_entry->pmu, pmu_name, -1); > > drivers/gpu/drm/i915/i915_pmu.c:1190: ret =3D > > perf_pmu_register(&pmu->base, pmu->name, -1); > > drivers/hwtracing/coresight/coresight-etm-perf.c:907: ret =3D > > perf_pmu_register(&etm_pmu, CORESIGHT_ETM_PMU_NAME, -1); > > drivers/hwtracing/ptt/hisi_ptt.c:895: ret =3D > > perf_pmu_register(&hisi_ptt->hisi_ptt_pmu, pmu_name, -1); > > drivers/iommu/intel/perfmon.c:570: return > > perf_pmu_register(&iommu_pmu->pmu, iommu_pmu->pmu.name, -1); > > drivers/nvdimm/nd_perf.c:309: rc =3D perf_pmu_register(&nd_pmu->pmu, > > nd_pmu->pmu.name, -1); > > ... > > > > I just wondering what kind of pmu drivers should be in drivers/perf > > and what kind of pmu drivers should not be in drivers/perf. > > Thanks. > > > > Given the registers for the l2 cache controls and l2 pmu don't overlap > do we need the pmu and general cache drivers together? > From Will's suggestion, I'll put the pl2 pmu driver to drivers/perf in v2. Thanks. Best Regards, Eric Lin. > -- > Ben Dooks http://www.codethink.co.uk/ > Senior Engineer Codethink - Providing Genius > > https://www.codethink.co.uk/privacy.html >