From mboxrd@z Thu Jan 1 00:00:00 1970 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 34C6022A4D6 for ; Tue, 9 Dec 2025 02:53: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=1765248804; cv=none; b=bkrZaKzR9Skxe4NW0WXT58QMbsWTBXHxDcKOjlLlshl2OdsOjtuJfeZRk0oxKzlee+5YY61m+ZwEMQTQPxiz+wjXZpL1WyvRY1KVCYdR9gV+Ue03B6eB0D1c0ldCL170RzL8IaJ7VF/5vsDZhp/w8SJZNjsn1gL9eve4fLs8b3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765248804; c=relaxed/simple; bh=z7VMwJkHmyuc7K4VubtPOxNIQj4tFzxvb2mypCrIKGw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=jlxE8doG/RFwrrs8iK6O0N1OCMPm3i7KHBFsUVr0/a1jHdMMOLD2hj4uBzAZzuxRrqFfY1nE9V5uwhnDo5DjqUcH5nj8rekhoajYngED+cNYKMuyD7ca0DIIudv+SMP5HGEx3JbAAFxrZ7Gc3W/X5j5EtkKFLkbxEXYvoOJtgWs= 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=fsmi/ag9; 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="fsmi/ag9" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-b993eb2701bso5175142a12.0 for ; Mon, 08 Dec 2025 18:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765248802; x=1765853602; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=f9gZ+HAcVYxjhk69z2YeZ7p4VDGLij0no/oxgM8IiD0=; b=fsmi/ag921DLmANP2iMHbn351O24OutXlr7stBGW8WOxQPU7sWwtj4qXZS8z15liC+ /4YwAVx0TO97VGnDm2venHAie88hVQ93+02UHaVb1lcNjulolfM5yeeP2ez9Z6QBPYGO JgSxUbmfB0IYt4J2f+pAvokkAheszsamFwikkcZ/CWPibuq1os3i71VqM8IcMhA3yns2 wdFneoVdi2JGI5yVekooNqxJf5c1aiAL+m7m+uXUZ4GPNshxxDrjB8DR/beZMCRM81lr z+jnPkDZELia/dxRYVojFNQP5LQnCnEFdM0Tf3bHHO8YzyXMABKNJeZBPplkgx3TZUuL ixPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765248802; x=1765853602; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=f9gZ+HAcVYxjhk69z2YeZ7p4VDGLij0no/oxgM8IiD0=; b=wM+zgnaBLs5e3C6ElbYNdzQwln55Df4nf++6GpxSvvE6GqRdUSoHTpeIHzKYIDiTHK iUhqTCm8BUqCIiTBbN/LAwN9nEiuOr8Rsmjn/bQt2KyPWduTO2NdHIz9a4buh7yyrNXm 1JcPBmwBPXGbiguIjPRMeqLSBK51wAhZbCZ0FzlLiaIccrY1XsD4CqN1QsIgVtJmwRVj kTsqGoTjwBHdOTHx3eUUnknzpqYxaTXw6+4WMMcZkvgtLV32ZgL5/vYaJDo/C2ivzwYC ppq4PgKeS7WaEb4ny2bOzioxhXkW7wbxTezsfMOIaxTrR9zYcxx64lJfQXwIrAO2NTgI +eow== X-Forwarded-Encrypted: i=1; AJvYcCUzJ36oO09A7H+uDLmFjd63Ds6NP7/wQQFCHei+L3RxFY32aCF0rYGDC3sXn7Quz/ImDtjb2C8nWD0CKlQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxzr5J0fIfxAPeB2tXr3QJbTlfNnunn3CL3Ug+dQCEeHG0p1DoP U1yuNGvSZxN2CDVQfIr6uFBoN4db8TOgADBX5c2qGlkCM+voTMezlsq3JIQM0jx/EEuw2oMLNOA 5hryT/GcMhGliNw== X-Google-Smtp-Source: AGHT+IG4gpI9zqTEOKN9vzBYmrGxjK0E+Np3UyMM98Hh4RHj2KGXooaQHcs0e+c2q3YeS6uW268akwQ8U9IxFQ== X-Received: from dybtr7.prod.google.com ([2002:a05:7300:f547:b0:2a4:50ea:8fa8]) (user=jasonmiu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:8807:b0:2a7:343:399c with SMTP id 5a478bee46e88-2abc712a148mr3561851eec.16.1765248802275; Mon, 08 Dec 2025 18:53:22 -0800 (PST) Date: Mon, 8 Dec 2025 18:53:12 -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: <20251209025317.3846938-1-jasonmiu@google.com> Subject: [PATCH v3 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. --- Changelog since v2 [1]: - 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. [1] https://lore.kernel.org/lkml/20251020100306.2709352-1-jasonmiu@google.com/ --- 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