From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796157370; b=M2S7P4SwX5qP3TaVkANk6+0RmtoBX4AS/kprFGGb8p2oZmGlCBgg7kEaIova7zJ5eRWO UBkMm3arZk679J0GmVGcwiGM8PoVz2vnfg5VH5zAYVOYYV/VrsMNbyWBdba7Hr8gyxU8t Kc9y1w2WqgRWvtFyMtKBZ3wqp0Blp++EX7LAW+SRvomoZdO7dvC5fuinOf+y6w05zARsD tXAeJHPnX/AnwWd9wqadacrtzaRVV7mbhRsOqPpe+WxFKxEPFO0tUYTQxSofmWOBCtS6X 36Ag9cOBgOxwltSivHmiw1E+hgdAu5q833Hn0/Ioa0gTIoMOHZ8HsGweFuFuu4N9AZg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796157370; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=JMj85r73AvAFFzdQpMaiwVxoNvOi4Qr9u2cWuwXhzT4=; b=vYlq4Sto+z3y4r1X6ZB2LfhM4+5uckM20WaZ3K12jH7qmjyoEw5Sb/BWGEJx2viiYEV+ OFtkZC4wbhsLXUfGSPZF+VGALO15olwoHg4cE5mwn94/+60NON3LW1yyVsl21hty5hLco KxkDAWpWWxQgYKzqTDWXXXcyVdG159vbMw+4MCSIDx44/QdleqSnXKKSGXYNRRSaaG9+m do/YW5hEiPOlF3bWn1am1TySnyxGt1eFISlARJuuCaK0/rU+WXT3Zi/D7L47xaivjdUIu h6rL0EwiW5a5FOrzILPgXLmmL5W9ctQG1lsZCY9AZB10fGec4rCvWekdcPGc9XElZtQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oB4nA1Kc; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00138606A31A for ; Tue, 1 Dec 2026 20:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oB4nA1Kc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DF401F00897; Tue, 1 Dec 2026 20:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796157369; bh=JMj85r73AvAFFzdQpMaiwVxoNvOi4Qr9u2cWuwXhzT4=; h=Date:From:To:Cc:Subject:In-Reply-To; b=oB4nA1KchgRo5wUGiMaRJkITKiVzVsvqicGKpBnFSDuNncRjfiAVSn3cST6uhBt89 3WhRT9604AbZgHCeAhkOxESADVjVraWWudg+KVDeGkpVxOzskH5gYcaSpMx3HG8Za9 7GQ0A0CuMjOcZNgozYg+YrKCJ4KnsWhG9ZoZgfwYcRFWIvYYtZpI431R7Dy85GBpRd 1MJvmigiaDS7Awif5CAS6B/goF+lsh0p0ZPa3vh3BzSvKtKKurkzbdOrATwIKzVHKS 3OePDUpWt3JjNB1IGQv1Bc/6J08/aPYSe+vQrc7WCbXPV0wlpg8kgEyyakoVP5vvYt Q1IuJFcMWnvKg== Date: Tue, 1 Dec 2026 14:36:08 -0600 From: Bjorn Helgaas To: "pstanner@redhat.com" Cc: Arina Kharlamova , Chandrashekar Devegowda , Liu Haijun , Ricardo Martinez , Loic Poulain , Sergey Ryazanov , Johannes Berg , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , netdev@vger.kernel.org Subject: Re: [PATCH net] net: wwan: t7xx: Do not call pcim_enable_device() on every reinit Message-ID: <20261201203608.GA477233@bhelgaas> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <97494bf10c949bc3a6845f79aef02ca52afe945f.camel@redhat.com> On Tue, Dec 01, 2026 at 10:45:31AM +0100, pstanner@redhat.com wrote: > On Mon, 2026-11-30 at 18:02 -0600, Bjorn Helgaas wrote: > > On Tue, Dec 01, 2026 at 02:56:31AM +0400, Arina Kharlamova wrote: > > > t7xx_pcie_reinit() runs on resume from L2 or L3 and on every reprobe > > > after a modem reset. It calls pcim_enable_device(), which did nothing > > > for an already enabled managed device until commit 77f79ac8de0f > > > ("PCI: Remove struct pci_devres.enabled status bit"). Since then each > > > call raises the enable count. Since commit f748a07a0b64 ("PCI: Remove > > > legacy pcim_release()") each call also registers a new > > > pcim_disable_device() devres action, and the actions pile up until the > > > device is unbound. > > > > > > The device is enabled once in t7xx_pci_probe() and the driver never > > > disables it, so drop the call from the reinit path. > > > > This and the loongson/lsdc issue > > (https://lore.kernel.org/all/20261201-s2p-d60-v1-1-d88cf22132ab@mbzuai.ac.ae) > > seem like basically the same issue, so I wonder if the pcim API could > > be improved to avoid it.  It seems a bit subtle and like something > > driver authors are likely to trip over. > > I don't think that the APIs behavior should be guarded with more checks > (like "already enabled" checks). In the past, first the managed API was > added, and then (for unknown reasons) counter APIs were added to revoke > the managed actions. Look at pcim_pin_device(). IMO that makes the API > more convoluted, inconsistent and even harder to understand. > > But it's true that drivers often don't seem to understand what a > managed interface is, proven by the fact that many of them also called > pcim_disable_device() in their remove(), which leads the entire design > ad absurdum. > > I think what we can is to document more explicitly what functions you > could use when and for what purpose. Especially, we should deprecate > pcim_disable_device(), pcim_iounmap() et al. I wonder if sashiko could be taught to look for this issue, e.g., maybe something in https://github.com/sashiko-dev/sashiko/blob/main/projects/linux/prompts/maintainers/pci.md?