Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1475291ybb; Thu, 9 Apr 2020 02:56:16 -0700 (PDT) X-Google-Smtp-Source: APiQypLpv7YL4kM/SRHMxlZegXt+UxHaTB6NwmfR7BinP8BL4Yx96CEuw80Hbd50VbiSnwwayhrB X-Received: by 2002:a05:6808:118:: with SMTP id b24mr380425oie.47.1586426176345; Thu, 09 Apr 2020 02:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586426176; cv=none; d=google.com; s=arc-20160816; b=LOjiOJFO26iz/Z7qXvibIHHBZVfQuI513hKIpRSqR0V5Hud5rFdqLAYiCEUAgTtvYd FRrdxPTV7rN6cuUo2DRm+Dv1VECxLirgpIgSoyQ4NKXdRpgubp5LHGAHKn7sJzLHUaKx p4AZ8UuIU9Voaj0PdPoVT4RBynPjckQB9MsjlJOzYE0jAN/Hm5nlTha6LZX/36i/v2wj SKkVUNiEkJq2oUCTSH23n8h8SFhCl3e4ytpgSYJiWXbXxBeSYpwjR0ou6ZXD7k+ZpStv O20orOxi/8lQmhNQEKhjmFLOuvoKxMXJEw9YZO5ntItJ2xOVMV/x6o9R4JzB72xag4hc Yaow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=MnTw/TLFKNKflc/6iM4na8HybeYtM7nGNu3x9QV5cQ8=; b=TG4a2zoftpLXGicaiyrV8IBZ/PKtzuSIktjKiow3XPCVMxQ9fImBvvoYPWBFl2EbJp hNlpWPwz6CS+4yDMuarnHdOmu/ozW6ogvMDMp4V/iYMraPdKw40LFWq5bZfAzjgYOA4J KYGemTRYrejXr2dig224iHkBfig8/rv7y4hNuPWRNARJPjXhPs6u2AhTjkilAefDEr2X iWwsXL2gwHFukcYB363jSpakfUnkxzK18I/gmPlLJtyOb6MWtkFN31LNLKh8VkpO2yz6 NGkbsVNXqiKl/6iSqF2BsW+fU8taWM2ouxt1Ft0DxB7cDbQTzyLsYzqyn63zrE+9lPWD NH0A== 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 d27si3594615ote.88.2020.04.09.02.56.01; Thu, 09 Apr 2020 02:56:16 -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 S1726749AbgDIJyP (ORCPT + 99 others); Thu, 9 Apr 2020 05:54:15 -0400 Received: from foss.arm.com ([217.140.110.172]:47778 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726632AbgDIJyP (ORCPT ); Thu, 9 Apr 2020 05:54:15 -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 6183431B; Thu, 9 Apr 2020 02:54:15 -0700 (PDT) Received: from [10.57.55.221] (unknown [10.57.55.221]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 106B33F73D; Thu, 9 Apr 2020 02:54:13 -0700 (PDT) Subject: Re: [RFC PATCH] perf/smmuv3: Fix shared interrupt handling To: John Garry , "will@kernel.org" , "mark.rutland@arm.com" Cc: "linux-arm-kernel@lists.infradead.org" , Shameerali Kolothum Thodi , "harb@amperecomputing.com" , "tuanphan@os.amperecomputing.com" , "linux-kernel@vger.kernel.org" References: <34dd7c2e-b6db-684f-f0a2-73f2e6951308@huawei.com> From: Robin Murphy Message-ID: <6bd103f2-1034-60f0-53a3-17162400a452@arm.com> Date: Thu, 9 Apr 2020 10:54:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <34dd7c2e-b6db-684f-f0a2-73f2e6951308@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@arm.com/