From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6799E606A336 for ; Fri, 4 Dec 2026 12:17:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B4DB6B05B8; Fri, 4 Dec 2026 07:17:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 83D736B05B9; Fri, 4 Dec 2026 07:17:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 72CD56B05BA; Fri, 4 Dec 2026 07:17:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 513C86B05B8 for ; Fri, 4 Dec 2026 07:17:24 -0500 (EST) Received: from smtpin26.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BD5901C3AA7 for ; Fri, 4 Dec 2026 12:17:23 +0000 (UTC) X-FDA: 85506200766.26.5F77B3A Received: from mailout3.hostsharing.net (mailout3.hostsharing.net [144.76.133.104]) by imf27.hostedemail.com (Postfix) with ESMTP id E16A240010 for ; Fri, 4 Dec 2026 12:17:21 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of lukas@wunner.de designates 144.76.133.104 as permitted sender) smtp.mailfrom=lukas@wunner.de; dmarc=none ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796386642; b=xSC3cilBw/jy/DdgB+bm7zK8Tr3zCDqgPdWVgsYhAc2LLBoYgXksv6+oiVKQs1SjV2+xwK ze4vjwEl1mn3ByxBMiuUl+Ok/WKbu2QDc9WBsp2rlhXOU5JyFWjsNpCE8yD9B9MHmO4f/a qlwJBxUqVFIOHY5PCXWJuh1vvq4ur0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796386642; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HsSL0dNVgFyhwKDcqnqpCfcbtzGsxtEHom96x1UNREs=; b=GX3J76GlkDCosrPADHi93SZSzmXofX05FA9qk9T402bFGyIdNwdt6aH/dn66pR/xuEi8Zl sgpiXp5KUTx5z2qRi6paEmX3PtuGonIv5j+cuGgKnczr4KwtnPqsRRcXMtnnRxMYkMqgzJ BvytYZnV2gLwrUGVvuW00zS5AqAQopg= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of lukas@wunner.de designates 144.76.133.104 as permitted sender) smtp.mailfrom=lukas@wunner.de; dmarc=none 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261106004218.604799-3-dmatlack@google.com> X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E16A240010 X-Stat-Signature: xtz5uwrq7bxbd5jaj9ibkrmentprx9z3 X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1796386641-176715 X-HE-Meta: U2FsdGVkX1/4xU6ImmuiBBDqtvbGItZA3mtwm+d28uRPMl4NIzq23mptaXu51h0pFPq88iRwXWOkhFcmuwiFNtBh7cU9MtxtSMRrSsQbYxQWZXBpndOZ2jjeQ1WIByi4g35fxDHocVhJzLQhX/dFgO0nypa6dxyIUmpAr4mS7XDlqJTsJ7kCNf4Mq8E0DihM+OBNPAwQSXPEYNNkalZcvjxgWiz95/9pTNZXj30hi9Ec9WEi+z9y9kJJ8acIRSG7DKBTyUPoNuJRdcojZ30EBcwftGJntyOVtj5U56BTvqSPlfEeA9dvcgVLpv0u7YkNdtS7MJN06UFCRkxU50kaT/Owz8mhJECx+gIFYzBP6KA+p8oRhkeGi1Bd8/ighNYAx2HaDan99CzWF43OgpKdWwRTxvTjdYs25PWYsuhIRBd/oGNJ/VJ2FYCpIOBgJQ7Qrqu934nsRCOSGGhbSSBgUWD1JrTVUbp7HkOQTA9zhaslanwx8ahwvaed6Qq+9mikvj7cwoSMXKULRLlukuXZzR/NR6Sp0BG/EFTxU2+q74BX7xiWugUfv907bGgUJqETbhb0QfysRmdM4nyNmrSypkakzIeJY9rDC7Ca9TYAEIMGSY91bL0e79jynXZducKedD72LehXAs3fHB6nKpXhY9XtuA95r0X19PBDbBFaAuGgyjv+G98KEfRC5IOHl8K4aDR041co2kUzY7aaBRzIa0sUAQFmBaDg4NuQBoZWuAr/zMp0+so4yhnIDVJiuQhP50xJ8YMfGwl5w0v+9m2HyfL3ybp/MZ0O/kOWcZBp71/E7o6KZVk5hy/OF/jJ0vD+GUxSgaZN4B13PeNIlNbtbDgefyCFyPcUiyrI58PqB8uM4Gtaosh1z9yg8A5WCockMcK5Q8obnDTn/YMqr9aLzHUq9TsLJ4lvN6aj+EHRHmFQrq1MWYNvDHYEq3XmQApKhjcM7kcgib2R1Itc7of tDhAhKaV 8w0XxSJWW0wF7eHqpGWgnjlzmJy1GTaJTFlWhnvW2R7QKhjwu6+QBx0K84FeEZchORAFK4yOBhYr7M7kmBkp0KfvQCgtWHASxOonlPEbd+5kFZogVD6X5yufy6E5OeirybjYxrehsuZrpgXI= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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