Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp213204imn; Mon, 25 Jul 2022 14:17:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1voxPWg3HGCn+dy3XzOEkVOolad3RIIiLNRMsuTvRP5vJxBHudap/GUpIPerHEQ3bJr10x6 X-Received: by 2002:aa7:d64f:0:b0:43b:ba21:7e85 with SMTP id v15-20020aa7d64f000000b0043bba217e85mr15525684edr.59.1658783848995; Mon, 25 Jul 2022 14:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658783848; cv=none; d=google.com; s=arc-20160816; b=VAg1cZsCuiyLGu9Vd4V+NG+8exZL9orShb/TLAMLN7OEi5zLF2XS9hyYrxbMMvfSMF eirHhBC1kHYzorTqq8Xz4X/yDMJJp62OaSR/lEU+aLiPZ+MhAtbhlkaMiJkQZK813xek tPqnmxdNRCoZ/8qHM/aDTYtcCvIaSiIjEqVfBI1PvDfEdxNzYspCt4HUoHsxSvUsoN5m Iw73iziiyTxeNy0IpbIq6Dv0IyxueWpbFybUgNtymTRjN3dhvhrBWngdCkRXLu2z+Wk5 zhBCHsC1k0Y+MGUX1VQNh/z8xqNggdnoX066GBNT/jrvUujpdLfUVksOg8IDiG6B22b0 sDOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=olf53UeogxTstZS2RbTCodhGf9jpAy+ey+tMVtH2a7Y=; b=nmoixK70Ar6msCy5uYbus8HP0hY2/ooyWfx22RLfVyQxj+HHwZBCXwfoHrw/9wRZUW fUDtG7EmKkj8gHiNWklFGfjS+vq5m49qU11NKMk5hX2IU19gqtNJTYx7vwBNI+RzxBmN PNxTY1f5pHMjnfvyTExfWe7SV/28jgXYSeTnjz8LMeOFbPtA/PtBKCJMN6M4sZxjI616 BC/5PsHKjs31LrzpimwE2GT+BKO4u6Xp/VHCb+jBW9vLvTHdc+p3l0MZ0aGGMXKoa854 gcCKSKrgENezqyaFL889MXosC26TzD+2TIIFmwZNklLxmQjzw3SQ+iPo/v08zR4A9qXa W2Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Nn+LuUkU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p25-20020a50cd99000000b0043bb85cac11si14909329edi.411.2022.07.25.14.17.04; Mon, 25 Jul 2022 14:17:28 -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=@gmail.com header.s=20210112 header.b=Nn+LuUkU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236885AbiGYUTB (ORCPT + 99 others); Mon, 25 Jul 2022 16:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiGYUS7 (ORCPT ); Mon, 25 Jul 2022 16:18:59 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 234CBBBE; Mon, 25 Jul 2022 13:18:59 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id c3so11395478pfb.13; Mon, 25 Jul 2022 13:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=olf53UeogxTstZS2RbTCodhGf9jpAy+ey+tMVtH2a7Y=; b=Nn+LuUkUFgcWFbdTzJIZ98XM4XKFfJixXUreDZ0aXqQG2yVkINdtWdAdCMZWl1f+1P Hiw6G+yS3Tvzs0+x/w20m+jzTJrG5dlaLFdNHUF6ZMx5dsEzQWkI3HrIpLREvgvFZqVD f9ceinAKbmPifdBESWUiRbZcBo9Hqv2sVsf1azOeEP5o9nWjSjG3saTWPEWIl8Lqr/SC 4Yl2+MGMqMD9mpCP5Wn/D4h9w+KLse8VhsDY+43ppfA5UBUpU9rw21A18wbt3C9qQJZj m0qpKyXeMVB2KSw311gjcVeO/1zgd6I6czUBEEu5vw4oJiG9x3M8XsPV43nLyBth280R bYpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=olf53UeogxTstZS2RbTCodhGf9jpAy+ey+tMVtH2a7Y=; b=5e8GXOODfPku6d1HryKPXKMhqVn2mmAat8gpjs1b1BayvHv61m1MLyBRvdR9nmTPYM 2n8KNtIHW8G1MB+6WR+yoYmOTW5c9lh9bcnAaVDnFBDN9lhBPfxN5HlNRex/1+g6vOUB m2t4ivjTYghjybEQ1OtQP0fR7Fa4Q8VOPUvRPjK2/an94F1uHJRK0X7lBDYOvGiUJWkk 6bnA3WvLh/ZlajUoyJ5PAD1gyBaPtPRTBIo20B2rZTR2wAGgMOPhNu9zhjtU2KQWGHwh J83dySEbsQ9MpEP3cKioB+p0+ukrtXT90+WQ0To7blnQ0duwEHnDdN1ywJlggMNsfj6c kjCg== X-Gm-Message-State: AJIora+VcSN+wcIIUxKeKebq7RLlyIZfJ3CEzFJxyGJl9GJBwqGTuHB8 TYePDvwIF5oRTmTvYAeWIaw= X-Received: by 2002:a63:696:0:b0:41a:1c20:bf5f with SMTP id 144-20020a630696000000b0041a1c20bf5fmr12435298pgg.402.1658780338430; Mon, 25 Jul 2022 13:18:58 -0700 (PDT) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id o63-20020a625a42000000b0052ba70ea97esm9990995pfb.30.2022.07.25.13.18.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Jul 2022 13:18:57 -0700 (PDT) Message-ID: <1e71ad64-f5bc-2581-87b8-9bd0932a7875@gmail.com> Date: Mon, 25 Jul 2022 13:18:56 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Why set .suppress_bind_attrs even though .remove() implemented? Content-Language: en-US To: Marc Zyngier , Bjorn Helgaas Cc: =?UTF-8?Q?Pali_Roh=c3=a1r?= , Johan Hovold , Kishon Vijay Abraham I , Xiaowei Song , Binghui Wang , Thierry Reding , Ryder Lee , Jianjun Wang , linux-pci@vger.kernel.org, =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Ley Foon Tan , linux-kernel@vger.kernel.org References: <87k085xekg.wl-maz@kernel.org> <20220722171706.GA1911557@bhelgaas> <877d42df5t.wl-maz@kernel.org> From: Florian Fainelli In-Reply-To: <877d42df5t.wl-maz@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 7/24/22 02:38, Marc Zyngier wrote: > 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. No disagreement, however being able to fully remove and load the module again ensures that you bring the hardware and software in a sane state every time, i.e.: it does help find actual bugs in either implementations. It's also a faster turn around time if you are working on that specific subsystem in avoid rebooting the kernel needlessly (that puts a lot of faith into not crashing the kernel, still). -- Florian