Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1322437yba; Thu, 4 Apr 2019 08:31:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqx57YGEUyvn/Zkb+Qp6ixp8tNGYwRCvOfsdRqKAspw6q0ulkRUJK6JmzJw3YtKPi+W9RZHx X-Received: by 2002:a63:fa54:: with SMTP id g20mr6207653pgk.242.1554391885313; Thu, 04 Apr 2019 08:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554391885; cv=none; d=google.com; s=arc-20160816; b=Qdo9/Xp+5TcBUORdvAkUJzzC+DAheVOzlM0oRaWmkkDew4FKIYbHKAeA7JXcnUhbNR N9SYfNJh0GbDhBkDY7RUsjZEH1h71swBJqiN8ggZ6+X6dsQLJfn1hLc26b2TtarNSO2h 1tqoi31WbRsL6gU0bV+ZJ5YF3k+kgd08wHpb0hyidzjlCrZPMTQKsJlJ91DhKRij3Ufi mXIAoAO9Plt1RbXW/O+mVPIIw3s+D1JdNAd5DMgX1Jg34WVjkZX09L1BtJM1fm+Okw5E BXgKgSAHt940l5uD0LizcutJZh7zUpeZ/AhAnEqD+8UnPgnjg83aqwGGuGU2yefv2kmm +gBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9rIh+HfWS2tdDDhKldqq9wqT4x5XKo+YmzRF39mceMw=; b=Ri2oGWv4aOQbO1aSBedDPOrPf0unHqU4We/2Rs5gNIO2Kxc0X+iB0pr0ITtEG0yytC wA5wbGAXsY6FKrgm9q4nRRY5cYw3n9ih6sYqF+bXov5IvMIIvGE3p7TSnagsKt3CD4S+ MEjOxpspXVdcZq6z/4c+l1PtF7YbX+XUHTbFwUS6VM3L+jeyfkhpdZTpkLpr5O3iaqUC gyo8vF5PFqlLL+X1yczpmRFntdpN2TvC6uMuXJkC6JTwllWrVbmDXF62WhE0c0z8uHMw ZUG6XiLskIXwoVdybX9uJiLws2OoSWj1n1cEXL/DiP14LlG5biepOYQg8m7Wwe/pA4w/ 6gdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si3475568pga.22.2019.04.04.08.31.08; Thu, 04 Apr 2019 08:31:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728211AbfDDPa1 (ORCPT + 99 others); Thu, 4 Apr 2019 11:30:27 -0400 Received: from foss.arm.com ([217.140.101.70]:34246 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725904AbfDDPa0 (ORCPT ); Thu, 4 Apr 2019 11:30:26 -0400 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 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 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326151753.19384-3-shameerali.kolothum.thodi@huawei.com> User-Agent: Mutt/1.11.1+86 (6f28e57d73f2) () Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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