Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1973544imi; Sun, 24 Jul 2022 02:59:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6RMAvmjOGlW6gksWVvkKlpIC1KClmNFnUPoX8evVDsxqAqYUQUWTshtStzV7GELt4LMlp X-Received: by 2002:a17:902:bb90:b0:16d:2d15:3a91 with SMTP id m16-20020a170902bb9000b0016d2d153a91mr7564500pls.4.1658656792299; Sun, 24 Jul 2022 02:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658656792; cv=none; d=google.com; s=arc-20160816; b=vl/c3eM4rZCa6iSPeuG2ytV8GYbDr5W9JZFJNY/ImoojPmk9q9X45Xw1S1AKaGTEoE 8VXHhVlzZhM6FSp3sTCu/r6y08RoLkqnfUg5TZNH9Gb2CaHCelPhlQTLo3jmJNFchqr6 VqQyBf9iacc5mOb3kLOIDa8FlSt3z9L+dGcf7nyzc0BOKL/dhC3O+YXvsJ7uZjtkjJ9U aBTjNfShOjZLH1sUYH1vIyrfdBmSyEPKxsGVYWPaK09YFO/9jEiFkSZbqgVPeOZMCtlQ R8jtSYJWmM4hGYK0e0wnLunYMzCglC3rirx7j7/kfGd7efNWi5RfnFdODSQI9/Ah8KYK y/og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=PCi7s7LoEQ4FddJW+imQWulrel5/W8stXFM6Cgdg1Yk=; b=jyY6geQ4pzhGxldr+TXIdgZNLafGyUFBzqHGhb/0adG8eefBMwSs/vo5QCAGrmOHh9 lAizDmcE0gWNdiFtXRprQP338THetLniA4jG69Yym3HmaWUGfwsuMbzDyLXcGUbfZ27Z R37cAvdQAtd8CDBHz/cYPZgt7L2Xx8PqG/j4/bNBWUyZs/hbIO7UKUAnb+zH+YUtYjrw jxr1reo9OaxOD0Yz6FAZ7X5Y4NUjuUsYih9bAJMRgaOD5KbUcQ1eA/ooW25MeSN0VQY7 4KN/nXsdmSkpNc7hjtkxjUDVAIOH6Ek1c/zUCEy8bfdMeQmv1pglK8MJKYkXCNxj3Cxe 9XqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fyljS77x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk3-20020a17090b4a0300b001efc839b577si15960306pjb.45.2022.07.24.02.59.38; Sun, 24 Jul 2022 02:59:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fyljS77x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233562AbiGXJiM (ORCPT + 99 others); Sun, 24 Jul 2022 05:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232296AbiGXJiL (ORCPT ); Sun, 24 Jul 2022 05:38:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0221AD9F; Sun, 24 Jul 2022 02:38:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1B4C061013; Sun, 24 Jul 2022 09:38:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71DD0C3411E; Sun, 24 Jul 2022 09:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658655489; bh=KrKl+Exk7EO9rz4eM8reLj7GOsUKUD28ZSdqeyG5vpk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fyljS77xbLXZFmMPet/TidUwO9v4ZY3gsR58ow+tulvmm/rBjkeBnI3eZW0pCY75H idpjWuLJCofj61aa4OS8841HgCQm7sg70BFwZVRpifGSDpNOAEgk8FE+oCCZzIAGBR mifQ4YCRz24BwkfD6/yJW/9ETI7I299jmyJnZmsPblkpVzNF4ZQ9cfaOBuhpV3lmMG nuajx9Tcf/2WHdChlDbJcgasIdL5EB9ys/3Q4UpgVG+aUVHjM/+Go9S6E3cA8risLT B9lag8r5TYwuodK7EVV83KizHkkIZJukNYnjwV4vzjOZSvDTSwgcbD5+18wHEeFELU O+h9NC3nzm70g== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oFY3r-009fDb-4r; Sun, 24 Jul 2022 10:38:07 +0100 Date: Sun, 24 Jul 2022 10:38:06 +0100 Message-ID: <877d42df5t.wl-maz@kernel.org> From: Marc Zyngier To: Bjorn Helgaas Cc: Pali =?UTF-8?B?Um9ow6Fy?= , Johan Hovold , Kishon Vijay Abraham I , Xiaowei Song , Binghui Wang , Thierry Reding , Ryder Lee , Jianjun Wang , linux-pci@vger.kernel.org, Krzysztof =?UTF-8?B?V2lsY3p5xYRza2k=?= , Ley Foon Tan , linux-kernel@vger.kernel.org Subject: Re: Why set .suppress_bind_attrs even though .remove() implemented? In-Reply-To: <20220722171706.GA1911557@bhelgaas> References: <87k085xekg.wl-maz@kernel.org> <20220722171706.GA1911557@bhelgaas> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: helgaas@kernel.org, pali@kernel.org, johan+linaro@kernel.org, kishon@ti.com, songxiaowei@hisilicon.com, wangbinghui@hisilicon.com, thierry.reding@gmail.com, ryder.lee@mediatek.com, jianjun.wang@mediatek.com, linux-pci@vger.kernel.org, kw@linux.com, ley.foon.tan@intel.com, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Jul 2022 18:17:06 +0100, Bjorn Helgaas wrote: > > On Fri, Jul 22, 2022 at 06:06:07PM +0100, Marc Zyngier wrote: > > On Fri, 22 Jul 2022 15:39:05 +0100, > > Bjorn Helgaas wrote: > > > > > > [+cc Marc, can you clarify when we need irq_dispose_mapping()?] > > > > In general, interrupt controllers should not have to discard mappings > > themselves, just like they rarely create mappings themselves. That's > > usually a different layer that has created it (DT, for example). > > > > The problem is that these mappings persist even if the interrupt has > > been released by the driver (it called free_irq()), and the IRQ number > > can be further reused. The client driver could dispose of the mapping > > after having released the IRQ, but nobody does that in practice. > > > > From the point of view of the controller, there is no simple way to > > tell when an interrupt is "unused". And even if a driver was > > overzealous and called irq_dispose_mapping() on all the possible > > mappings (and made sure no mapping could be created in parallel), this > > could result in a bunch of dangling pointers should a client driver > > still have the interrupt requested. > > > > Fixing this is pretty hard, as IRQ descriptors are leaky (you can > > either have a pointer to one, or just an IRQ number -- they are > > strictly equivalent). So in general, being able to remove an interrupt > > controller driver is at best fragile, and I'm trying not to get more > > of this in the tree. > > Thank you! > > How do we identify an interrupt controller driver? Apparently some of > these PCIe controller drivers also include an interrupt controller > driver, but I don't know what to look for to find them. If you see a struct irq_chip somewhere, this is an interrupt controller. And yes, most of the PCIe RC drivers will have some sort of interrupt controller driver for INTx support, as well as MSI when the RC doesn't/cannot rely on the platform providing one. It means that these PCIe RC drivers probably shouldn't be removable if built as modules. Which I don't think is a big problem. You want modularity to reduce the size of the kernel image and only load the drivers the platform actually requires, saving memory in the process. And for something as fundamental as an interrupt controller (and PCIe in general), you probably want to keep it around for the lifetime of the machine. Thanks, M. -- Without deviation from the norm, progress is not possible.