Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2227523/?format=api
{ "id": 2227523, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2227523/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260423212316.3431746-7-dmatlack@google.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.1/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260423212316.3431746-7-dmatlack@google.com>", "date": "2026-04-23T21:23:10", "name": "[v4,06/11] PCI: liveupdate: Auto-preserve upstream bridges across Live Update", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6125a8ce626875213323e768755243fedb4d4cba", "submitter": { "id": 69449, "url": "http://patchwork.ozlabs.org/api/1.1/people/69449/?format=api", "name": "David Matlack", "email": "dmatlack@google.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260423212316.3431746-7-dmatlack@google.com/mbox/", "series": [ { "id": 501248, "url": "http://patchwork.ozlabs.org/api/1.1/series/501248/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=501248", "date": "2026-04-23T21:23:04", "name": "PCI: liveupdate: PCI core support for Live Update", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/501248/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227523/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227523/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-53073-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256\n header.s=20251104 header.b=F98F217i;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-53073-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=google.com header.i=@google.com\n header.b=\"F98F217i\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.202", "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=google.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com" ], "Received": [ "from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1pzs0vnzz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 07:26:01 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 47AF03048F2D\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 21:24:27 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 9C1D93C3440;\n\tThu, 23 Apr 2026 21:23:39 +0000 (UTC)", "from mail-pl1-f202.google.com (mail-pl1-f202.google.com\n [209.85.214.202])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 180BA3BF688\n\tfor <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 21:23:32 +0000 (UTC)", "by mail-pl1-f202.google.com with SMTP id\n d9443c01a7336-2b7aba0af02so10944515ad.2\n for <linux-pci@vger.kernel.org>; Thu, 23 Apr 2026 14:23:32 -0700 (PDT)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776979418; cv=none;\n b=nNWZJmbptWEEgy9BQzRktRRC1cP8kofFdvQarHvmzAiL1P79UFNPaAdCnWJN5Yijd1ohOpuEkFzpaxNbuGfOI5C+dpatTqqjiH/T7+dVuvVND6YLD7iQKMwa9+Ac5kUFeEEpKiSbVTdnfRvxGlMYAnGW3onfrRiT9q31qaVprEg=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776979418; c=relaxed/simple;\n\tbh=t91HQYsvqO7GpxrInKPzJTXawhCo+mAVGsn6AWsa7oo=;\n\th=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From:\n\t To:Cc:Content-Type;\n b=cUHiZb79zUxGTsY6yrnPo0xULeU7EA23grV03POnPFWFqcCURWt6KIwmuqumkmVd5SHwQGq5+9J4cg8HgAhMIG6Zpvzq3RNJOesSvh/x2wIfah1Rr/ToSX9BJcYyyrwtG4wUSdZXl52RIeL2tjAx69ALWFl01utlcVtIjc+k2rs=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=google.com;\n spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com;\n dkim=pass (2048-bit key) header.d=google.com header.i=@google.com\n header.b=F98F217i; arc=none smtp.client-ip=209.85.214.202", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=google.com; s=20251104; t=1776979411; x=1777584211;\n darn=vger.kernel.org;\n h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n :date:from:to:cc:subject:date:message-id:reply-to;\n bh=eZtY+EWHg3/BRWz3H3Wx+cRr9MZM3880uCt4Dp7O+PI=;\n b=F98F217iPSUUusEk5WYzTdRhHBGRCVX09+anwzYCtawdgRoaan84zgvLkOEycXrjD1\n ShZLIkNsBm5rFN9qgV0uBH+3Ou38j3lu2qU9PDYOvP8zeoKID0x15I7KcXkPDS9b4kr0\n n3nNgws0QSaD8ipeIsDlaoUSWtYVFfpO0aGTcLsRSplnxCMYIVxoAXfB7cyMtPfdqTVE\n o7piHXoXkYt/nK8jpGAJGUOcsixJu4KQmInAnATXrbjh+SHzTH2RE44/vxrPkaA91Syi\n UTPLodOJuVCl4c9nJgNecI+o6YAsACJB7aWrPqMHKjeoCESQqDm0TcSMo1N+b0SknRJ/\n OniQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776979411; x=1777584211;\n h=cc:to:from:subject:message-id:references:mime-version:in-reply-to\n :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=eZtY+EWHg3/BRWz3H3Wx+cRr9MZM3880uCt4Dp7O+PI=;\n b=Dh5Hu4OYWaH2aaPTbJR7cTO+9gPbLoGpK8mvgAF91G53LVI4F7+5WmP27mx+ahgyZu\n CIk/f8ofgQP8f6A5S/T7iowpJpTOotR58sLiyxPQEB5gFV78AP4lUfwglS4BDrJAc4PU\n ieJylj0WLnF9jKag/AskRBKeyg0ksCDTOCZMwd/JkbUidmcVuxLcVc5Cs4SqLKg+ebpO\n fm9oI/7op1DcAR3ROWfL6VZ1QVkvalU6yxX+60fNKdQ+bIMgxNZzumRON0fzLiP30AMH\n 1RRlhpinj3hPjE/ORwKJVMTY3xHiObfShJuJIAYJ44GxdI3dqldJuteWIvnvx8Kls7p4\n 23bg==", "X-Forwarded-Encrypted": "i=1;\n AFNElJ9ZxR7fxANiHaL1irJJ8Bpfj2CGeUX145EMHgJer7T1NebXbB+OD67V4wkaAyKWcf5KoqRvLdFn5+Q=@vger.kernel.org", "X-Gm-Message-State": "AOJu0YzTzkAVIvCfOBttFzPO9rRwp+j+n34/ClfRfjkBBj99ZL3A+X96\n\tjTDbUEG74PZwvfLCgCAjmk0s0GXAaEPz54YL6HmijxEMs0ED5jBxwuAqF3UXJ00b9nOH76VFK2r\n\t09nhX0xo+rbepKg==", "X-Received": "from pghu17.prod.google.com ([2002:a63:ef11:0:b0:c74:321:201a])\n (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by\n 2002:a05:6a20:3949:b0:39f:27ab:2438 with SMTP id\n adf61e73a8af0-3a08d90bdbamr33243244637.48.1776979410524;\n Thu, 23 Apr 2026 14:23:30 -0700 (PDT)", "Date": "Thu, 23 Apr 2026 21:23:10 +0000", "In-Reply-To": "<20260423212316.3431746-1-dmatlack@google.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "Mime-Version": "1.0", "References": "<20260423212316.3431746-1-dmatlack@google.com>", "X-Mailer": "git-send-email 2.54.0.rc2.544.gc7ae2d5bb8-goog", "Message-ID": "<20260423212316.3431746-7-dmatlack@google.com>", "Subject": "[PATCH v4 06/11] PCI: liveupdate: Auto-preserve upstream bridges\n across Live Update", "From": "David Matlack <dmatlack@google.com>", "To": "iommu@lists.linux.dev, kexec@lists.infradead.org,\n\tlinux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org,\n\tlinux-pci@vger.kernel.org", "Cc": "Adithya Jayachandran <ajayachandra@nvidia.com>,\n Alexander Graf <graf@amazon.com>,\n\tAlex Williamson <alex@shazbot.org>, Bjorn Helgaas <bhelgaas@google.com>,\n Chris Li <chrisl@kernel.org>,\n\tDavid Matlack <dmatlack@google.com>, David Rientjes <rientjes@google.com>,\n\tJacob Pan <jacob.pan@linux.microsoft.com>, Jason Gunthorpe <jgg@nvidia.com>,\n\tJoerg Roedel <joro@8bytes.org>, Jonathan Corbet <corbet@lwn.net>,\n Josh Hilke <jrhilke@google.com>,\n\tLeon Romanovsky <leonro@nvidia.com>, Lukas Wunner <lukas@wunner.de>,\n Mike Rapoport <rppt@kernel.org>,\n\tParav Pandit <parav@nvidia.com>, Pasha Tatashin <pasha.tatashin@soleen.com>,\n\tPranjal Shrivastava <praan@google.com>, Pratyush Yadav <pratyush@kernel.org>,\n\tRobin Murphy <robin.murphy@arm.com>, Saeed Mahameed <saeedm@nvidia.com>,\n\tSamiullah Khawaja <skhawaja@google.com>,\n Shuah Khan <skhan@linuxfoundation.org>,\n\tWill Deacon <will@kernel.org>, William Tu <witu@nvidia.com>,\n Yi Liu <yi.l.liu@intel.com>", "Content-Type": "text/plain; charset=\"UTF-8\"" }, "content": "When a PCI device is preserved across a Live Update, all of its upstream\nbridges up to the root port must also be preserved. This enables the PCI\ncore and any drivers bound to the bridges to manage bridges correctly\nacross a Live Update.\n\nNotably, this will be used in subsequent commits to ensure that\npreserved devices can continue performing memory transactions without a\ndisruption or change in routing.\n\nTo preserve bridges, the PCI core tracks the number of downstream\ndevices preserved under each bridge using a reference count in struct\npci_dev_ser. This allows a bridge to remain preserved until all its\ndownstream preserved devices are unpreserved or finish their\nparticipation in the Live Update.\n\nSigned-off-by: David Matlack <dmatlack@google.com>\n---\n drivers/pci/liveupdate.c | 149 +++++++++++++++++++++++++++++----------\n 1 file changed, 111 insertions(+), 38 deletions(-)", "diff": "diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c\nindex cf8cff134a75..88125f9a2c6b 100644\n--- a/drivers/pci/liveupdate.c\n+++ b/drivers/pci/liveupdate.c\n@@ -106,6 +106,18 @@\n * If a misconfigured or unconfigured bridge is encountered during enumeration\n * while there are incoming preserved devices, it's secondary and subordinate\n * bus numbers will be cleared and devices below it will not be enumerated.\n+ *\n+ * PCI-to-PCI Bridges\n+ * ==================\n+ *\n+ * Any PCI-to-PCI bridges upstream of a preserved device are automatically\n+ * preserved when the device is preserved. The PCI core keeps track of the\n+ * number of downstream devices that are preserved under a bridge so that the\n+ * bridge is only unpreserved once all downstream devices are unpreserved.\n+ *\n+ * This enables the PCI core and any drivers bound to the bridge to participate\n+ * in the Live Update so that preserved endpoints can continue issuing memory\n+ * transactions during the Live Update.\n */\n \n #define pr_fmt(fmt) \"PCI: liveupdate: \" fmt\n@@ -233,25 +245,14 @@ static struct liveupdate_flb pci_liveupdate_flb = {\n \t.compatible = PCI_LUO_FLB_COMPATIBLE,\n };\n \n-int pci_liveupdate_preserve(struct pci_dev *dev)\n+static int pci_liveupdate_preserve_device(struct pci_ser *ser, struct pci_dev *dev)\n {\n-\tstruct pci_ser *ser;\n-\tint i, ret;\n-\n-\tguard(mutex)(&pci_flb_outgoing_lock);\n-\n-\tret = liveupdate_flb_get_outgoing(&pci_liveupdate_flb, (void **)&ser);\n-\tif (ret)\n-\t\treturn ret;\n+\tint i;\n \n-\tif (!ser)\n-\t\treturn -ENOENT;\n-\n-\tif (dev->is_virtfn)\n-\t\treturn -EINVAL;\n-\n-\tif (dev->liveupdate_outgoing)\n-\t\treturn -EBUSY;\n+\tif (dev->liveupdate_outgoing) {\n+\t\tdev->liveupdate_outgoing->refcount++;\n+\t\treturn 0;\n+\t}\n \n \tif (ser->nr_devices == ser->max_nr_devices)\n \t\treturn -ENOSPC;\n@@ -281,11 +282,82 @@ int pci_liveupdate_preserve(struct pci_dev *dev)\n \n \treturn -ENOSPC;\n }\n+\n+static void pci_liveupdate_unpreserve_path(struct pci_ser *ser, struct pci_dev *dev)\n+{\n+\tstruct pci_dev *upstream_bridge = dev->bus->self;\n+\tstruct pci_dev_ser *dev_ser;\n+\n+\tif (upstream_bridge)\n+\t\tpci_liveupdate_unpreserve_path(ser, upstream_bridge);\n+\n+\tdev_ser = dev->liveupdate_outgoing;\n+\tif (!dev_ser) {\n+\t\tpci_warn(dev, \"Cannot unpreserve device that is not preserved\\n\");\n+\t\treturn;\n+\t}\n+\n+\tif (--dev_ser->refcount == 0) {\n+\t\tpci_info(dev, \"Device will no longer be preserved across next Live Update\\n\");\n+\t\tser->nr_devices--;\n+\t\tmemset(dev_ser, 0, sizeof(*dev_ser));\n+\t\tdev->liveupdate_outgoing = NULL;\n+\t}\n+}\n+\n+static int pci_liveupdate_preserve_path(struct pci_ser *ser, struct pci_dev *dev)\n+{\n+\tstruct pci_dev *upstream_bridge = dev->bus->self;\n+\tint ret = 0;\n+\n+\tif (upstream_bridge) {\n+\t\tret = pci_liveupdate_preserve_path(ser, upstream_bridge);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t} else if (!pci_is_root_bus(dev->bus)) {\n+\t\tpci_err(dev, \"Failed to preserve up to root port\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tret = pci_liveupdate_preserve_device(ser, dev);\n+\tif (ret)\n+\t\tgoto err;\n+\n+\treturn 0;\n+\n+err:\n+\tif (upstream_bridge)\n+\t\tpci_liveupdate_unpreserve_path(ser, upstream_bridge);\n+\n+\treturn ret;\n+}\n+\n+int pci_liveupdate_preserve(struct pci_dev *dev)\n+{\n+\tstruct pci_ser *ser;\n+\tint ret;\n+\n+\tguard(mutex)(&pci_flb_outgoing_lock);\n+\n+\tret = liveupdate_flb_get_outgoing(&pci_liveupdate_flb, (void **)&ser);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (!ser)\n+\t\treturn -ENOENT;\n+\n+\tif (dev->is_virtfn)\n+\t\treturn -EINVAL;\n+\n+\tif (dev->liveupdate_outgoing)\n+\t\treturn -EBUSY;\n+\n+\treturn pci_liveupdate_preserve_path(ser, dev);\n+}\n EXPORT_SYMBOL_GPL(pci_liveupdate_preserve);\n \n void pci_liveupdate_unpreserve(struct pci_dev *dev)\n {\n-\tstruct pci_dev_ser *dev_ser;\n \tstruct pci_ser *ser = NULL;\n \tint ret;\n \n@@ -296,19 +368,9 @@ void pci_liveupdate_unpreserve(struct pci_dev *dev)\n \tif (ret || !ser) {\n \t\tpci_warn(dev, \"Cannot unpreserve device without outgoing Live Update state\\n\");\n \t\treturn;\n-\n-\t}\n-\n-\tdev_ser = dev->liveupdate_outgoing;\n-\tif (!dev_ser) {\n-\t\tpci_warn(dev, \"Cannot unpreserve device that is not preserved\\n\");\n-\t\treturn;\n \t}\n \n-\tpci_info(dev, \"Device will no longer be preserved across next Live Update\\n\");\n-\tser->nr_devices--;\n-\tmemset(dev_ser, 0, sizeof(*dev_ser));\n-\tdev->liveupdate_outgoing = NULL;\n+\tpci_liveupdate_unpreserve_path(ser, dev);\n }\n EXPORT_SYMBOL_GPL(pci_liveupdate_unpreserve);\n \n@@ -428,6 +490,25 @@ void pci_liveupdate_cleanup_device(struct pci_dev *dev)\n \t\tpci_liveupdate_flb_put_incoming();\n }\n \n+static void pci_liveupdate_finish_path(struct pci_dev *dev)\n+{\n+\tstruct pci_dev *upstream_bridge = dev->bus->self;\n+\n+\tif (upstream_bridge)\n+\t\tpci_liveupdate_finish_path(upstream_bridge);\n+\n+\t/*\n+\t * Decrement the refcount so this device does not get treated as an\n+\t * incoming device again, e.g. in case pci_liveupdate_setup_device()\n+\t * gets called again becase the device is hot-plugged.\n+\t */\n+\tif (--dev->liveupdate_incoming->refcount)\n+\t\treturn;\n+\n+\tpci_info(dev, \"Device is finished participating in Live Update\\n\");\n+\tdev->liveupdate_incoming = NULL;\n+}\n+\n void pci_liveupdate_finish(struct pci_dev *dev)\n {\n \tif (!dev->liveupdate_incoming) {\n@@ -435,15 +516,7 @@ void pci_liveupdate_finish(struct pci_dev *dev)\n \t\treturn;\n \t}\n \n-\tpci_info(dev, \"Device is finished participating in Live Update\\n\");\n-\n-\t/*\n-\t * Drop the refcount so this device does not get treated as an incoming\n-\t * device again, e.g. in case pci_liveupdate_setup_device() gets called\n-\t * again becase the device is hot-plugged.\n-\t */\n-\tdev->liveupdate_incoming->refcount = 0;\n-\tdev->liveupdate_incoming = NULL;\n+\tpci_liveupdate_finish_path(dev);\n \n \t/* Drop this device's reference on the incoming FLB. */\n \tpci_liveupdate_flb_put_incoming();\n", "prefixes": [ "v4", "06/11" ] }