Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp503418ybb; Wed, 1 Apr 2020 04:28:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvXZV3KNV93/a0RHjYmmF57eyG9b9Q7PnvRT/HigI+yaiLYNTzQvIoKnLWf5dks0MR2r6DG X-Received: by 2002:a9d:75d5:: with SMTP id c21mr10776231otl.223.1585740507157; Wed, 01 Apr 2020 04:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585740507; cv=none; d=google.com; s=arc-20160816; b=KKCnYdZfvyHfhS9hcy90vusS3hm7AXdu+h+mrFtkWHS2RYs/yWZgSTYS9xeOq3J/2G 8Qx7zElqUGTdb0KemaYnWSg7mHJa1K0ZPODxZTGA5rVTE6WFfpe2vH2RZbKAKceeD6mL kMWkwQfjMEf1C5Zs0HMfxqmaFL9dLNQLyRWbh8Umb56AYsbR7FcjMehFuZH54BvjLL/0 mktvRmtTf+3ZcSKmecrJjVO8u4fWxmknV2tw1R8tfuU7NfNDMtdcjqu6n+AyyzDSRdan E2Y1RQ2xkHqOwigCPt/oBxaudTKU9bTlXezU6JSJLhuZP+GgeCsb5vDeiDHsKn7HdTOh GMsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=B8WxRS7HthlQtvfl4Xk6MmUSEDt9dJgsbGGs6bCgHGg=; b=BW0EiCPmwqEFi5RmXF+zs6V2Bk2/7Q2ZYsEQ+Mll9YwZ+h+AJeVllmLCqAnBgcwDT3 xaeLGKu+e/tF555FEa9xzrxVYz3iFePVATaJ1r5r3cKSTP2GXMhjHnKeykdqbSOdPxJu sGuo/3uVm9J+4X1bIF2QVSJUHiOzo/n3KS8Ih8ZNk43XyUbcXWwtMMy4uP993UXDXo1i xStBSYuefc090nTLUA0DB+HZtiI4yQqG8virkCcztV8dk/dpfsnW2pT2whc7MHUfF2oL y8EK9Omb2AiqJLkdwgDxDBhR0EY9MtdVKqmw4DcfFrBCK8N5GwoFzAq0tN3/YICZKWBp Gz+A== 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 q10si763570oij.227.2020.04.01.04.28.14; Wed, 01 Apr 2020 04:28:27 -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 S1732244AbgDAL1q (ORCPT + 99 others); Wed, 1 Apr 2020 07:27:46 -0400 Received: from foss.arm.com ([217.140.110.172]:49442 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732026AbgDAL1q (ORCPT ); Wed, 1 Apr 2020 07:27:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0995930E; Wed, 1 Apr 2020 04:27:44 -0700 (PDT) Received: from C02TD0UTHF1T.local (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5AF783F68F; Wed, 1 Apr 2020 04:27:42 -0700 (PDT) Date: Wed, 1 Apr 2020 12:27:39 +0100 From: Mark Rutland To: Robin Murphy Cc: Will Deacon , Tuan Phan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tuan Phan Subject: Re: [PATCH] driver/perf: Add PMU driver for the ARM DMC-620 memory controller. Message-ID: <20200401112739.GD17163@C02TD0UTHF1T.local> References: <1584491381-31492-1-git-send-email-tuanphan@os.amperecomputing.com> <20200319151646.GC4876@lakrids.cambridge.arm.com> <23AD5E45-15E3-4487-9B0D-0D9554DD9DE8@amperemail.onmicrosoft.com> <20200320105315.GA35932@C02TD0UTHF1T.local> <20200401095226.GA17163@C02TD0UTHF1T.local> <20200401102724.GA17575@willie-the-truck> <4d843ec7-ed74-4431-d8c7-d5aa6bd83c18@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d843ec7-ed74-4431-d8c7-d5aa6bd83c18@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 01, 2020 at 12:12:23PM +0100, Robin Murphy wrote: > On 2020-04-01 11:27 am, Will Deacon wrote: > > On Wed, Apr 01, 2020 at 10:52:26AM +0100, Mark Rutland wrote: > > > On Tue, Mar 31, 2020 at 03:14:59PM -0700, Tuan Phan wrote: > > > > I looked at the SMMUv3 PMU driver and it also uses IRQF_SHARED. SMMUv3 > > > > PMU and DMC620 PMU are very much similar in which counters can be > > > > accessed by any cores using memory map. Any special reasons > > > > IRQF_SHARED works with SMMUv3 PMU driver? > > > > > > No; I believe that is a bug in the SMMUv3 PMU driver. If the IRQ were > > > shared, and another driver that held the IRQ changed the affinity, > > > things would go very wrong. > > > > I *think* the idea is that the SMMUv3 PMU driver manages multiple PMCG > > devices, which may all share an irq line, rather than the irq line being > > shared by some other driver that might change the affinity. So I suspect > > dropping IRQF_SHARED will break things. > > Each PMCG is conceptually a distinct PMU with its own interrupt - for > instance, MMU-600 has one PMCG for its TCU and one for each TBU, each with a > distinct interrupt output signal. Of course, integrators can and will mash > them all together into a single SPI (particularly since they're all part of > "the SMMU"), but that boils down to the same case as here. > > This is going to continue to happen, so we could really do with figuring out > a way to let MMIO system PMU drivers properly cope with shared interrupts in > general :/ It does seem so, but I think we can only reasonably do that where it's only being shared across instances of the same driver, rather than when the IRQ is muxed across completely independent drivers. I'd like to avoid that latter case if we can. The driver would have to handle migration on a cross-instance basis. e.g. all the contexts need to be migrated before the IRQ is, to avoid a screaming IRQ on the target CPU, or the IRQ handler on the target racing with migration from the source. Is there a neat way to do that in a driver without using IRQF_SHARED, so that we don't end up accidentally sharing with other drivers? We can probably librify the code to handle this under drivers/pmu/. Thanks, Mark.