From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 597D0C2BB55 for ; Thu, 9 Apr 2020 09:54:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3644F214D8 for ; Thu, 9 Apr 2020 09:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgDIJyP (ORCPT ); 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/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DE93C2BB55 for ; Thu, 9 Apr 2020 10:00:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B5482074F for ; Thu, 9 Apr 2020 10:00:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IYljhn99" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B5482074F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=me/Kc1z4b7+cPe8yVgtcrHeAVJK7Lv9AdAF7xS6ZzQc=; b=IYljhn99652haGAKHdgiTb9i1 ysM2yIozRgN1tatM0aLO5KeloGJ10jmYsdVPrkUFghm6pkWmlLDPSkJUBgg3N9dlhLbJ+aewciUlc e2Ax4jRq35iUodreclE35XxH8WeVYlrWPkFCbwclKQueAKep0nDDUJQS18dth5O75JxmZO/bQPNgG 5GMngSbed9kFuaUWiMf0uo2QG3pFC1MJPKt5F/tktQIyLJSpLg8A55e+BegxRmJBzUQdPEGFhFLds gNQMztkJZnlROK/AMfdEuiq0AoQrj0ZM8OcvFxQKaSHh3Y9auudwLA2X8rtquiwDbeCG+nOaZQNyF 2ggL99nwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jMTt6-0007qQ-3y; Thu, 09 Apr 2020 09:54:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jMTt2-0007pv-7w for linux-arm-kernel@lists.infradead.org; Thu, 09 Apr 2020 09:54:17 +0000 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" 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-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200409_025416_326821_D6E300E2 X-CRM114-Status: GOOD ( 12.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "harb@amperecomputing.com" , "tuanphan@os.amperecomputing.com" , Shameerali Kolothum Thodi , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org T24gMjAyMC0wNC0wOSA4OjAyIGFtLCBKb2huIEdhcnJ5IHdyb3RlOgo+IE9uIDA4LzA0LzIwMjAg MTc6NDksIFJvYmluIE11cnBoeSB3cm90ZToKPj4gSVJRRl9TSEFSRUQgaXMgZGFuZ2Vyb3VzLCBz aW5jZSBpdCBhbGxvd3Mgb3RoZXIgYWdlbnRzIHRvIHJldGFyZ2V0IHRoZQo+PiBJUlEncyBhZmZp bml0eSB3aXRob3V0IG1pZ3JhdGluZyBQTVUgY29udGV4dHMgdG8gbWF0Y2gsIGJyZWFraW5nIHRo ZSB3YXkKPj4gaW4gd2hpY2ggcGVyZiBtYW5hZ2VzIG11dHVhbCBleGNsdXNpb24gZm9yIGFjY2Vz c2luZyBldmVudHMuIEFsdGhvdWdoCj4+IHRoaXMgbWVhbnMgaXQncyBub3QgcmVhbGlzdGljYWxs eSBwb3NzaWJsZSB0byBzdXBwb3J0IFBNVSBJUlFzIGJlaW5nCj4+IHNoYXJlZCB3aXRoIG90aGVy IGRyaXZlcnMsIHdlICpjYW4qIGhhbmRsZSBzaGFyaW5n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