From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (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 01C682D7DCE for ; Tue, 13 Jan 2026 05:35:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768282532; cv=none; b=Dv70xfdXido56l3cvzhNBAaozQBAWnU8mCaSMpOVYH8KDp+AihHa8n+ESXgxae5zIvc1ZGC8UUo7hb+e7NvoZStzUUTSYiAMUI8xfuuNtC2sikpd8Sz/6YpSxflG6S+xG4bc3hWDytI/U3Mtt0H1wOlr4IG1qqe720iU5mjbhdQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768282532; c=relaxed/simple; bh=Ic6R+In0Rdy/JcSNstJqI0PlESGfaoyW0zRQW0puYIw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=VJg0woijAuetROtvC5EZ2bw6zJdQr57ZZQyjhf8JvB/YyfGqo0gSQqCcG81D3dI+TgqyZNM12LtW1ws0rvyQXR08dD9rMhK15sRxQqtfFwVjJUQr+UFCD3Kn5JIJpjwcUE3+MfP6GAAmBrNf3QwAnS0fLaf/6tTaHYUv4D/IUb0= 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=fnmgaoFW; arc=none smtp.client-ip=74.125.82.202 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="fnmgaoFW" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2ae29a21e7eso4178402eec.0 for ; Mon, 12 Jan 2026 21:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768282528; x=1768887328; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=9CxZpP/TD91KuOGl9bFKk1rpeztgtL+/Anznpdt7LJs=; b=fnmgaoFWkncwl5W+1Ihv9fFpV3BB9n/DI2thZQhAVesPcJVsYNGZEioN8TWoSq2gmM kuII0oNdqPzy1qy+QIrqQY0hG1qTJRlzjmWC0TNtMmmFvLzB6Kf9QCGz7Y03M3oLX8PH u5l+695lr7kmNlNk/+Jk2AV6IgBHeWgXG5BJFbCUushjdw6mlTlmmwiRx7JHYbdyXgcn W8BzZfTOqoUNLF8oV5I+GhKxTSL3OBVi/rSsANQeFQaC4CFI+ABMw8RW4BNCbZyKNY9F S60qJWpeYkZ+eh+Ni1veF5+EN+ltpgzpankvVVMG+rnC5Z/i3ff8K/CwfIcuXy0v30xB o7Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768282528; x=1768887328; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9CxZpP/TD91KuOGl9bFKk1rpeztgtL+/Anznpdt7LJs=; b=p1GWo3AdrMuVW71ER/KCoHZhwZiORs2SCwTBffNrwV3sFJlX1IFO8c7e9E0wz+ww6s jynmaYpi8B38U0yCA2Dpxd0DyJAkUVin4KsBJSZOP8Cy3O9q9Nt1VzG0tTofyMrc/lmQ 88ObmQCew0LVA1p56bBDfvfzopMt0vS/AelVGOmfqElYKoS9yzocR5I/9XH/LIuK7OVR 6t42YbrF6+ZtnQUwU3TTLdmZSe+tJdT1VWdOUMyxzQzAAF4PVYJlrgvgUtR4x/aeAkfH 1tAvMxqKG4Fle3wWxlNY4FXhvHzkURnBis5+KvXCOTaqponmZUIPuh7Kf+vewZtSwu7u igcw== X-Forwarded-Encrypted: i=1; AJvYcCV6kZlyCF9/0aomX4KvJMMlf++7VMdFDJcw+HkxM0jzKnbDSJ60pr+gVBReHzZlKOZAgUAFamAisBszxNk=@vger.kernel.org X-Gm-Message-State: AOJu0YwGuixW8ANMh2Z90yaVmNnQ0dt18TjCDKKI9xuealFzjNpKG3wJ 2T2xjM528lTCgAcCFHmjMVDqxDV/m5xAuJN4RPNV0rEgiF7onRW9dmy5SSIt0vg7TCQnF95rb/6 ngrg+hzUY49ssTA== X-Received: from dybdr38.prod.google.com ([2002:a05:7300:b2a6:b0:2a4:733c:4a27]) (user=jasonmiu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:a148:b0:2ae:5a2e:de70 with SMTP id 5a478bee46e88-2b44f21b4b9mr1940864eec.8.1768282528208; Mon, 12 Jan 2026 21:35:28 -0800 (PST) Date: Mon, 12 Jan 2026 21:35:21 -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.457.g6b5491de43-goog Message-ID: <20260113053524.84186-1-jasonmiu@google.com> Subject: [PATCH v5 0/2] 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 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 bitmaps where each set bit represents a preserved page. The physical address of the radix tree's 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: Adopt radix tree for preserved memory tracking: Replaces the xarray-based tracker with the new radix tree implementation and increments the ABI version. 2. kho: Remove finalize state and clients: Removes the now-obsolete kho_finalize() function and its usage from client code and debugfs. --- Changelog since v4 [1]: - Removed the 'level' and 'start' arguments from the KHO radix tree API kho_radix_walk_tree(). - Removed locking of the KHO radix tree root during module initialization, as it is the sole user of the tree at that stage. - Renamed kho_radix_get_index() to kho_radix_get_table_index() and updated callers to invoke kho_radix_get_bitmap_index() explicitly for the bitmap (leaf) level. - Updated documentation to clarify that "page offset" is now referred to as "shifted physical address". [1] https://lore.kernel.org/lkml/20260109001127.2596222-1-jasonmiu@google.com/ --- Jason Miu (2): kho: Adopt radix tree for preserved memory tracking kho: Remove finalize state and clients Documentation/admin-guide/mm/kho.rst | 53 +- Documentation/core-api/kho/abi.rst | 6 + Documentation/core-api/kho/index.rst | 18 +- include/linux/kho/abi/kexec_handover.h | 141 +++- include/linux/kho_radix_tree.h | 70 ++ kernel/liveupdate/kexec_handover.c | 682 ++++++++++---------- kernel/liveupdate/kexec_handover_debugfs.c | 23 - kernel/liveupdate/kexec_handover_internal.h | 3 - kernel/liveupdate/luo_core.c | 12 +- kernel/liveupdate/luo_flb.c | 2 +- tools/testing/selftests/kho/init.c | 20 - 11 files changed, 557 insertions(+), 473 deletions(-) create mode 100644 include/linux/kho_radix_tree.h base-commit: f417b7ffcbef7d76b0d8860518f50dae0e7e5eda -- 2.52.0.457.g6b5491de43-goog