From: Robin Murphy <robin.murphy@arm.com>
To: Chen Jun <chenjun102@huawei.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, zhangshaokun@hisilicon.com,
will@kernel.org, mark.rutland@arm.com
Cc: xuqiang36@huawei.com
Subject: Re: [PATCH 1/1] perf: hisi: Make irq shared
Date: Mon, 16 May 2022 15:30:19 +0100 [thread overview]
Message-ID: <bbf8f8e5-a959-dfd5-5e77-072af8bbd3ae@arm.com> (raw)
In-Reply-To: <20220516130500.39586-1-chenjun102@huawei.com>
On 2022-05-16 14:05, Chen Jun wrote:
> On some platforms, there are some error:
> genirq: Flags mismatch irq 23. 00010804 (xxx) vs. 00010804 (xxx)
>
> The reason is that there are more than one pmu nodes using the same
> irq number.
>
> Add IROF_SHARED when devm_request_irq.
You really need more than this to share an interrupt between multiple
PMUs correctly. Perf relies on IRQs being handled on event->cpu to
provide mutual exclusion - if another PMU comes along and moves the
interrupt affinity to a different CPU, the interrupt handler may update
the event state from that CPU simultaneously with a regular API call on
event->cpu also updating it, with potential corruption as a result.
For general solutions, one option is to add a layer of explicit
interrupt management like arm_dmc620_pmu (FWIW the original idea there
was to factor that out into common helpers anyway). It's possible that
IRQ affinity notifiers might work as an alternative approach too, but I
never got round to looking into that in detail.
Thanks,
Robin.
> Signed-off-by: Chen Jun <chenjun102@huawei.com>
> ---
> drivers/perf/hisilicon/hisi_uncore_pmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
> index 358e4e284a62..bcbd3b467f34 100644
> --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
> +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
> @@ -168,7 +168,7 @@ int hisi_uncore_pmu_init_irq(struct hisi_pmu *hisi_pmu,
> return irq;
>
> ret = devm_request_irq(&pdev->dev, irq, hisi_uncore_pmu_isr,
> - IRQF_NOBALANCING | IRQF_NO_THREAD,
> + IRQF_NOBALANCING | IRQF_NO_THREAD | IRQF_SHARED,
> dev_name(&pdev->dev), hisi_pmu);
> if (ret < 0) {
> dev_err(&pdev->dev,
prev parent reply other threads:[~2022-05-16 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 13:05 [PATCH 1/1] perf: hisi: Make irq shared Chen Jun
2022-05-16 14:30 ` Robin Murphy [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=bbf8f8e5-a959-dfd5-5e77-072af8bbd3ae@arm.com \
--to=robin.murphy@arm.com \
--cc=chenjun102@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
--cc=xuqiang36@huawei.com \
--cc=zhangshaokun@hisilicon.com \
/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