From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH v7 2/4] perf/smmuv3: Add arm64 smmuv3 pmu driver Date: Thu, 4 Apr 2019 16:30:20 +0100 Message-ID: <20190404153020.GD27558@fuggles.cambridge.arm.com> References: <20190326151753.19384-1-shameerali.kolothum.thodi@huawei.com> <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> Sender: linux-kernel-owner@vger.kernel.org To: Shameer Kolothum Cc: lorenzo.pieralisi@arm.com, robin.murphy@arm.com, andrew.murray@arm.com, jean-philippe.brucker@arm.com, mark.rutland@arm.com, guohanjun@huawei.com, john.garry@huawei.com, pabba@codeaurora.org, vkilari@codeaurora.org, rruigrok@codeaurora.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, neil.m.leeder@gmail.com List-Id: linux-acpi@vger.kernel.org On Tue, Mar 26, 2019 at 03:17:51PM +0000, Shameer Kolothum wrote: > From: Neil Leeder > > Adds a new driver to support the SMMUv3 PMU and add it into the > perf events framework. > > Each SMMU node may have multiple PMUs associated with it, each of > which may support different events. > > SMMUv3 PMCG devices are named as smmuv3_pmcg_ where > is the physical page address of the SMMU PMCG > wrapped to 4K boundary. For example, the PMCG at 0xff88840000 is > named smmuv3_pmcg_ff88840 > > Filtering by stream id is done by specifying filtering parameters > with the event. options are: > filter_enable - 0 = no filtering, 1 = filtering enabled > filter_span - 0 = exact match, 1 = pattern match > filter_stream_id - pattern to filter against > > Example: perf stat -e smmuv3_pmcg_ff88840/transaction,filter_enable=1, > filter_span=1,filter_stream_id=0x42/ -a netperf > > Applies filter pattern 0x42 to transaction events, which means events > matching stream ids 0x42 & 0x43 are counted as only upper StreamID > bits are required to match the given filter. Further filtering > information is available in the SMMU documentation. > > SMMU events are not attributable to a CPU, so task mode and sampling > are not supported. > > Signed-off-by: Neil Leeder > Signed-off-by: Shameer Kolothum > Reviewed-by: Robin Murphy > --- > drivers/perf/Kconfig | 9 + > drivers/perf/Makefile | 1 + > drivers/perf/arm_smmuv3_pmu.c | 776 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 786 insertions(+) > create mode 100644 drivers/perf/arm_smmuv3_pmu.c [...] > +static int smmu_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node) > +{ > + struct smmu_pmu *smmu_pmu; > + unsigned int target; > + > + smmu_pmu = hlist_entry_safe(node, struct smmu_pmu, node); > + if (cpu != smmu_pmu->on_cpu) > + return 0; > + > + target = cpumask_any_but(cpu_online_mask, cpu); > + if (target >= nr_cpu_ids) > + return 0; > + > + perf_pmu_migrate_context(&smmu_pmu->pmu, cpu, target); > + smmu_pmu->on_cpu = target; > + WARN_ON(irq_set_affinity(smmu_pmu->irq, cpumask_of(target))); I'm going to make this (and the other invocation) use irq_set_affinity_hint() instead, so that we can build this driver as a module with the appropriate Kconfig tweak. Will From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62F2BC4360F for ; Thu, 4 Apr 2019 15:30:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 130172082E for ; Thu, 4 Apr 2019 15:30:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MFgykPMN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 130172082E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rR2wSiCVMVS8YGE2kC6GbILUA31GbMS/PzhWaXunDds=; b=MFgykPMNNqrVga /S9BtgCffj32ZXFo/i4TTe1pvqIfI022nAHHUhmUxjwhr5CiuKd+XDi9RWQdzT5VGEUIsqHOjPf96 6f6QNUxezCAGhWWKxb8PkeOcjV/69WUvt2j/zTwO4XPOSXAjyZZQYi6MpABND7mdD8rNeWKJ0tDDP OFjbt4qHycEg067l3/9GHM7yPZ5AFoBzv0YJ2ksyCjGFuBTp92ceq4qwOYLGhk6EeXWw3lZcwCUPW S2syMslKD3djbPOLsid2tvzB5R4jsIHgHXHqvYnUps1R/0N0gswnQ8AHFGcyN7Fpk28eqG1kho7wS 7AfuK5X+2rU+e4HP54sw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC4K3-0005gJ-Ie; Thu, 04 Apr 2019 15:30:35 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC4Jw-0005fH-RW for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 15:30:34 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05BCD169E; Thu, 4 Apr 2019 08:30:26 -0700 (PDT) Received: from fuggles.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 584253F59C; Thu, 4 Apr 2019 08:30:23 -0700 (PDT) Date: Thu, 4 Apr 2019 16:30:20 +0100 From: Will Deacon To: Shameer Kolothum Subject: Re: [PATCH v7 2/4] perf/smmuv3: Add arm64 smmuv3 pmu driver Message-ID: <20190404153020.GD27558@fuggles.cambridge.arm.com> References: <20190326151753.19384-1-shameerali.kolothum.thodi@huawei.com> <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_083028_923799_A26AA661 X-CRM114-Status: GOOD ( 18.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, vkilari@codeaurora.org, lorenzo.pieralisi@arm.com, neil.m.leeder@gmail.com, jean-philippe.brucker@arm.com, pabba@codeaurora.org, john.garry@huawei.com, linuxarm@huawei.com, rruigrok@codeaurora.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, guohanjun@huawei.com, andrew.murray@arm.com, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 26, 2019 at 03:17:51PM +0000, Shameer Kolothum wrote: > From: Neil Leeder > > Adds a new driver to support the SMMUv3 PMU and add it into the > perf events framework. > > Each SMMU node may have multiple PMUs associated with it, each of > which may support different events. > > SMMUv3 PMCG devices are named as smmuv3_pmcg_ where > is the physical page address of the SMMU PMCG > wrapped to 4K boundary. For example, the PMCG at 0xff88840000 is > named smmuv3_pmcg_ff88840 > > Filtering by stream id is done by specifying filtering parameters > with the event. options are: > filter_enable - 0 = no filtering, 1 = filtering enabled > filter_span - 0 = exact match, 1 = pattern match > filter_stream_id - pattern to filter against > > Example: perf stat -e smmuv3_pmcg_ff88840/transaction,filter_enable=1, > filter_span=1,filter_stream_id=0x42/ -a netperf > > Applies filter pattern 0x42 to transaction events, which means events > matching stream ids 0x42 & 0x43 are counted as only upper StreamID > bits are required to match the given filter. Further filtering > information is available in the SMMU documentation. > > SMMU events are not attributable to a CPU, so task mode and sampling > are not supported. > > Signed-off-by: Neil Leeder > Signed-off-by: Shameer Kolothum > Reviewed-by: Robin Murphy > --- > drivers/perf/Kconfig | 9 + > drivers/perf/Makefile | 1 + > drivers/perf/arm_smmuv3_pmu.c | 776 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 786 insertions(+) > create mode 100644 drivers/perf/arm_smmuv3_pmu.c [...] > +static int smmu_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node) > +{ > + struct smmu_pmu *smmu_pmu; > + unsigned int target; > + > + smmu_pmu = hlist_entry_safe(node, struct smmu_pmu, node); > + if (cpu != smmu_pmu->on_cpu) > + return 0; > + > + target = cpumask_any_but(cpu_online_mask, cpu); > + if (target >= nr_cpu_ids) > + return 0; > + > + perf_pmu_migrate_context(&smmu_pmu->pmu, cpu, target); > + smmu_pmu->on_cpu = target; > + WARN_ON(irq_set_affinity(smmu_pmu->irq, cpumask_of(target))); I'm going to make this (and the other invocation) use irq_set_affinity_hint() instead, so that we can build this driver as a module with the appropriate Kconfig tweak. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel