Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp429424ybb; Wed, 1 Apr 2020 02:53:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv6fjRxTwF2QZmNzrCnqw6qdse+zIdMDBAE8tKivl3+8I0m8TOUj/1qyXdf/neAEV6L5+ZG X-Received: by 2002:a05:6830:6:: with SMTP id c6mr6200033otp.84.1585734825882; Wed, 01 Apr 2020 02:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585734825; cv=none; d=google.com; s=arc-20160816; b=O3XF1cUFDaJKSFWskgmt3qZUBFkE+fS4lGYHCDedu2sX2IUl3EqRz6MO4JWRvI21D6 DxNS7ORIrkHxe1cVNpSy7bcB3YmdInzUby36smrkf04/yO4IF2gYo0inlluiz5EU5m0p ZOYlAPqIVG4v6ZYnA9TXJxMO0RuyZYZA6+UzDCFWHfbkdD6cw/iHjw+npEEN2j7y/BC4 8HaL3Km063q6cry6/7pdIjkRiAo6ZrkYMuRgCVZMGwPa21ohd0LBNwclLjgq/z9lFK1L Tppr+HxkmX32w/FNG2wL4gLoAAOoM/F+HNm/ZWPGlVXkRASkVIHRKhU3elXAIijz4dU7 wSfQ== 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=+0AQ+QkjOD1oYmbqCaOnFr40zx8HpGT75qy5DGIIyEI=; b=aSoSMZr3j8B9AZvfPta1O4rYEctUxpl6L8jZ6xlW7UhOml7u7vzfjnD/xCFhmyj/XE GLs+4rFCc4OK6vl1jUL+soss99laBzNQV+5awcpqobzCX8GzCoBXfg+6lEJLxIgTaPCG Brr6y+RX3ZobjpEAt3UdSSft+3R7dpLea+CdQ7RRAWVQqJmf2/cHal5Ci5X1gsUHzJjd wsHp27E9RhiciMRCRboStfiRDKUWQlwNlvOAp25MIGYNJZ54vzOv6GiveHzwSBwQVKni MDCrlWpuIiwtnchRDB7DKKRgX9bI/Uu4/si/62znk+S8iBNR/AAO5VsJzYDedQ7fAaPv P+TA== 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 m205si695268oib.116.2020.04.01.02.53.32; Wed, 01 Apr 2020 02:53:45 -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 S1731715AbgDAJwg (ORCPT + 99 others); Wed, 1 Apr 2020 05:52:36 -0400 Received: from foss.arm.com ([217.140.110.172]:47414 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725860AbgDAJwg (ORCPT ); Wed, 1 Apr 2020 05:52:36 -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 EDB611FB; Wed, 1 Apr 2020 02:52:35 -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 96DBF3F52E; Wed, 1 Apr 2020 02:52:34 -0700 (PDT) Date: Wed, 1 Apr 2020 10:52:26 +0100 From: Mark Rutland To: Tuan Phan Cc: Tuan Phan , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] driver/perf: Add PMU driver for the ARM DMC-620 memory controller. Message-ID: <20200401095226.GA17163@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 03:14:59PM -0700, Tuan Phan wrote: > > On Mar 20, 2020, at 4:25 AM, Mark Rutland wrote: > > On Thu, Mar 19, 2020 at 12:03:43PM -0700, Tuan Phan wrote: > >>> On Mar 19, 2020, at 8:16 AM, Mark Rutland wrote: > >>> On Tue, Mar 17, 2020 at 05:29:38PM -0700, Tuan Phan wrote: > >>>> +static int arm_dmc620_pmu_dev_init(struct arm_dmc620_pmu *dmc620_pmu) > >>>> +{ > >>>> + struct platform_device *pdev = dmc620_pmu->pdev; > >>>> + int ret; > >>>> + > >>>> + ret = devm_request_irq(&pdev->dev, dmc620_pmu->irq, > >>>> + arm_dmc620_pmu_handle_irq, > >>>> + IRQF_SHARED, > >>>> + dev_name(&pdev->dev), dmc620_pmu); > >>> > >>> This should have IRQF_NOBALANCING | IRQF_NO_THREAD. I don't think we > >>> should have IRQF_SHARED. > >> => I agree on having IRQF_NOBALANCING and IRQF_NO_THREAD. But > >> IRQF_SHARED is needed. In our platform all DMC620s share same IRQs and > >> any cpus can access the pmu registers. > > > > Linux needs to ensure that the same instance is concistently accessed > > from the same CPU, and needs to migrate the IRQ to handle that. Given we > > do that on a per-instance basis, we cannot share the IRQ with another > > instance. > > > > Please feed back to you HW designers that muxing IRQs like this causes > > significant problems for software. > > 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. Note that it's also missing IRQF_NOBALANCING, which is also necessary to avoid such issues. Thanks, Mark.