From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=144.76.133.104 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386648; b=wv79zePeOn8lB7BRf9buq5fLu0IoX+2OaoU2qVLmex1RKXmpRYwb6Yz1Tv/b6TWl0Wdh WbZEohpgpP9RIVuT2oX+sd20bO2+/3m+F75JyDrJd68gdWFNBv7K6pa0xwBvYy7eQQ4uy IUtzIvCONSFLecvIK4T9ExvoPd/ynuVsqF2yJ6LQbvygCcroXIeQbSKUP1I/IC2YaSIdi ZIgK3A/xolhXY+jsQIeT4bo9MzI2KekIVYCb4/a84OwWGLWUzYd0Z7ezq0hRe4u/MBQou GiY3SC1IssygFoFo3oN1kKJQx98zv/aoi5Xb9yL/WcXIU20K710JyawcrisaT+vkfew== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386648; h=DMARC-Filter:Received:Received:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=HsSL0dNVgFyhwKDcqnqpCfcbtzGsxtEHom96x1UNREs=; b=yjpzLP9jY4OE0sk/lA9ML8AlmiSY9Jgy6cYycVcb2HpDZIsJ1LhH6QJvpqMwhcP/QvvN bXZsxWgxAzMwSwTFowtSo/6vd4UUD9iBa+DnGJMPsgy+aRWxwlM+LqznTcPigKn9bLx8w 3kZLe0cN269QPGhccqUchBpyEn6rn/Y6CJk3V+n3PUrm2EqY3MytSPllqXRYqXRv9xxtG zRXgWmv9lfKH3RugzZKTUPMsEFVCcRymcNeIr0RhCE8L2A+jK4qQDFcT6N5neTTCJCxHr 3WAQOTCMRGz4eBkpRSgznJW4Nwp0f5S4GpQyB9ckp4gxZUfkNyEmL0+1zBeaHdw1unA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=wunner.de; spf=pass smtp.mailfrom=wunner.de; arc=none smtp.remote-ip=144.76.133.104 Received: from mailout3.hostsharing.net (mailout3.hostsharing.net [144.76.133.104]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B6B9606A32C; Fri, 4 Dec 2026 12:17:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8B6B9606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wunner.de Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "*.hostsharing.net", Issuer "GlobalSign GCC R6 AlphaSSL CA 2025" (verified OK)) by mailout3.hostsharing.net (Postfix) with ESMTPS id 05CC7C91; Fri, 04 Dec 2026 13:17:20 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id BC679600E3FE; Fri, 4 Dec 2026 13:17:19 +0100 (CET) Date: Fri, 4 Dec 2026 13:17:19 +0100 From: Lukas Wunner To: David Matlack Cc: kexec@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Alexander Graf , Alex Williamson , Bjorn Helgaas , Jason Gunthorpe , Jonathan Corbet , Josh Hilke , Mahesh J Salgaonkar , Mike Rapoport , Oliver O'Halloran , Pasha Tatashin , Pratyush Yadav , Randy Dunlap , Samiullah Khawaja , Shuah Khan , Vipin Sharma Subject: Re: [PATCH v2 02/17] PCI: Add an offset-indexed store for saved capability registers Message-ID: References: <20261106004218.604799-1-dmatlack@google.com> <20261106004218.604799-3-dmatlack@google.com> X-Mailing-List: linux-pci@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=us-ascii Content-Disposition: inline In-Reply-To: <20261106004218.604799-3-dmatlack@google.com> On Fri, Nov 06, 2026 at 12:42:03AM +0000, David Matlack wrote: > Embed the bitmap in struct pci_dev rather than allocating it. Every > device needs one during enumeration, so allocating it separately saves > nothing and only adds a failure path that every caller has to tolerate. > The values remain the one allocation, since their number is not known > until enumeration is complete. Pardon for being dense, but I don't understand the last sentence in that paragraph at all. > +++ b/include/linux/pci.h > @@ -334,6 +334,35 @@ struct pci_vpd { > u8 cap; > }; > > +/* > + * Reservations are tracked for the largest configuration space a device can > + * have, since quirks can still change pci_dev.cfg_size after the device has > + * been enumerated. > + */ > +#define PCI_CFG_SPACE_EXP_DWORDS (PCI_CFG_SPACE_EXP_SIZE / sizeof(u32)) [...] > + unsigned long dword_map[BITS_TO_LONGS(PCI_CFG_SPACE_EXP_DWORDS)]; > +}; > + > struct irq_affinity; > struct pcie_bwctrl_data; > struct pcie_link_state; > @@ -521,6 +550,7 @@ struct pci_dev { > spinlock_t pcie_cap_lock; /* Protects RMW ops in capability accessors */ > u32 saved_config_space[16]; /* Config space saved at suspend time */ > struct hlist_head saved_cap_space; > + struct pci_saved_caps saved_caps; /* Saved capability registers */ A few thoughts: * The first 64 bytes of config space (the Type 0 or Type 1 Configuration Space Header) are already stored in saved_config_space[]. Yet saved_caps allocates bits for those dwords. It would be nice to replace saved_config_space[] with the new store for consistency and to avoid wasting those bits in saved_caps. * Conventional PCI and PCI-X Mode 1 devices only have 256 bytes of config space. Can we somehow avoid allocating the extra (4096 - 256) / 4 = 960 bits = 120 bytes? Or do you think that's not worth it? If you think it's not worth it, maybe document that design decision in the commit message? Thanks, Lukas