Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp553721ybt; Wed, 24 Jun 2020 05:54:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpATjaozjCPPSf72D5rC/dklPNqurf8+HQAmWyZp2dlDt97IfVkxmcfNDsbui9W+1SDk8W X-Received: by 2002:aa7:c314:: with SMTP id l20mr11669560edq.150.1593003251249; Wed, 24 Jun 2020 05:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593003251; cv=none; d=google.com; s=arc-20160816; b=pe1VvRGrfekdX+etIWvURCnFQjPvHy1jv38vZP6FgGG16V9aFlXHTCGhjsr0vaG6wG XAm+kM5vxAUarz6v1hlFXfMAoHI8fRTX80DPTyZlymMiFYygA5BO/RCrVxGyqhN5HsGF gJv5Z68OMQz5uIwdB50f0GYP8nWxQ56Ie1lGQjHymJ4fk1pE0WZDzlBMs0sjuXjd/4vS e5hEI8v7YJ2i+LJnr8YNyp1TR+5v/UTpruru9aWZW6lhGjr/nFzw7xkM7/hieOziqxPx 4q1N6/fAAVkxgFp3IvQrdI4JIoN9Rur7OhwajN00FI4fS445F0jffBW0im9xTtBn+2aO Ybrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=g9z4dtfLHfrgP5TFQMVxfPk+wrRm1ACjCraUqBNwz54=; b=ab4MXgIPSLYG01/v8H7TzUISNDTRcbSWwTBZOjiUYylrgEuYapTuchr11evTJuTsIt uM39xTbvWQQHDssNNYnptg4Z3KTM2YWCmwLS+cF01JVwwdPrLj1NHmy2rePIUNpmHORM UjeysKU+G5zwbegM2Z9inhqXA69tq5Wjk407ei/94+tRQ6GDauWBtj7UR0Tmurtrjym+ d+E1S1HwB0ccX2k2Mqqm/UksreDHLoqvt3PrrPOqPS31rLd+rBl0orO1edPBvTHVoYxb Lw15txgJvnaUzE1iPMJf1XGtupDxfS5HetwC+fQzGCcaZWmpfi22N1ZLRpN67cDlTxQg 2hDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KexdEXaj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si7500905eju.736.2020.06.24.05.53.47; Wed, 24 Jun 2020 05:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KexdEXaj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390865AbgFXMux (ORCPT + 99 others); Wed, 24 Jun 2020 08:50:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:42576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390845AbgFXMuu (ORCPT ); Wed, 24 Jun 2020 08:50:50 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 02E2620663; Wed, 24 Jun 2020 12:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593003050; bh=+Kf1QO6wgC2hEGOUt0o6CDJuByakQhbWMS2qb5q4egs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KexdEXajkBXXkeJHwCLviB9dTD51SZqHb8XJi6GVgBXNgsjULPBftkc0BH5bpeWLE E8ijx24xCKlZTug1Mtc61oVCw2GfLQGPm4rpURBMcYk7gsgmS1LgtS4pFkij1G+v4C Ctyam3S+A5Wq516L02qIULTEP32y9k3tu/CqGMqc= Date: Wed, 24 Jun 2020 13:50:46 +0100 From: Will Deacon To: Robin Murphy Cc: mark.rutland@arm.com, tuanphan@os.amperecomputing.com, john.garry@huawei.com, linux-kernel@vger.kernel.org, shameerali.kolothum.thodi@huawei.com, harb@amperecomputing.com, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH] perf/smmuv3: Fix shared interrupt handling Message-ID: <20200624125045.GC6270@willie-the-truck> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 12:48:14PM +0100, Robin Murphy wrote: > On 2020-04-08 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. > > > > RCU helps us handle interrupts efficiently without having to worry about > > fine-grained locking for relatively-theoretical race conditions with the > > probe/remove/CPU hotplug slow paths. The resulting machinery ends up > > looking largely generic, so it should be feasible to factor out with a > > "system PMU" base class for similar multi-instance drivers. > > > > Signed-off-by: Robin Murphy > > --- > > > > RFC because I don't have the means to test it, and if the general > > approach passes muster then I'd want to tackle the aforementioned > > factoring-out before merging anything anyway. > > Any comments on whether it's worth pursuing this? Sorry, I don't really get the problem that it's solving. Is there a crash log somewhere I can look at? If all the users of the IRQ are managed by this driver, why is IRQF_SHARED dangerous? Will