Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 2D2AE325734 for ; Mon, 8 Dec 2025 06:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765175724; cv=none; b=eErWxsJWdcyiqURusu7T0bYFhiM/URyraupEhpi0PXKErlCKXU+mt6+YqsKiKhhBnr31bosqkkT/qSgG6B7s1p7Q7q+I9rAT5/nyKzCbjKxUPOUgWWj927EyZsUDR9lT4B2N6bR0NHWrtHGAMXz39yX21ExG6rU2I2s4j1et0bk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765175724; c=relaxed/simple; bh=2GydyHzS/ywwcJWJ/6Lv+J8+IsG8iY/dtOzVd9HlnR4=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=if7ifGdJYh0TBSI0zVMu0PI3k0zzIOnOLkzvhnsxLS9MI1XehSsmLIWX/Re1ooqHWZ4Dy1rFUzNtzu+WyG/MA5gdcmffoMEBQdw6MHbno/jzh5gk/qZL/APrKjTnG7VesQGOtxysBXf3NuvMSuVJOzBNFd2+Zf5CTGnZUVf3tvs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jasonmiu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=QmM058G4; arc=none smtp.client-ip=209.85.215.201 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=flex--jasonmiu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="QmM058G4" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-ba4c6ac8406so3631198a12.0 for ; Sun, 07 Dec 2025 22:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765175722; x=1765780522; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=ZqyNPlmDIsr9igOdfXIDir5SMEz9QXEH46sRqM37UGQ=; b=QmM058G4+7wxPljq7+vmBNYgX607G5F93l363aPLIB/f08RbWslYH1fjsyqef07GDk 8iha8/Hnkgr2VAcB3arUOb1jkfrD5xYnnky7KAXeGGG6t1EDtyUg/Q9B6DVCJu0Mmx3X kOMn03nH/cBlA4cxzQLFXBnrzvR21XAmvdb0Z3NMS+xFLY1L2gIJ2NqVO9Zcspvs0Eqd dA/T/8iKQwga9VpO+9bjhiRdkL6nVtsh543Sn7Lh3PbeX2+V5boLxVNbaCAMgj4aBN7r ZxzFQgGmpqnr0P3O4kYIgZGE1kaku9KkOyAsxIc17ogK59m4TtomjXNqLhchnCf6dG4R o9jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765175722; x=1765780522; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZqyNPlmDIsr9igOdfXIDir5SMEz9QXEH46sRqM37UGQ=; b=l/UWoQZnfCJsANBW31/mfCd3ECITvAp8p3KGRPTxQTyPUhK9QSHyuRkTTIupxBCdR8 ByofN6g/di8GzeQi80f5LNomq9VichR+L2wlW5NpStbOZiByIUCgK8bMgPro1d3legWV PpWEHmXQ+9OPoT0VXh5pHDe6OBpKueRrClqCzPRs1IRCKdC1/MhTluKyfMNGOUWMMlsC Z7PKydWZ2A7MIcj6G0Vc+GZu0Lbnlo28DYC0EHccZ7mKFkRRiXgPgzgB4Q5/OIXoM96A u9be5W23Sb+0wkfyOeRefuuFrafL2HK77nm7lb62WWwAGIK3P9Yy+SbmHolJQIX+n00K Dz5g== X-Forwarded-Encrypted: i=1; AJvYcCXw6ywyyBLsIs4V9wXZ1YOSidnuuDZ45whPF1zJrk1dl/MgAO+02L6FZ1LALiosdyGJJMY8le1PaKV52h4=@vger.kernel.org X-Gm-Message-State: AOJu0YzaT7y3aNL1rUfs04Rqwdur7vvKXYIyunuPDEkkgub67jiGUG0i E+ZGMCXnZbhuV0Vg8twib9BKud9OUhPkupGAXe6NDVNLo05CMBQ+2ptTt4MhF63A/nK3ZDH2f4o 2isfkLHPR5nnsSg== X-Google-Smtp-Source: AGHT+IHAI3z1pMXzyBPNpREzJHkOBRWhaGBqjtnbPcPl9gXNFuPCdYXbJdbTdfH/iA28L93uYP4ZI3E2jt+oqw== X-Received: from dygg16.prod.google.com ([2002:a05:693c:80d0:b0:2ab:9753:da7]) (user=jasonmiu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:7187:b0:2a4:3593:ddd4 with SMTP id 5a478bee46e88-2abc70f78e9mr2666178eec.1.1765175722204; Sun, 07 Dec 2025 22:35:22 -0800 (PST) Date: Sun, 7 Dec 2025 22:35:09 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.223.gf5cc29aaa4-goog Message-ID: <20251208063513.3633942-1-jasonmiu@google.com> Subject: [PATCH 0/4] Make KHO Stateless From: Jason Miu To: Alexander Graf , Andrew Morton , Baoquan He , Changyuan Lyu , David Matlack , David Rientjes , Jason Gunthorpe , Jason Miu , Mike Rapoport , Pasha Tatashin , Pratyush Yadav , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" This series transitions KHO from an xarray-based metadata tracking system with serialization to using a radix tree data structure that can be passed directly to the next kernel. The key motivations for this change are to: - Eliminate the need for data serialization before kexec. - Remove the KHO finalize state. - Pass preservation metadata more directly to the next kernel via the FDT. The new approach uses a radix tree to mark preserved pages. A page's physical address and its order are encoded into a single value. The tree is composed of multiple levels of page-sized tables, with leaf nodes being bitmap tables where each set bit represents a preserved page. The physical address of the radix trees root is passed in the FDT, allowing the next kernel to reconstruct the preserved memory map. This series is broken down into the following patches: 1. kho: Introduce KHO FDT ABI header: Adds a dedicated ABI header to define the FDT interface. 2. kho: Relocate vmalloc preservation structure to KHO ABI header Adds `struct kho_vmalloc` and related structs to the ABI header. 3. kho: Adopt radix tree for preserved memory tracking: Replaces the xarray-based tracker with the new radix tree implementation and increments the ABI version. 4. kho: Remove finalize state and clients: Removes the now-obsolete kho_finalize() function and its usage from client code and debugfs. --- Changes in v3: - The preserved memory tracking data structures is defined in the ABI header. - Relocate the `kho_vmalloc` struct and its helper macro to the KHO ABI header to formalize its status as a stable ABI. - Export the core radix tree manipulation functions as a public API to support broader use by other kernel subsystems. - Update the documents. - Inline comments have been cleaned up. --- Jason Miu (4): kho: Introduce KHO FDT ABI header kho: Relocate vmalloc preservation structure to KHO ABI header kho: Adopt radix tree for preserved memory tracking kho: Remove finalize state and clients Documentation/admin-guide/mm/kho.rst | 46 +- Documentation/core-api/kho/bindings/kho.yaml | 43 -- .../core-api/kho/bindings/sub-fdt.yaml | 27 - Documentation/core-api/kho/concepts.rst | 28 +- Documentation/core-api/kho/fdt.rst | 84 +-- Documentation/core-api/kho/index.rst | 1 + Documentation/core-api/kho/radix_tree.rst | 17 + include/linux/kexec_handover.h | 27 +- include/linux/kho/abi/kexec_handover.h | 268 +++++++ include/linux/kho/abi/memfd.h | 2 +- include/linux/kho_radix_tree.h | 81 ++ kernel/liveupdate/kexec_handover.c | 694 +++++++++--------- kernel/liveupdate/kexec_handover_debugfs.c | 20 - kernel/liveupdate/kexec_handover_internal.h | 3 - kernel/liveupdate/luo_core.c | 12 +- kernel/liveupdate/luo_flb.c | 2 +- lib/test_kho.c | 1 + tools/testing/selftests/kho/init.c | 20 - 18 files changed, 765 insertions(+), 611 deletions(-) delete mode 100644 Documentation/core-api/kho/bindings/kho.yaml delete mode 100644 Documentation/core-api/kho/bindings/sub-fdt.yaml create mode 100644 Documentation/core-api/kho/radix_tree.rst create mode 100644 include/linux/kho/abi/kexec_handover.h create mode 100644 include/linux/kho_radix_tree.h base-commit: 7d31f578f3230f3b7b33b0930b08f9afd8429817 -- 2.52.0.223.gf5cc29aaa4-goog