From: Mark Rutland <mark.rutland@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Tuan Phan <tuanphan@amperemail.onmicrosoft.com>,
Tuan Phan <tuanphan@os.amperecomputing.com>,
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.
Date: Wed, 1 Apr 2020 12:19:03 +0100 [thread overview]
Message-ID: <20200401111903.GC17163@C02TD0UTHF1T.local> (raw)
In-Reply-To: <20200401102724.GA17575@willie-the-truck>
On Wed, Apr 01, 2020 at 11:27:25AM +0100, 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:
> > > > On Mar 20, 2020, at 4:25 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > > > On Thu, Mar 19, 2020 at 12:03:43PM -0700, Tuan Phan wrote:
> > > >>> On Mar 19, 2020, at 8:16 AM, Mark Rutland <mark.rutland@arm.com> 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.
>
> 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.
Ok. So long as each of the contexts are migrated before the IRQ is, I
think that's sound. Otherwise there's a small window where the IRQ
handler for an instance won't see the state expected (and could end up
treated as a screaming IRQ).
Otherwise, in that case I think that's not so bad.
> > Note that it's also missing IRQF_NOBALANCING, which is also necessary to
> > avoid such issues.
>
> unsigned long flags = IRQF_NOBALANCING | IRQF_SHARED | IRQF_NO_THREAD;
>
> so it looks like IRQF_NOBALANCING is already taken care of.
Whoops; I'd misread thhe DMC-620 code above assuming it was the SMMUv3
PMU.
Thanks,
Mark.
prev parent reply other threads:[~2020-04-01 11:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 0:29 [PATCH] driver/perf: Add PMU driver for the ARM DMC-620 memory controller Tuan Phan
2020-03-18 16:02 ` Jonathan Cameron
2020-03-18 20:23 ` Will Deacon
2020-03-19 1:34 ` Shaokun Zhang
2020-03-19 3:01 ` Tuan Phan
2020-03-19 15:16 ` Mark Rutland
[not found] ` <23AD5E45-15E3-4487-9B0D-0D9554DD9DE8@amperemail.onmicrosoft.com>
2020-03-20 7:59 ` Will Deacon
2020-03-20 11:25 ` Mark Rutland
[not found] ` <A50AA800-3F65-4761-9BCF-F86A028E107D@amperemail.onmicrosoft.com>
2020-04-01 8:11 ` Will Deacon
2020-04-01 9:52 ` Mark Rutland
2020-04-01 10:27 ` Will Deacon
2020-04-01 11:12 ` Robin Murphy
2020-04-01 11:27 ` Mark Rutland
2020-04-01 11:57 ` Robin Murphy
2020-04-01 11:19 ` Mark Rutland [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200401111903.GC17163@C02TD0UTHF1T.local \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tuanphan@amperemail.onmicrosoft.com \
--cc=tuanphan@os.amperecomputing.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox