From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FD1623EAB2 for ; Sat, 6 Jun 2026 11:10:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780744241; cv=none; b=FQtgcs/KgNqILp4RZnZCkhHUOLrYY/y61Xz3v4tLU30ZrO7pKUIzM/R8ad55PwLvmyhAkexrbwCcnUt6Ta0G1LJKu8lzVD/A72zGn3pXw30Hm6qcZ/3g0j2wkmIK0shrjCr1FOwULy9rzivmyTIIP/AiWPBlVVwNiFlcGvAVwes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780744241; c=relaxed/simple; bh=8rGT5m9JBzmFPEylx70cZknpUvaFHjWy4EYaVq8UyiA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TVLcIsGqIGp000/pDOmuYtLGdsOIVxUsaJ26raGGAUBeno0VWm+uUxDuQZXoEAII0dwqJB5vssVzHg84CyAuAIlbVfqv1tXb8qmtJiKbY/Sh9P2+yXuPQKqxJb7dBMptiFYIFBfdD3mCAz58qEkyYy/6L7SArHxzaJJ6TXTVL1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XkblMaQE; arc=none smtp.client-ip=74.125.82.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XkblMaQE" Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-133362c30cfso19660c88.0 for ; Sat, 06 Jun 2026 04:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780744239; x=1781349039; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=F1UvGUn3KRDrygvBE4DSDRKEnm/sK5Y67p5+Nbu/YEQ=; b=XkblMaQEmTxwt4sd2VW4eBWR30yK9bgRaaR+sSjlgNCqLN96DXeAgro8yGjyUB6YgA 2VIC+intydL1m6gMixL38HNA+oIVlLICgrdCJlx8urbzlPzekkN38mN0Jujhjvtl0r9/ 9c4pQ6Zf8MrX5XCHMdHAbgYrhRSINFTJc0ZvLjsnlyZeTI+WDMmVH/RsZ83CswEe17N3 RXrxaiE5MbhT2JJKss4+IDlFDGn6VOilog2UX930sd2mL77ZQGNaHKveVtoiOH/0LdRM zgqKf6b3KjqkRPTu0BWgqaTP/AiYAjdkFFBs02PEVtxtzxQZtjnM7dqIInQrIBYXLC+p 4asw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780744239; x=1781349039; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F1UvGUn3KRDrygvBE4DSDRKEnm/sK5Y67p5+Nbu/YEQ=; b=TO2AtCCB3PmTl6P43qmp+7Ggi94gTomWmpz3MRAyPdEj6LoFhLjzDzvhOXnEa+0noo mCpIWZwqqFryM/1KE+XMg9tu/LOcI9A6c5EW0f8x//fTzEkWe66yZdlQoAFldW2sLRZG ObSDWrkjk5P5ste0fTvt8vO07UwN7Ufy7/1libEJiTITBTnOuqKY27L6nXmRVZYj4JPs K+hIKjAgNYA4fTm7hP6AYT9kdbtMKscaNwh6bty7UuL6e3LwluYTbzzOrUpZ5TeLJSXk O4sU2su0farQ6h/n9xaqCS6OmTC3YqgFQl01VttzztnR5vjxBkonyGdnLSF6rEepfDNo QDug== X-Forwarded-Encrypted: i=1; AFNElJ/jTWeJZdftgUp+OgsQmS8rvUWyuERFt6HrypB+DccVUjjvKWBEIl8EfOvWsd17PDX9ele3gpVK4zFZJN8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4RKpdvJ73rUH4na0MWdZbIFf4zB6+/IOgzqPAAkxobgcyam18 +1oS7nOkWvyqyUL4XMwDWnotX87C401PbagFOGQ7omWzLafen/OZhSt5Q/blFx2pcw== X-Gm-Gg: Acq92OGvhLnMsTLwUIEFmJGEKRLuwKDlcUUfCdyiMIRHocoM/syqVifJuXP+wjHDw/d SnS94kgPiwrP9Kjuyyna8oWlGGcSRvGZLRvX7tv8SHeeAXWuUNi7mf5EUP1lf3m0+5aeUHOa4yz ozHUUKldBigYHnQw2i7Glx+RobVBh4ZMIbVmv+BGtsyg8qgGfuduYLgK9DP+b/wr8dZ3msv5euN WRbX/8dhNucIxZ6xdiGd1rw2qIe1E0lWUZstkrfT3AUaludJy3rydvRwSXcooJKUo4N1j24q0lD ufEDzScCMVxTxsswK6A8MBO9W6kKYjrVe4F5wkLGhr1Bdp+jHKyYI9YNCfNRtaiG+SO+V/0232L aIHJJrYeg/QftqIfSm0T2PUmZyRao/mhljcSSUB8YjoDmn5fvgsZPFVz2ke1sXruPKTg7aJI0he FCCGZ9kZbKNL/1botJUNs5Zeybf3tYmUDc6SkmRW3QQSFMr6qN1aPD4/3SBLUJb4BfUdWZsgr6d UM73wYfeA== X-Received: by 2002:a05:7022:38f:b0:133:12e0:aab7 with SMTP id a92af1059eb24-13807c6a877mr251422c88.11.1780744238685; Sat, 06 Jun 2026 04:10:38 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13803eb106esm4391089c88.5.2026.06.06.04.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jun 2026 04:10:38 -0700 (PDT) Date: Sat, 6 Jun 2026 11:10:29 +0000 From: Pranjal Shrivastava 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, Adithya Jayachandran , Alexander Graf , Alex Williamson , Bjorn Helgaas , Chris Li , David Rientjes , Jacob Pan , Jason Gunthorpe , Jonathan Corbet , Josh Hilke , Leon Romanovsky , Lukas Wunner , Mike Rapoport , Parav Pandit , Pasha Tatashin , Pratyush Yadav , Saeed Mahameed , Samiullah Khawaja , Shuah Khan , Vipin Sharma , William Tu , Yi Liu Subject: Re: [PATCH v6 05/12] PCI: liveupdate: Keep bus numbers constant during Live Update Message-ID: References: <20260522202410.3104264-1-dmatlack@google.com> <20260522202410.3104264-6-dmatlack@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260522202410.3104264-6-dmatlack@google.com> On Fri, May 22, 2026 at 08:24:03PM +0000, David Matlack wrote: > During a Live Update, preserved devices must be allowed to continue > performing memory transactions so the kernel cannot change the fabric > topology, including bus numbers, since that would require disabling > and flushing any memory transactions first. > > To keep bus numbers constant, always inherit the secondary and > subordinate bus numbers assigned to bridges during scanning, instead of > assigning new ones, if any PCI devices are being preserved. Note that > the kernel inherits bus numbers even on bridges without any downstream > endpoints that were preserved. This avoids accidentally assigning a > bridge a new window that overlaps with a preserved device that is > downstream of a different bridge. > > If a bridge is scanned with a broken topology or has no bus numbers > set during a Live Update, refuse to assign it new bus numbers and refuse > to enumerate devices below it until the Live Update is finished. This is > a safety measure to prevent topology conflicts. > > Require that CONFIG_CARDBUS is not enabled to enable > CONFIG_PCI_LIVEUPDATE since inheriting bus numbers on PCI-to-CardBus > bridges requires additional work but is not a priority at the moment. > > Signed-off-by: David Matlack > --- > .../admin-guide/kernel-parameters.txt | 6 +- > drivers/pci/Kconfig | 2 +- > drivers/pci/liveupdate.c | 83 ++++++++++++++++++- > drivers/pci/liveupdate.h | 14 ++++ > drivers/pci/probe.c | 17 +++- > include/linux/pci_liveupdate.h | 4 + > 6 files changed, 119 insertions(+), 7 deletions(-) > [...] > + incoming = pci_liveupdate_flb_get_incoming(); > + if (!incoming) { > + dev->liveupdate.inherit_buses = false; > + goto out; > + } > + > + /* > + * It is safe to sample incoming->ser->nr_devices and then > + * drop the rwsem since nr_devices will only decrease. Thus the > + * only "race" is that the current scan will be overly > + * conservative and force bus inheritance. > + */ > + dev->liveupdate.inherit_buses = incoming->ser->nr_devices; Nit: inherit_buses is a bool, while compiler will handle it correctly, maybe we could: dev->liveupdate.inherit_buses = !!incoming->ser->nr_devices OR dev->liveupdate.inherit_buses = (incoming->ser->nr_devices > 0) for readability? > + pci_liveupdate_flb_put_incoming(); > + } > + > +out: > + return dev->liveupdate.inherit_buses; > +} > + [...] > /* > @@ -1497,8 +1501,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, > * do in the second pass. > */ > if (!pass) { > - if (pcibios_assign_all_busses() || broken) > - > + if (assign_new_buses || broken) > /* > * Temporarily disable forwarding of the > * configuration cycles on all bridges in > @@ -1512,6 +1515,11 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, > goto out; > } > > + if (liveupdate) { > + pci_err(dev, "Cannot reconfigure bridge during Live Update, skipping\n"); > + goto out; > + } Quite helpful! Thanks :) > + > /* Clear errors */ > pci_write_config_word(dev, PCI_STATUS, 0xffff); > > @@ -1572,6 +1580,7 @@ static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, > pci_write_config_word(dev, PCI_BRIDGE_CONTROL, bctl); > > pm_runtime_put(&dev->dev); > + pci_liveupdate_scan_bridge_end(dev, pass); > > return max; > } With the minor nit above, Reviewed-by: Pranjal Shrivastava Thanks, Praan