Re: [RFC PATCH] perf/smmuv3: Fix shared interrupt handling

From: Robin Murphy
Date: Thu Apr 09 2020 - 05:55:28 EST


On 2020-04-09 8:02 am, John Garry wrote:
On 08/04/2020 17:49, Robin Murphy wrote:
IRQF_SHARED is dangerous, since it allows other agents to retarget the
IRQ's affinity without migrating PMU contexts to match, breaking the way
in which perf manages mutual exclusion for accessing events. Although
this means it's not realistically possible to support PMU IRQs being
shared with other drivers, we *can* handle sharing between multiple PMU
instances with some explicit affinity bookkeeping and manual interrupt
multiplexing.

Hi Robin,

Out of curiosity, do we even need to support shared interrupts for any implementations today?

Not that I know of, but we need the mitigation in general for future drivers[1], and since this one already had a suspicious IRQF_SHARED it was the ideal victim for prototyping. I haven't dared ask about Ampere's SMMU story... :)

D06 board:

john@ubuntu:~$ more /proc/interrupts | grep smmuv3-pmu

Â989: 0 0 0 0 ITS-pMSI 133120 Edge smmuv3-pmu
Â990: 0 0 0 0 ITS-pMSI 135168 Edge smmuv3-pmu
Â991: 0 0 0 0 ITS-pMSI 137216 Edge smmuv3-pmu
Â992: 0 0 0 0 ITS-pMSI 139264 Edge smmuv3-pmu
Â993: 0 0 0 0 ITS-pMSI 141312 Edge smmuv3-pmu
Â994: 0 0 0 0 ITS-pMSI 143360 Edge smmuv3-pmu
Â995: 0 0 0 0 ITS-pMSI 145408 Edge smmuv3-pmu
Â996: 0 0 0 0 ITS-pMSI 147456 Edge smmuv3-pmu

Yeah, MSIs are the best way to defeat any interrupt wiring!

Robin.

[1] https://lore.kernel.org/linux-arm-kernel/3efa118a-5c85-6af9-e676-44087f1d398e@xxxxxxx/