Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp120259rwb; Tue, 27 Sep 2022 23:43:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7d4SOaVXe6nUXWjTez4mFlB9f/XmO83mhqrF6SQTyzOHzWxds3M5tfsmyMpgAtkExZYLQf X-Received: by 2002:a05:6402:4517:b0:443:7fe1:2d60 with SMTP id ez23-20020a056402451700b004437fe12d60mr31827696edb.133.1664347411057; Tue, 27 Sep 2022 23:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664347411; cv=none; d=google.com; s=arc-20160816; b=tOI9PfgFW6WK+o3WVF1fPNKrBh0OUXyBStXVABQQLRjd2TordGiFYm8jCgTXe9lG1B cOj+qpi+EYBbfQiXVR8Tuo6Owlx/E+Ggw1XlZ13d0laX2kVWsXfWtSoJBICnxYNcsME8 bsmo0HGRq4yxybAOru+C/XCZdqr86WSi4C8eVO38d9jYR/JXLsmneewY+mqnkyNlUWc9 UmuXctS8KncLBKkca43WoEz+WJqY8C21Iz6KWogHAnDylgONMXgigaXNUgb7V8G+0qN0 A2xS2TL7i14ZSr4riZpJYshGT0vRF7m6FN2xN4rUVzzie9dC31w0+pVF/wfaNHpgnEMz Cqxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qDfULWO+CjlI+40h/kWTlWYX0aozqbS0xDUG1rHLdNI=; b=ZzyDrf0XWZ5ISSp1XeaPP0cDrVIwuKl1mUGx7RVRcKYli6R9HF1BbTzJHc0QeoPbdB fVLWllrSo4+/aAALkDkD0jAqk3CE1k/Izrm4hVUd0UrAdr4R4wLNtEMsP4pOlxBjk++o AARpbCspJsZdZmMAKF2xsRQG3bIE/FbB5q9rGoQU58vTG4WQTFdah+J50CJcSfJfvSS9 bNGf3xodGrfSlO2zpywDqvktsNJ9aHeYAO41Q5LPIto6XZf40tt8eKdZdswbmiuMv+xG UIN8pr+MQ3GonoldElfpRnoN6Atsx1G+vOvn+myFaDlAC4irBjqecZK4hdGwCN7nyohT WMPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=blqPmmcZ; 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 hb30-20020a170907161e00b00781d82a6fc9si4657996ejc.264.2022.09.27.23.43.02; Tue, 27 Sep 2022 23:43:31 -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=blqPmmcZ; 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 S232348AbiI1GgP (ORCPT + 99 others); Wed, 28 Sep 2022 02:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbiI1GgN (ORCPT ); Wed, 28 Sep 2022 02:36:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AB881CD69A; Tue, 27 Sep 2022 23:36:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id 39197B81E8F; Wed, 28 Sep 2022 06:36:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFBFEC433C1; Wed, 28 Sep 2022 06:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664346969; bh=zyljZf82O9R780kV4BUr+vkxsSNpj4mliqNvkk2AMN4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=blqPmmcZfGt5aq8gupuU5Bw45sVvMT3y7NepLo6/iRh6fcsCRnZLHt58DYYgcvBQI +cjIvujsQF7XSvivj5lunKS+lbnBWvHGsTcqrHMoVKzoEdC7xOawvzlaeett+Hb6Ci HTsDLLna6mREWSSUF2N4gciDwUUT6haN9aQCuL2m5G0LVGf70lR10HLqSXGYE6ra3l dYMHTWPliFIdAWxp64RdZWl6DdKHJ4BFWD81WIky/VP1zi03GupwqVeHhqspenr7AX qO/NUwdLxPWeWk/Mg+UnzeCyue7Yg4le2sE+QX8oVAwVDY1eFoaCYuw/uQQdG3moNm 10sJoNeZgjnPA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1odQg3-0006qe-Cf; Wed, 28 Sep 2022 08:36:15 +0200 Date: Wed, 28 Sep 2022 08:36:15 +0200 From: Johan Hovold To: Lorenzo Pieralisi Cc: Marc Zyngier , Bjorn Helgaas , 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?Q?Wilczy=C5=84ski?= , Ley Foon Tan , linux-kernel@vger.kernel.org Subject: Re: Why set .suppress_bind_attrs even though .remove() implemented? Message-ID: References: <20220722143858.GA1818206@bhelgaas> <87czdtxnfn.wl-maz@kernel.org> <87zggxaye8.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.2 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 Tue, Sep 27, 2022 at 05:27:42PM +0200, Lorenzo Pieralisi wrote: > On Mon, Jul 25, 2022 at 06:35:27PM +0100, Marc Zyngier wrote: > > [...] > > > > That is precisely the way I've been testing it and everything appears > > > to be tore down as it should. > > > > > > And a PCI driver that has been unbound should have released its > > > resources, or that's a driver bug. Right? > > > > But that's the thing: you can easily remove part of the infrastructure > > without the endpoint driver even noticing. It may not happen in your > > particular case if removing the RC driver will also nuke the endpoints > > in the process, but I can't see this is an absolute guarantee. The > > crash pointed to by an earlier email is symptomatic of it. > > > > > And for the OF INTx case you mentioned earlier, aren't those mapped by > > > PCI core and could in theory be released by core as well? > > > > Potentially, though I haven't tried to follow the life cycle of those. > > The whole thing is pretty fragile, and this sort of resource is rarely > > expected to be removed... > > This made me notice that we don't undo the actions (ie bridge->map_irq()) > executed in pci_assign_irq() in pci_device_remove(); I don't think this > can be right and that's already a candidate for a fix. There's an inherent asymmetry here as a legacy interrupt can be used by more than one device. It is mapped on first use as each user calls ->map_irq() but can only be disposed when the final user is gone as I mentioned here: https://lore.kernel.org/all/Yt+6azfwd%2FLuMzoG@hovoldconsulting.com/ > It is not necessarily related to this thread topic, though I believe, > in an _ideal_ world, removing a bridge should guarantee that all > the downstream devices (ie drivers) had a chance of freeing/disposing > the resources they allocated. This in theory; I totally understand > Marc's point of view here and we should make up our mind about what > we want to do on host bridge removal policy - this will take me more > time to get to the bottom of it. Johan