From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2D41C2D0CD for ; Thu, 15 May 2025 18:23:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC9B76B00A8; Thu, 15 May 2025 14:23:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D74DF6B00AA; Thu, 15 May 2025 14:23:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC77D6B00AB; Thu, 15 May 2025 14:23:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9BAC46B00A8 for ; Thu, 15 May 2025 14:23:28 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 75D711A0493 for ; Thu, 15 May 2025 18:23:29 +0000 (UTC) X-FDA: 83445964938.02.FDF04C7 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf17.hostedemail.com (Postfix) with ESMTP id 86C5040006 for ; Thu, 15 May 2025 18:23:27 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=YNzSRzBd; spf=pass (imf17.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.173 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1747333407; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=A0jheAFoxaIUcUfzIFzIBnTjDodf4OGSNMDK16pdaY4=; b=GzKFGoF718GOAEaM2ewUhzYZ/KvqPuBo2F01LoaJhBwP182Ed9Zh4qJeF0+Ksz6aTNMrZ/ jP98B8g0Jgh0E1T1ke+CqQEgQEg/1CkDau4EdeA46VZEqc9wBB6xZfhnZBy7VzdL4+7vsH rdf2e7DKssli9Xahze06e9+QRy1dQ48= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=YNzSRzBd; spf=pass (imf17.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.173 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1747333407; a=rsa-sha256; cv=none; b=bPhf4zMVMrygu8UGvKLies1ozAn0f6o1zkrzXkY/NDEjD7SSfzmi70Gov4Z2ZxC3fb/zgX 8YCQOJYEoBVHWMumm7zo5iQezc3UcbTzEzemayj+AJLMmbhwG5jJttzm8fChGt65qfDJKl erzV4gQpPpV0K0SPqcMvqTOuoxf5MpI= Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7c5675dec99so122169785a.0 for ; Thu, 15 May 2025 11:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1747333406; x=1747938206; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=A0jheAFoxaIUcUfzIFzIBnTjDodf4OGSNMDK16pdaY4=; b=YNzSRzBdq/JhVX/VmhVx/Eygb+xaMW9buVqwah8ihsbCMGjJcxUINA6MMECkk667Fh esdXBD/EFW2k7XRXmjsLH7clgQ46OGhcjOblNmlspNXGU4Qw+Wgo+hb4Z4Y/+JEAwyxC 0ENz+Ql1d86oSkHaCz+ZUaeGJVB6asedoUrEHIZcAYPSgbu7mRyiMreJpEJss2OkpZ4O zoDznstktN3r1V9suhYWXmZQcW4xd6bzhhFqNdh6F83afRualiTfSXFO7kx1JX32VBZe XJ681yqu+Cq/R0jrnUuqJIKqGtNQV9ej3nEe0oRAWGPCr6RMYAOKJRCoKzAqYklBgmed pvMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747333406; x=1747938206; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=A0jheAFoxaIUcUfzIFzIBnTjDodf4OGSNMDK16pdaY4=; b=tBbu5unF6ibhwt5CpivdXA+YiknIYl+2epo34/mFvussA/RcpVk5SwxptX/g7ZZU16 E1lZxvcEMU3THNgs6kbR/bFQoO6EdiwI3ANpxU5amSDzRCpyEe0XHx46VGFmTeIoIa/u YclQfwlV83zXRIpknebm/YUSeKhSUGHmf7fk5pNNovVo9Py/Qevl5NGzLpKVftvQh5g3 tTqu2KLv0WqqP1fqB1+mgjIyekNyumbI2T7rr7blkK84Q7ln0S//F2yfkhfmZhoEXjgJ +yQxBGbO2dVbAhJrEmjPt3G4nhE+4dgxrQg2SsxY4Fh4l4EI3GGuCvoAnNkzveJ+37ST ip8g== X-Forwarded-Encrypted: i=1; AJvYcCXL5+/t40Qceb7jGTnkOzqS2zxzJiXRT5MdCYH/hqc7VU+S3edEkONU3kuu5bcjBphnJRUfF3gHLQ==@kvack.org X-Gm-Message-State: AOJu0YzM3b9lURX2yvPBnKFmEtkroPr8qBAy7Dn4L4Y8cALCJfpMcNwz lipWOKlFyb9Oxfa0Az0iHbKru2D5lsIp0Slf8+VJZB9N7ZT7ZYkm2oGAfX7rLP6U3Bo= X-Gm-Gg: ASbGnctVhXQliwdJRq4AhovF4sWM5jQXEZHFPjd5M33ikeH8nz5DUmpGVMGJNhbtMrL kawIuUDZIT+31GpZ/LMB3+biZQm/6CrBs/HSUsDmQ0mUcMZ91U7TszAQDZL/oWl49bC5ua1Av44 DwI2QU+kK6dGBdh5z3qJVA1z5HQMviKNBXk78l4pCwl/VM+TMCFvs1LWGkP/2r/5CtRnCBzDRcO TxX3TE6HzgGfrnciQUEzx/7uURjykc2UsuBb88BcoCO2Qyqkp1atPrKvfIJ5NylBgxSpd1iDNKq KRfKmgv25ZUVXbEimOK1EUpqDT5ceGPVUGHWiuMfPl6ZDr4PG5CASfKmTZYckhizzlTGJiGezsV PxpuvSgaKI+qj3+/AF5ERU6rV1y6La36t8k2BFFnPx0Ax X-Google-Smtp-Source: AGHT+IGaP37dLC0NYarBXoAi3DGllHD5VhY+J/RcWIfEL0jL4jdfyJMjPFWTgN13G/j982eFmRP46g== X-Received: by 2002:a05:620a:3199:b0:7c9:6707:b466 with SMTP id af79cd13be357-7cd46718950mr63091585a.11.1747333406587; Thu, 15 May 2025 11:23:26 -0700 (PDT) Received: from soleen.c.googlers.com.com (138.200.150.34.bc.googleusercontent.com. [34.150.200.138]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cd466fc2afsm18218685a.0.2025.05.15.11.23.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 May 2025 11:23:26 -0700 (PDT) From: Pasha Tatashin To: pratyush@kernel.org, jasonmiu@google.com, graf@amazon.com, changyuanl@google.com, pasha.tatashin@soleen.com, rppt@kernel.org, dmatlack@google.com, rientjes@google.com, corbet@lwn.net, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, kanie@linux.alibaba.com, ojeda@kernel.org, aliceryhl@google.com, masahiroy@kernel.org, akpm@linux-foundation.org, tj@kernel.org, yoann.congal@smile.fr, mmaurer@google.com, roman.gushchin@linux.dev, chenridong@huawei.com, axboe@kernel.dk, mark.rutland@arm.com, jannh@google.com, vincent.guittot@linaro.org, hannes@cmpxchg.org, dan.j.williams@intel.com, david@redhat.com, joel.granados@kernel.org, rostedt@goodmis.org, anna.schumaker@oracle.com, song@kernel.org, zhangguopeng@kylinos.cn, linux@weissschuh.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rafael@kernel.org, dakr@kernel.org, bartosz.golaszewski@linaro.org, cw00.choi@samsung.com, myungjoo.ham@samsung.com, yesanishhere@gmail.com, Jonathan.Cameron@huawei.com, quic_zijuhu@quicinc.com, aleksander.lobakin@intel.com, ira.weiny@intel.com, andriy.shevchenko@linux.intel.com, leon@kernel.org, lukas@wunner.de, bhelgaas@google.com, wagi@kernel.org, djeffery@redhat.com, stuart.w.hayes@gmail.com, ptyadav@amazon.de Subject: [RFC v2 00/16] Live Update Orchestrator Date: Thu, 15 May 2025 18:23:04 +0000 Message-ID: <20250515182322.117840-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.49.0.1101.gccaa498523-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: x8cscp8c7ej9x186ijjpjy4afbx8aqoj X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 86C5040006 X-HE-Tag: 1747333407-822630 X-HE-Meta: U2FsdGVkX1+fUvf3NKrZtyC6AEWJzuIq2eP+6OlMXRufayrAbxxFvfPRP1eiqL+SjYt8G66M5jtDslhzZf5xZbURr6G4puvPIU3rN4iO+wbJhOlmLin/4CdXGRi1SgRNsxggNMebb3w7mUe0CEIRNvXiQ/qICNDa0JuYcGdELTmPnZ2f3FUGuAJdRy+l8h2ioo282Orlw+kok56iKQWaC+pVvRysia+MU+IQWM2O6DfcDxLjf5CmWT461S8bdehnVHyjKCaSB5Udmc88p6eGpv/VxSdIi5n/oDzswyQxEf/cGcB2pJeoTEcGKl9xADBWQh+RnY5cdIxHuQ9AFl6AG9wNDBowt8QKu1d5XUdU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I2QOfKdAHsamLM38S9dR3qQ8a9sfHta4WGGoZnyynvY8FpOrKBqneH2IOvH0RtfP22PJm84VWRboci2sh8GWs237w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This v2 series introduces the LUO, a kernel subsystem designed to facilitate live kernel updates with minimal downtime, particularly in cloud delplyoments aiming to update without fully disrupting running virtual machines. This series builds upon KHO framework [1] by adding programmatic control over KHO's lifecycle and leveraging KHO for persisting LUO's own metadata across the kexec boundary. The git branch for this series can be found at: https://github.com/googleprodkernel/linux-liveupdate/tree/luo/rfc-v2 Changelog from v1: - Control Interface: Shifted from sysfs-based control (/sys/kernel/liveupdate/{prepare,finish}) to an ioctl interface (/dev/liveupdate). Sysfs is now primarily for monitoring the state. - Event/State Renaming: LIVEUPDATE_REBOOT event/phase is now LIVEUPDATE_FREEZE. - FD Preservation: A new component for preserving file descriptors. Subsystem Registration: A formal mechanism for kernel subsystems to participate. - Device Layer: removed device list handling from this series, it is going to be added separately. - Selftests: Kernel-side selftest hooks and userspace selftests are now included. KHO Enhancements: - KHO debugfs became optional, and kernel APIs for finalize/abort were added (driven by LUO's needs). - KHO unpreserve functions were also added. What is Live Update? Live Update is a specialized reboot process where selected kernel resources (memory, file descriptors, and eventually devices) are kept operational or their state preserved across a kernel transition (e.g., via kexec). For certain resources, DMA and interrupt activity might continue with minimal interruption during the kernel reboot. LUO v2 Overview: LUO v2 provides a framework for coordinating live updates. It features: State Machine: Manages the live update process through states: NORMAL, PREPARED, FROZEN, UPDATED. KHO Integration: LUO programmatically drives KHO's finalization and abort sequences. KHO's debugfs interface is now optional configured via CONFIG_KEXEC_HANDOVER_DEBUG. LUO preserves its own metadata via KHO's kho_add_subtree and kho_preserve_phys() mechanisms. Subsystem Participation: A callback API liveupdate_register_subsystem() allows kernel subsystems (e.g., KVM, IOMMU, VFIO, PCI) to register handlers for LUO events (PREPARE, FREEZE, FINISH, CANCEL) and persist a u64 payload via the LUO FDT. File Descriptor Preservation: Infrastructure liveupdate_register_filesystem, luo_register_file, luo_retrieve_file to allow specific types of file descriptors (e.g., memfd, vfio) to be preserved and restored. Handlers for specific file types can be registered to manage their preservation and restoration, storing a u64 payload in the LUO FDT. Example WIP for memfd preservation can be found here [2]. User-space Interface: ioctl (/dev/liveupdate): The primary control interface for triggering LUO state transitions (prepare, freeze, finish, cancel) and managing the preservation/restoration of file descriptors. Access requires CAP_SYS_ADMIN. sysfs (/sys/kernel/liveupdate/state): A read-only interface for monitoring the current LUO state. This allows userspace services to track progress and coordinate actions. Selftests: Includes kernel-side hooks and userspace selftests to verify core LUO functionality, particularly subsystem registration and basic state transitions. LUO State Machine and Events: NORMAL: Default operational state. PREPARED: Initial preparation complete after LIVEUPDATE_PREPARE event. Subsystems have saved initial state. FROZEN: Final "blackout window" state after LIVEUPDATE_FREEZE event, just before kexec. Workloads must be suspended. UPDATED: Next kernel has booted via live update. Awaiting restoration and LIVEUPDATE_FINISH. Events: LIVEUPDATE_PREPARE: Prepare for reboot, serialize state. LIVEUPDATE_FREEZE: Final opportunity to save state before kexec. LIVEUPDATE_FINISH: Post-reboot cleanup in the next kernel. LIVEUPDATE_CANCEL: Abort prepare or freeze, revert changes. [1] https://lore.kernel.org/all/20250509074635.3187114-1-changyuanl@google.com https://github.com/googleprodkernel/linux-liveupdate/tree/luo/kho-v8 [2] https://github.com/googleprodkernel/linux-liveupdate/tree/luo/memfd-v0.1 RFC v1: https://lore.kernel.org/all/20250320024011.2995837-1-pasha.tatashin@soleen.com Changyuan Lyu (1): kho: add kho_unpreserve_folio/phys Pasha Tatashin (15): kho: make debugfs interface optional kho: allow to drive kho from within kernel luo: luo_core: Live Update Orchestrator luo: luo_core: integrate with KHO luo: luo_subsystems: add subsystem registration luo: luo_subsystems: implement subsystem callbacks luo: luo_files: add infrastructure for FDs luo: luo_files: implement file systems callbacks luo: luo_ioctl: add ioctl interface luo: luo_sysfs: add sysfs state monitoring reboot: call liveupdate_reboot() before kexec luo: add selftests for subsystems un/registration selftests/liveupdate: add subsystem/state tests docs: add luo documentation MAINTAINERS: add liveupdate entry .../ABI/testing/sysfs-kernel-liveupdate | 51 ++ Documentation/admin-guide/index.rst | 1 + Documentation/admin-guide/liveupdate.rst | 62 ++ .../userspace-api/ioctl/ioctl-number.rst | 1 + MAINTAINERS | 14 +- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/liveupdate/Kconfig | 60 ++ drivers/misc/liveupdate/Makefile | 7 + drivers/misc/liveupdate/luo_core.c | 547 +++++++++++++++ drivers/misc/liveupdate/luo_files.c | 664 ++++++++++++++++++ drivers/misc/liveupdate/luo_internal.h | 59 ++ drivers/misc/liveupdate/luo_ioctl.c | 203 ++++++ drivers/misc/liveupdate/luo_selftests.c | 283 ++++++++ drivers/misc/liveupdate/luo_selftests.h | 23 + drivers/misc/liveupdate/luo_subsystems.c | 413 +++++++++++ drivers/misc/liveupdate/luo_sysfs.c | 92 +++ include/linux/kexec_handover.h | 27 + include/linux/liveupdate.h | 214 ++++++ include/uapi/linux/liveupdate.h | 324 +++++++++ kernel/Kconfig.kexec | 10 + kernel/Makefile | 1 + kernel/kexec_handover.c | 343 +++------ kernel/kexec_handover_debug.c | 237 +++++++ kernel/kexec_handover_internal.h | 74 ++ kernel/reboot.c | 4 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/liveupdate/.gitignore | 1 + tools/testing/selftests/liveupdate/Makefile | 7 + tools/testing/selftests/liveupdate/config | 6 + .../testing/selftests/liveupdate/liveupdate.c | 440 ++++++++++++ 31 files changed, 3933 insertions(+), 238 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-kernel-liveupdate create mode 100644 Documentation/admin-guide/liveupdate.rst create mode 100644 drivers/misc/liveupdate/Kconfig create mode 100644 drivers/misc/liveupdate/Makefile create mode 100644 drivers/misc/liveupdate/luo_core.c create mode 100644 drivers/misc/liveupdate/luo_files.c create mode 100644 drivers/misc/liveupdate/luo_internal.h create mode 100644 drivers/misc/liveupdate/luo_ioctl.c create mode 100644 drivers/misc/liveupdate/luo_selftests.c create mode 100644 drivers/misc/liveupdate/luo_selftests.h create mode 100644 drivers/misc/liveupdate/luo_subsystems.c create mode 100644 drivers/misc/liveupdate/luo_sysfs.c create mode 100644 include/linux/liveupdate.h create mode 100644 include/uapi/linux/liveupdate.h create mode 100644 kernel/kexec_handover_debug.c create mode 100644 kernel/kexec_handover_internal.h create mode 100644 tools/testing/selftests/liveupdate/.gitignore create mode 100644 tools/testing/selftests/liveupdate/Makefile create mode 100644 tools/testing/selftests/liveupdate/config create mode 100644 tools/testing/selftests/liveupdate/liveupdate.c -- 2.49.0.1101.gccaa498523-goog