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 8D5E9606A32F for ; Fri, 4 Dec 2026 22:53:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=FbR3boxO Received: by kanga.kvack.org (Postfix) id 7D8F36B00EF; Fri, 4 Dec 2026 17:53:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7895B6B05B1; Fri, 4 Dec 2026 17:53:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 678436B05B2; Fri, 4 Dec 2026 17:53:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3503C6B00EF for ; Fri, 4 Dec 2026 17:53:13 -0500 (EST) Received: from smtpin22.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A611F8062F for ; Fri, 4 Dec 2026 22:53:12 +0000 (UTC) X-FDA: 85507803024.22.82A0E22 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf13.hostedemail.com (Postfix) with ESMTP id B0ACA20004 for ; Fri, 4 Dec 2026 22:53:10 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20260707 header.b=FbR3boxO; spf=pass (imf13.hostedemail.com: domain of dmatlack@google.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=dmatlack@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796424790; b=If64WjRVm+YSnWuryCpU9OlxlX4Yd9WyOtd4eIVqPhOdiJnkBwYKmjYE7YzRU3Ba6qKjjj X5u3yNhdNbh/b8n20VSpVqgbu/NmPDK4iSJBXa9lGFNiQX9KzdAK/6g/sKfsrG7E+heRRB DzV7uvqfFaFQJtYhSYRMw249EAJ5zog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796424790; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=tMYbBK50R46w+ZzM8GOc2aueh61w9Rd6qpnUjgONFtxf152aK8WyzR02G8YR+D8Ws8RI9M m1UwWqaOgnY4Y4x4Nu3hC/Frzo8JUrpNARCNQdkSH4ahZQKLb15x6ZsKfgO1cZtlGvjWQO CP2IcgA5Ooos7z26Yyj28IcTXUyQPCM= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20260707 header.b=FbR3boxO; spf=pass (imf13.hostedemail.com: domain of dmatlack@google.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=dmatlack@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-cdd9d0c9bbdso1040881a12.1 for ; Fri, 04 Dec 2026 14:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796424789; x=1797029589; darn=kvack.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=FbR3boxOuIGmNthwDtcYj0fbzHyhKWtiNFszMlxF7LYxlD5CqymU4ao/hTqDYX2gmU oF/n0wVwUModM1A0pNfaZZfGvDauuh7iXZ4odbTfeqxLHrC49yuEtuc7TiiTWOvZAye9 1NukkTQf0mUCIaNppbHfdb7G1uBofEPmbuIH4DpwjXSRBGC0sALFrQYCP54/7iC14u9C kIRbAyD+p1E/fcCDK+Amd30nJl8MLvgmBQZ9tiovp/9YTeM8fpXgEsVDdQHlLVF3GADM 1+ZrG6uzGomft8oy/VzEB1wYtB+zibIJCVgklG0sEF7XjNCYHhSf+DqvnMfzbE8gNk2o lGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796424789; x=1797029589; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=pRZuSFpXJJ9he3koxBOj9dbMkJVnVk3ICuuYyN5bAXc=; b=erzCVlNXgkJBXKp6EQkBa0OEwzAHukww7cJi2sOpKx276NSypRPLcM/DIzb7SIAfxh 1pp8Apnayl74h0l2uF0O1Kze5k852Ynj3EZPp+borOzFKn2YjjWPUMmIMO1zd0l7Ojzh 7AwvMxS+G31mRQgP3Ry6VCuQa9HUFqx663DiDR/F9BvNaGNPtevuhmxweQeiIINoQpez BKY+/hKdLAcq4pCuNVpLp5GINV2ScBplVfk7kHkgWe3CFU0qwGEY5Kpv/zlFgKNLTYPF i6O0Pg01htoIkji/LQ8lyEUPinywRI3Iizg1W81Bi13CGscrsR5W8ZhBK6E+LkNJV00x xlYA== X-Forwarded-Encrypted: i=1; AL+hErF1qCv8Jq8SIOSLpxDrQ4hJUUpED9M5tAOKf7AEukoZnjgtMHPi7pQIMvcCDvPOLNT24c1K1ZknTw==@kvack.org X-Gm-Message-State: APuU4Z+Drg436+YO3vmknnRxeUBFd6UIPpXpQ/LJdwaxlWVDNHWT/EGq PQX0KMl+ZC+wu3hsyP8VrqFlTqxrYQWfd2BUSwx4Rfbq1FxM2Fw0fQOHh1+ZJU5mUA== X-Gm-Gg: AZFdTZduErcGGcVr+cHTBbQxD9U1+FgdcYGzLRxXxpo3zy7/KkU80KLDP0iGstkcWcd ZGgQDbxnd9dRKFs90+HlQ0/G+OzbmY0B7JKhbMZ4RPbESfS7f2Cxsg/xIJdydsybVkQpJIQxokb 9XpgeCR5yv34kKSLjQt5D7ct7ylMyP78GHhk5E9blfc8NfUTWoXxh16kRjgriw5ZbfiO1HFI4Ci V6FcYPPzhtNTULx3pSco7RfAClTGwZPoMktLNaUMNYLWf1LM4U462W4Hlvcu7hml/OstOM/4wgm rX+AEYIZ4Au6W7g98fX8x97Yz+mxPyISxiJEgjoAS/IcqIrxRzggFMoQ2II/gU6eAwL7z8cYRmN 3OaOfHJJbG4p42aFEffoBQR0UraAG7ciqT39qu7NCtRl2704ibUfIu77TxJ1FrMsDrZW14H1end TOwLYYWuLqCa7HuSMDxQWSa4PU5jV8BSMguOXhgjXhMsnZQ4S3/SUJQxM87oS7XodbJVQF+4qZc 1ckLyuKdQ5x/lLNwOaQsLsff+FQgeLycb+GNjGGSkd2uhFFIe9kicyHlaSaMjvHb245KQE8e3il 3bQBChjncBhHGE+daxpF+7baO+xCMg6Achu3i9YPpxE0HQmXtXwfdtA+x8Cy4Jx5+S3waBJaSrP qfUZqafum2Ag= X-Received: by 2002:a05:6a20:c998:b0:3e2:8114:12e3 with SMTP id adf61e73a8af0-41562226d3emr3907597637.41.1796424788923; Fri, 04 Dec 2026 14:53:08 -0800 (PST) Received: from localhost (33.79.127.34.bc.googleusercontent.com. [34.127.79.33]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ce12358ee24sm2073148a12.11.2026.12.04.14.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 14:53:08 -0800 (PST) X-Archived-By: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 04 Dec 2026 14:53:07 -0800 Message-Id: Cc: , , , , , , "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 From: "David Matlack" To: "Lukas Wunner" , "David Matlack" X-Mailer: aerc 0.21.0 References: <20261106004218.604799-1-dmatlack@google.com> <20261106004218.604799-2-dmatlack@google.com> In-Reply-To: X-Stat-Signature: 3hikawaxht8puw5c66fm8otiwyneen5u X-Rspam-User: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=4.0.1 X-Rspamd-Queue-Id: B0ACA20004 X-Rspamd-Server: rspam01 X-HE-Tag: 1796424790-628566 X-HE-Meta: U2FsdGVkX198qFCBsSk4YP4GZxIkiae97eAm9KnJFsUahYoHCsXqQ/POSw8Fv6mn6BqThWKPe5cRVFeZxfawnjx17Xb2MYgF1djMRmFc8aYQ1fkZ8M5ZFLgVS47GqBD7lRjSs5xZewNJWznMmEujq4LHLdbQjUZs4p4V5tlsEw/QFpCHqdaGb0TiYDEUf07uezmZV6+NnDKhMim0Ouc19l3ghi9k4TgVckqGn3j3UK1Cf7MUX/AqCJfPCsNEGYH0cdjKkJ7eVK6BTbFLAVzH1ZvyiXuCrdl7LDIgtFcilnhDPYxe/lWU7yL5/sck9ZnjWFn2jstI+7bl2GlMMBeDuXrPJfJA6cEgfN8/p+x7XSJq/UK8+URPfIrG/NqKC/bcbznKAwaXcY4S9481e8I4gMtjZJNHSSbek6Ct+QGpm/3b6GWuJ4fb27Dexi2rGlo7zfMsQ1P42mVBQg3wRChi77WSrXn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LnoFmi4KDBhGVyUlIGEHgZ+fvK/RR/RgQjCipSUeGFMN+VjLNJlNjV1uZbCogkRx6xVnAA== 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 Dec 4, 2026 at 3:43 AM PST, Lukas Wunner wrote: > 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? As you pointed out in your follow-up, a failure there only means DPC Control isn't saved and restored, and the per-capability buffers go away later in the series anyway. So I'll leave dpc_probe() as is in the next version. >> 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(). You're right, thanks for catching this. I missed that the existence of the save buffer was also what kept the kernel from touching DPC Control when firmware hasn't granted control. With this patch, and through the rest of the series, pci_restore_dpc_state() writes DPC Control on every port with a DPC capability. > So my impression is that this patch isn't needed Yeah. I'll drop this patch in v3. My plan is to keep reserving DPC Control in pci_dpc_init() and have pci_restore_dpc_state() skip the write unless the kernel owns DPC, via a flag set in dpc_probe() and cleared in dpc_remove(). That keeps today's behavior of restoring DPC Control only after the DPC service has bound to the port. The one difference is that pci_save_state() would read DPC Control on every port with a DPC capability, since saving reads every reserved register. My understanding is that a read doesn't count as modifying the capability, but I could gate the save on the same flag if you'd prefer.