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 4DD8A2745E for ; Fri, 9 Jan 2026 00:11:32 +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=1767917493; cv=none; b=q6Uz0UWcXTT0oauzIXgMMEuR59mMXB5d5ImGqK09zm7FBWDRT9b3+bAKOs52AXo46xg10j196LmLUB3qY/KRF6f5KROeJsuVAcbYFrl1SZg4SI0QJySst5ouxyxQTl83qKsTXfvetYx60q9i9vNCNSdMu/m2ATk913EmM4xPnbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767917493; c=relaxed/simple; bh=/SueOBcXEIPp74X7ez211CAWC6xc2GLIiE3T/4/Yd/Q=; h=Date:Mime-Version:Message-ID:Subject:From:To:Content-Type; b=f79H3cMuL/8A/nwsUT5IOd5n3B94R34/w0IWys29QGRZTqDtQg44TFwIILWsuJFTrEAGdNo8De+6iw2xx3szEbQq2d6XhIFXzIbVGTlZnrh3V33zXfybuOqZiUEhalHWMQGSjcImuY4jp3x6OAX7L7EsRnJq932MbkX1TxT7vcU= 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=2hTTU/iq; 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="2hTTU/iq" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-2ac363a9465so2847965eec.0 for ; Thu, 08 Jan 2026 16:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767917491; x=1768522291; darn=vger.kernel.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=VNtmiXXVMpIpjKeokSIj374jlcsqfD2I2+s5Exq8j0M=; b=2hTTU/iq+8DCEumj+7DWaXYXk+CkUkl9fNImAReCF2cu4dy1gGXJ9xaS2vFqsKhgJ1 xo6hecCHxLgPV93nkr8ERarhcYl5AxVwmEPYorv4ADAh6o/Rngjcb+aPnlnf6jBK0Zyq Wyf7YVQLvnNWuXK1rqIB9K94jXRfzDZk1EL4s5shZfbeJ9y2VEcfgA/SXbBXItEwZw7A mlB22vnx9K+ZTfIhhHlCNDK7DavBVw+p5JCRYUlVIe3CaDJS5v/QjCZWYBc+oT3hIYUl /mDhvgLN461m0asfvYVO8C4hrokjXLoOUstA5C4qNxXX6Kmhkcff1/poZm8LgmMvUG5J BZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767917491; x=1768522291; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VNtmiXXVMpIpjKeokSIj374jlcsqfD2I2+s5Exq8j0M=; b=mSV56PD1Qrrmt5+AY5JCt0YxV5MIppcOsQ4achqeVUlMRZfXYwk2pw80L7veRY+TNW ZEh8+CBbT38fP+5on/DwLPbSZSDQqTXkA4UGAtWQtPJnLP9JaaRewPNVMCh3yKyVbpfJ Mq6pauw4LVgX6l98r0SBja3xn6TouMv99HGCSkIRDzCvnzetNK0MLqXn0bTjgFomPK57 FYyYEm52xpPH6ARwi6mDLbcpEw+d08d7n6icM9xOei6sBcoMhrtbrZ/h2+pduumS1yio ww+6YESuleJz7Qlvw5hIulu8FLuC52hbV+ErD75dZ0dB2VWBARPqV4ihOJyWCqAE+Sun pbUQ== X-Forwarded-Encrypted: i=1; AJvYcCVDfcxF7ITLaSXyb7f9Gmcjdvx0dZ1ZWgrQzPxlxN8DAV7mOYZZwegFbo5ZHSDwbqVumvCIBUS/aql429U=@vger.kernel.org X-Gm-Message-State: AOJu0YzPPgXTkt2TMLAbbtbzE73Gqy5He1qdwkh+sHwyIzuk84Uyos7F KqGkaMZe/2pQ16ihSLOLM1S7CkX4EgY6K2z9sStUwiu0rbi4qLexW2Anz2ngoVTzImeMQd/7I6+ m3Pn+zgOaJ8fvjA== X-Google-Smtp-Source: AGHT+IEg07jJ9OPJkKkmCWjDY4B+wb9xBXz7fBkAifPrpk4fCrC1NnhSeBjwSL6KURgNGGSLzkcOpp7iZv8H2A== X-Received: from dybnx41.prod.google.com ([2002:a05:7300:e7a9:b0:2ac:1eee:fdb4]) (user=jasonmiu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:fe88:b0:2ae:5bd8:1dc9 with SMTP id 5a478bee46e88-2b17d2519cdmr4148660eec.14.1767917491269; Thu, 08 Jan 2026 16:11:31 -0800 (PST) Date: Thu, 8 Jan 2026 16:11:25 -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: <20260109001127.2596222-1-jasonmiu@google.com> Subject: [PATCH v4 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 v3 [1]: - The patches introducing the KHO FDT ABI header [2] and relocating the vmalloc preservation structure to the KHO ABI header [3] were merged into another series [4]. - Use `struct kho_radix_tree` to encapsulate the tree structure and expose it to the public radix tree APIs as an argument. - Public radix tree APIs now manage the tree structure's lock internally. - Protect the radix tree with a mutex lock instead of a read-write semaphore. - Radix tree root pointer validation and warnings are now centralized in kho_radix_add_page() and kho_radix_del_page(). - Updates to the KHO finalization logic are grouped into the second patch. - kho_radix_encode_key() and kho_radix_decode_key() were removed from the public APIs. - KHO radix tree callback function takes physical address and order of a page as inputs instead of a radix key. - Refactored kho_radix_get_index() to use kho_radix_get_bitmap_index(). - Updated the documentation. [1] https://lore.kernel.org/lkml/20251209025317.3846938-1-jasonmiu@google.com/ [2] https://lore.kernel.org/lkml/20251209025317.3846938-2-jasonmiu@google.com/ [3] https://lore.kernel.org/lkml/20251209025317.3846938-3-jasonmiu@google.com/ [4] https://lore.kernel.org/lkml/20260105165839.285270-1-rppt@kernel.org/ --- Jason Miu (2): kho: Adopt radix tree for preserved memory tracking kho: Remove finalize state and clients Documentation/admin-guide/mm/kho.rst | 52 +- Documentation/core-api/kho/abi.rst | 6 + Documentation/core-api/kho/index.rst | 23 +- include/linux/kho/abi/kexec_handover.h | 141 +++- include/linux/kho_radix_tree.h | 72 ++ kernel/liveupdate/kexec_handover.c | 703 ++++++++++---------- 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(+), 484 deletions(-) create mode 100644 include/linux/kho_radix_tree.h base-commit: f96074c6d01d8a5e9e2fccd0bba5f2ed654c1f2d -- 2.52.0.457.g6b5491de43-goog