From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (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 2BB003090C6 for ; Fri, 16 Jan 2026 03:44:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768535078; cv=none; b=j5mCiY+Hnq99X4kcCMa+mM6aHQ3DQ05vyS2VVDd8UC6D2q2xRsqDlDvFkIR/d16bI9wofZ4BRRV39RgBT6xFTi15ZIY7CNF92vbYr98a3RgBDLBaiVHZ3IUWx2zrKit3SqZZ4JnjXPFad4mch2AMn6IuLTBCP0eED51jNtVwe+s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768535078; c=relaxed/simple; bh=T6Qe9t37WW2pjl2WnLAqSrA7BPJnebh0ifll9wu+eCs=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=j1JKDka414bCwfN1d0BqvqbWKCEk1b2Jh8qic3UVTDpjnpEnSjzVbPL8NMFJVP8sMOTBw+PkMeoIRhvS/T8cW6Jn6lfpN8xcIOVPVKF8WQwITvtvNYNewco46cIzGg9/h7DD+k3L5y2nwMMTxDyCABI+FtqAr0pax5Rm3lNbrZY= 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=mIjLQHsc; arc=none smtp.client-ip=74.125.82.74 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="mIjLQHsc" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-11b9786fb51so10332609c88.1 for ; Thu, 15 Jan 2026 19:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768535076; x=1769139876; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=XajjLO2IfEQWNmg3arj/S1hgJxiIRRitST6jLheATpY=; b=mIjLQHscUxraDIQJTBDeFp/CEPD5wxN9dAKIx/jU0Ob1tEKsTy2/u3QmGmgdQEjQAw 8vm4cR7XDQE/hD58UjBz1fl2g7HLfPgde8TO86RNmZIaaIy7I2/xo4Z04La51e7zlwUh K9Q2Ky5ecPbx5R/ETmn1mugphO8STASZrypGQfadmzEn6JCv+Rm6akabaC4VTSFIiZpD 0QU9vnMX3dg3m7coOglb8zMSQtrigh7TmaPiAeAm2GI/F5EEXks8oaEyICjDfIC4drVU R6M8SgGeJ0YMh019w8V+71QjJEDAyJDyC/rr0tw4xMeem7MkvBhS2VfyzgLIEK7+01B+ JJrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768535076; x=1769139876; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XajjLO2IfEQWNmg3arj/S1hgJxiIRRitST6jLheATpY=; b=CKeVAhsU3JYpcU0o/Fd158dxJhfXHOPm3Oy2M3dxg3j84oBozdIuBS7p/lsZuthrnR Pj/NIrJrfrfZ7xu/8USZZ+bZP2z4wSdZy0m2UNL+kSBaUk8WMsgzSKxaVCrdPn7fV//c 75xU2v9Z64/7B8f3zLDclmqy0AqccYprdM3mBkeiGXZ6gi6/kWyi0BSA/fFCv0ZVUgf6 KnBBYeS2LaX6budc/Ik+qGL9hFg3mQ4PfJEKdmdwhv+7REqaw2hxWPlfjvYH/4cDMrii Nk8skb82i6u5Gk9Nbtcwg+JzpT8XZntYjYXePxQ+JEWVAyLZoO/W0cPZJqqlbJh0Bgmo sMvQ== X-Forwarded-Encrypted: i=1; AJvYcCXSJaqzq0Oa9Jga+4WinlhOuw6pDeb/0MaPo3q6G+3+u6hVbnn/VrRaxd4VvZCyQl7q85245dO/wlN+UP8=@vger.kernel.org X-Gm-Message-State: AOJu0YwqlGZ4IuZxyxV0ZNPYqjIL/10KOkKxppsDB9ClDtMdS48y/hWm 6ctN2A6kxsIOQ0Douw0JoPpVy0J0y3kL2NioJzDsmCwu3l4WRr+TVtEpjUdf/kz1OVegAFQFYTL DSHVVa8NxWYhxDQ== X-Received: from dlkk2.prod.google.com ([2002:a05:7022:6082:b0:11b:b064:f5dc]) (user=jasonmiu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:a8a:b0:11b:9386:825c with SMTP id a92af1059eb24-1244a791c71mr1740076c88.41.1768535076050; Thu, 15 Jan 2026 19:44:36 -0800 (PST) Date: Thu, 15 Jan 2026 19:44:30 -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: <20260116034432.1520731-1-jasonmiu@google.com> Subject: [PATCH v7 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 v6 [1]: - Fixed a potential dangling pointer in kho_radix_add_page() on allocation failure - Fixed a premature return in __kho_radix_walk_tree() - Corrected the size type in kho_preserved_memory_reserve() to match memblock_reserve() [1] https://lore.kernel.org/lkml/20260115230047.1220580-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 | 144 +++- include/linux/kho_radix_tree.h | 70 ++ kernel/liveupdate/kexec_handover.c | 695 ++++++++++---------- 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, 573 insertions(+), 473 deletions(-) create mode 100644 include/linux/kho_radix_tree.h base-commit: 9b7977f9e39b7768c70c2aa497f04e7569fd3e00 -- 2.52.0.457.g6b5491de43-goog