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 6749C606A322 for ; Fri, 4 Dec 2026 11:43:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77AB56B05B1; Fri, 4 Dec 2026 06:43:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7525F6B05B2; Fri, 4 Dec 2026 06:43:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 668986B05B9; Fri, 4 Dec 2026 06:43:17 -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 42F0C6B05B1 for ; Fri, 4 Dec 2026 06:43:17 -0500 (EST) Received: from smtpin08.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C8FCD1C39D6 for ; Fri, 4 Dec 2026 11:43:16 +0000 (UTC) X-FDA: 85506114792.08.F4867BE Received: from mailout1.hostsharing.net (mailout1.hostsharing.net [83.223.95.204]) by imf05.hostedemail.com (Postfix) with ESMTP id 98743100008 for ; Fri, 4 Dec 2026 11:43:14 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of lukas@wunner.de designates 83.223.95.204 as permitted sender) smtp.mailfrom=lukas@wunner.de ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796384595; b=ncuvQ2K1oZjXTiGFwzEEtwABP/qVlgHMPNtL7j7sdI7XJg1nyFkcD9ywJGImkDwbKThRKM D7001CBhq6K0ucb6T6js9kYbMwEqfxZpDelPcvhfRB7gB6xmO+HHWYB+WyeAZCG5KU1QKx w5c2oQOeKjB5eo9wRol4Z8oz+D8M/9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796384595; 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=+dvOMN7/1x7H3mXptIwNA2qZe/3rfFD6HJcVgqdu23c=; b=0CUtT/GabVvODQ+pyg40nOh1ZlFuDIX5EbTTxxTs9JPo/6f/C7TOaPJ22b1c2Rg8/jc2bV uVhqsNzldN9RBVLLaO+qbyMzXyfbybfdwZDk/kdVahfgeDJpSCj+EdD0VnJNDwVP154DK0 J9s6TYQCqUdMz4SFVsAnmN5wWrNSuTE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf05.hostedemail.com: domain of lukas@wunner.de designates 83.223.95.204 as permitted sender) smtp.mailfrom=lukas@wunner.de Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (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 mailout1.hostsharing.net (Postfix) with ESMTPS id D31953A4; Fri, 04 Dec 2026 12:43:10 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id BD45E60CF5CC; Fri, 4 Dec 2026 12:43:10 +0100 (CET) Date: Fri, 4 Dec 2026 12:43:10 +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 01/17] PCI/DPC: Allocate the DPC save buffer during device setup Message-ID: References: <20261106004218.604799-1-dmatlack@google.com> <20261106004218.604799-2-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-2-dmatlack@google.com> X-Stat-Signature: e7hc1zex15uzft1tw7q7gc4w465n4sj9 X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 98743100008 X-HE-Tag: 1796384594-336347 X-HE-Meta: U2FsdGVkX1/vSHkLQfcvgNylfgFW7c8fxWUA2Rpoeooapwq0ZQzaafURKsMfaqFBhfYLd/tDroy+32POaYCBAAZmJVHcvYpuOTJOcpCS/6OWzzd0rj+pHCS2OCxwqLKF22DvU33BJHhaHakGsQ4D45toGAU+Y/ZhBJGQLDUhecpFi8HryjQps88XByjHhD15eKNCHeLA+3mx2SPh+6erm4kLEcFh8FSEcWvNj8IGruj0X7BmyWCbJA12ekcFlzNQ8bwJmOFDrKjIEVOQiNtTF1X58dE3m3NOphSSKjgrJHukcMgFVyGCWWsB51LDX2nKIIOHxfKzctAN5/7H/LcVxH4U+Cbsu6kSu8L7jhONnuuHnZxEaJEzJ9xd5MjWI8SuHcMAe834Q+TBX3oEWj6PiPxtxOJhRn+MFiQq4Qg1vny5n0oLEg/81insFetV6s5xrmmcUB/uKPpOWoDN3dr5dj6htShXe6BzTlDB1nvR13qI2J0XET/5hOWflxzDLHFmyo1KPVn1jLDicL48CwZd3phYhxLvTwtC8pIzujK0GVhoRi6aCsk/5IohHWCCUn+xoqud2YUXJBMYgZOg6gf2r6VjSTNnIYvtyxuwPU2ezYnSBKRsFEfGq9nKHduxKgtU2QAE9dR23BHSNIjV7vIggASVTqHmKhF0Oqtq2UQ0n4bvUbB8ULqwfRPdOnZWcmJr9MsPSBycDqUif2u1BOORvrD2wA4ZrMI30wXFfF/qWmHtUmJ5xNV3hLa1QaB97GmxXiBz++bfmd7pAmx1k4DNOdO/J62fii4jW8eKUdO788rs1FYV4PaRSWSJCzF1/slXUfF75icqTzIgzlMAmNFPhbuOwjfOdOu186fXLZn8SkNFlB2C1hW6bE4KvhFdDqAWEb7TZ4hJzHM1dP3JyqPMO5wuWG8ns+TtwnGlOxphvHIBVZAvDi73i3f7ZKIbLkeI1kWrRwSsJgEikJcCltB VDeo7vEf 3owlDyKYX17qJxUqMi8YgGBlnipZXGMHTV4mDMnBfSWrUosM5prRKiHvG1TDAFMCWqQGlwQ5/QS6VCtQgBjlJtjdqITUruFYo0cU4+5NyVh1qEdO+IkflHIlPMTsajcNWoJHlT4UmVZjEY2r1OEJ8dQZMP5Co16TDabp+ 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:02AM +0000, David Matlack wrote: > Allocate the DPC capability's save buffer in pci_dpc_init() rather than > in dpc_probe(), and report an allocation failure, which dpc_probe() > ignored. Good catch, could you amend dpc_probe() to handle the allocation failure? > > dpc_probe() runs when the portdrv DPC service binds to a port, which is > long after the device has been added, and does not happen at all if the > service is not enabled. Until then pci_save_dpc_state() silently saves > nothing, so a reset in that window loses the DPC Control register. That shouldn't hurt. I think the expectation is that until the DPC port service driver binds, the DPC Extended Capability is in power-on reset state and it's not managed by the kernel. So the kernel doesn't have to care about restoring it. Moreover according to PCI Firmware Spec r3.3 table 4-6 bit 7, the kernel is not supposed to modify the DPC Extended Capability unless it has been granted control by platform firmware. It seems this is violated by moving the allocation to pci_dpc_init(). Note that dpc_probe() is gated by the rules applied in get_port_device_capability(), which checks whether DPC control was granted by the platform. pci_dpc_init() doesn't perform those checks. > Allocating during device setup makes buffer existence depend only on the > capability being present, which is what the save and restore paths > already assume. It also puts every capability save buffer in one phase > of a device's life, which a later patch relies on. pci_save_dpc_state() and pci_restore_dpc_state() become no-ops if no saved_state has been allocated, which never happens if platform firmware hasn't granted control. So my impression is that this patch isn't needed, but a fixup to handle the allocation failure in dpc_probe() is. Thanks, Lukas