From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA46FC77B7C for ; Wed, 25 Jun 2025 23:19:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E22ED6B00D2; Wed, 25 Jun 2025 19:19:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD4166B00D3; Wed, 25 Jun 2025 19:19:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C741D6B00D4; Wed, 25 Jun 2025 19:19:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B63846B00D2 for ; Wed, 25 Jun 2025 19:19:01 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 938DE104211 for ; Wed, 25 Jun 2025 23:19:01 +0000 (UTC) X-FDA: 83595490482.25.BA90EFA Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf21.hostedemail.com (Postfix) with ESMTP id BC43B1C0003 for ; Wed, 25 Jun 2025 23:18:59 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=jfpEJ8wZ; spf=pass (imf21.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1750893539; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/CZq9og4E2iYswOQvh/BeoWWVk3VTVb3cQyp5vwN8F0=; b=1QDee7GqfJ522NdWO7AClW0aotgeNMNMlqQZKcOdTy69P4UqhEHB0v0Nq+dVdzbP+YQtC3 ZFr5JBGiC/xfeJ8CGPlU1A3S3J0OwwUFtpcm41BFEJT5uOi3QUikWDZ7uPtPAwBL8K3M84 d1SDNbOypvcMuvmUvimAL7Q9zgDBZGg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1750893539; a=rsa-sha256; cv=none; b=hPtIEQrByr+0A3h1tVD6QntSl793zOk032UYeSbBNdv5b9lAglwbWGvUd7nhK36TMttzqb lczhF4Yw0ymP0A5DqxgQW/usimKxobJc80mxiWaUhowodUFSAdG/42Po7NoDUPWL5isgrH M//1j7q7HkrF0iu5UquLC3bElI7TXp4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=jfpEJ8wZ; spf=pass (imf21.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e8275f110c6so275338276.2 for ; Wed, 25 Jun 2025 16:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1750893539; x=1751498339; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/CZq9og4E2iYswOQvh/BeoWWVk3VTVb3cQyp5vwN8F0=; b=jfpEJ8wZqe8Ijgz7Ib3Ds37ZoXPsAwz/3OCILpUffTPCLlIcPck/aZmM1taAz8eXJg ex9vzYsoJzlPWNgXnVQLv/zsKVnOZl8Yw26ti0RBUo1a0i5e7nkisxbtz2n6cx6UHpGm hkbUpmNaWnMReuc/0WNAYchnGh/7Mx9tBzfA/LMmj7s5Go2yXbuOhrATUc0/ek6mhIZE oiL8rw1f8Me1b46ysOeFBKZHCo/mWRoi9YIlFPxCe2RiA4GHG3R4+AooQllgo4dabjy3 /BvYtQUieABNJe5kqvBiHlLH/oJy5jitsg70guA0Rj3k7cH05hpzJPBw/oE9i1K3hMA8 SGrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750893539; x=1751498339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/CZq9og4E2iYswOQvh/BeoWWVk3VTVb3cQyp5vwN8F0=; b=dC1S8ws2YPlHUTWhCmnpYwzgWurjkXMoraZxZHdIyWFPDuEZvopKvV7ApNI0nqJ9Br XerVXmyZANGPsfORymYBUVFd8P22uBlDuBusAGBDbn5iSMvd0oTZFC7YaNSO4JgepjsN i5d5odVlzz/gGWlnmu+iBUkBZSiVKaEJgWCT2yKtR84v6q8MOFCIhN/TMLknO9F94NTI +UF+mXs/XyJzlYQLq/kOGVPg8a9vmkIgHxpsxBjn+zB8ko6Gr7YTbZWRBD/FpvrF2eID EmotIY8yZdzisvVex5s1vguoMYRYpSy+o+EKw2qVJPqDv9626ZswdFy0gnfZpAoRvt3F pJ1w== X-Forwarded-Encrypted: i=1; AJvYcCXv8+wVOcko7SyM/uLFl0XIqYFM7voNTtFtoctyYvIySUI/pCrwj7chDmjogpI2OjKfNL1u0MMgMg==@kvack.org X-Gm-Message-State: AOJu0Yzz3O5GOhy2hY5yLTgmQVnl84z15jx+Hxy7JsLNdQpVGfe4V7Ag 6g7DVxnceHmFWCAfb9QMlqbgu6ovg6zJt1eCSPv/xaSzL+el4NJeS1ZZ3muWw2C6n+g= X-Gm-Gg: ASbGncs7wGp26ZBi7FU/hiTNpcJUqwwEASGFz7d0rlNqIUtxZcpKPIxwZry5YCCWbg7 f99qFoPIlH+W9/M03Spne5zwG5zBh5oDFhEUiju+nyDhg7/xQm4SkTghbXt+mzK+4EPABp+GGXF SmfphyJQ3fCjmnXee9Kc1tu6JwT+NBmedsZFnKzaFoJwilZaOOrpeS1T8owrx7lkErnwr/ZfX7i 0nbyB/UXQtaBvw/fmybRXSgUJgQ97IjQ1XDr+nb2IgXF6OyqXELMwJA7PTyT6XN3XsoCv0PI+mF Kp7i/PrDsbevuIhKIi+ESb22GGATRezeZlVKzyd+34pOi5sDroLsHTvd6S3gjoB90WyeojiR2eB 0W7+o+zEXpaCtjACssJL6eDC3NWT3XZYhODcvXX7TtqkJZK7lsEiP X-Google-Smtp-Source: AGHT+IEvjiL52mwTnep5Cm1LT/Mafe7xzjNymqDf9OgtY/gdqSxumZYzT41sOZggnwLsDEbcl9BxxQ== X-Received: by 2002:a05:6902:2808:b0:e82:1a1e:8b04 with SMTP id 3f1490d57ef6-e86019486d4mr6292329276.33.1750893538669; Wed, 25 Jun 2025 16:18:58 -0700 (PDT) Received: from soleen.c.googlers.com.com (64.167.245.35.bc.googleusercontent.com. [35.245.167.64]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e842ac5c538sm3942684276.33.2025.06.25.16.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jun 2025 16:18:58 -0700 (PDT) From: Pasha Tatashin To: pratyush@kernel.org, jasonmiu@google.com, graf@amazon.com, changyuanl@google.com, pasha.tatashin@soleen.com, rppt@kernel.org, dmatlack@google.com, rientjes@google.com, corbet@lwn.net, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, kanie@linux.alibaba.com, ojeda@kernel.org, aliceryhl@google.com, masahiroy@kernel.org, akpm@linux-foundation.org, tj@kernel.org, yoann.congal@smile.fr, mmaurer@google.com, roman.gushchin@linux.dev, chenridong@huawei.com, axboe@kernel.dk, mark.rutland@arm.com, jannh@google.com, vincent.guittot@linaro.org, hannes@cmpxchg.org, dan.j.williams@intel.com, david@redhat.com, joel.granados@kernel.org, rostedt@goodmis.org, anna.schumaker@oracle.com, song@kernel.org, zhangguopeng@kylinos.cn, linux@weissschuh.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rafael@kernel.org, dakr@kernel.org, bartosz.golaszewski@linaro.org, cw00.choi@samsung.com, myungjoo.ham@samsung.com, yesanishhere@gmail.com, Jonathan.Cameron@huawei.com, quic_zijuhu@quicinc.com, aleksander.lobakin@intel.com, ira.weiny@intel.com, andriy.shevchenko@linux.intel.com, leon@kernel.org, lukas@wunner.de, bhelgaas@google.com, wagi@kernel.org, djeffery@redhat.com, stuart.w.hayes@gmail.com, ptyadav@amazon.de, lennart@poettering.net, brauner@kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v1 09/32] liveupdate: kho: move to kernel/liveupdate Date: Wed, 25 Jun 2025 23:17:56 +0000 Message-ID: <20250625231838.1897085-10-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog In-Reply-To: <20250625231838.1897085-1-pasha.tatashin@soleen.com> References: <20250625231838.1897085-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BC43B1C0003 X-Stat-Signature: n7tky4gu7numx9gywp7xby837aeu7ug9 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1750893539-165850 X-HE-Meta: U2FsdGVkX19SJxCV8UiRYzRGHhTHKR4OAndMxu2M9TcMuQnShQBOnJOzKewNHiGUMcJFyD2w/3J6HRjAs6xnJGcZ5QnNkhP29483fB35AuUGwA8ZnGdvWUknVzNDkGrzHCtI4BTDbi0SsAYV9SAJbps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u+lQjmlPQhbs0yk6Fl0+cd9UUPRTTrNyWD/ZheMI4Q8CCQMsApGIxondyhhIkzy80q57KZPbdyfa92L6V01Wswco7UULldaHVM3nX4WYmHfLorK+2WUBcRzCs4JqptkTOEb8cVwamtIvK+eocxX1VKxOozmJ78HGe5/zZkDuvpdhzqpodEM14s7CFdTbpjYssUKWFpfzi/AsJjLX+2F0A8EqvSiszzaHia0jDoWTs9gepOCtDKH+LzvcckwMGmFvcaQpgtlcYj92xMEYfeYberBDs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Move KHO to kernel/liveupdate/ in preparation of placing all Live Update core kernel related files to the same place. Signed-off-by: Pasha Tatashin --- Documentation/core-api/kho/concepts.rst | 2 +- MAINTAINERS | 2 +- init/Kconfig | 2 ++ kernel/Kconfig.kexec | 25 ---------------- kernel/Makefile | 3 +- kernel/liveupdate/Kconfig | 30 +++++++++++++++++++ kernel/liveupdate/Makefile | 7 +++++ kernel/{ => liveupdate}/kexec_handover.c | 6 ++-- .../{ => liveupdate}/kexec_handover_debug.c | 0 .../kexec_handover_internal.h | 0 10 files changed, 45 insertions(+), 32 deletions(-) create mode 100644 kernel/liveupdate/Kconfig create mode 100644 kernel/liveupdate/Makefile rename kernel/{ => liveupdate}/kexec_handover.c (99%) rename kernel/{ => liveupdate}/kexec_handover_debug.c (100%) rename kernel/{ => liveupdate}/kexec_handover_internal.h (100%) diff --git a/Documentation/core-api/kho/concepts.rst b/Documentation/core-api/kho/concepts.rst index 36d5c05cfb30..d626d1dbd678 100644 --- a/Documentation/core-api/kho/concepts.rst +++ b/Documentation/core-api/kho/concepts.rst @@ -70,5 +70,5 @@ in the FDT. That state is called the KHO finalization phase. Public API ========== -.. kernel-doc:: kernel/kexec_handover.c +.. kernel-doc:: kernel/liveupdate/kexec_handover.c :export: diff --git a/MAINTAINERS b/MAINTAINERS index 8ef6df1c4611..fd097e53fff2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13353,7 +13353,7 @@ S: Maintained F: Documentation/admin-guide/mm/kho.rst F: Documentation/core-api/kho/* F: include/linux/kexec_handover.h -F: kernel/kexec_handover* +F: kernel/liveupdate/kexec_handover* KEYS-ENCRYPTED M: Mimi Zohar diff --git a/init/Kconfig b/init/Kconfig index af4c2f085455..a144d1111be5 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2079,6 +2079,8 @@ config TRACEPOINTS source "kernel/Kconfig.kexec" +source "kernel/liveupdate/Kconfig" + endmenu # General setup source "arch/Kconfig" diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec index 2b18a06bc5b2..ceadf4a66496 100644 --- a/kernel/Kconfig.kexec +++ b/kernel/Kconfig.kexec @@ -94,31 +94,6 @@ config KEXEC_JUMP Jump between original kernel and kexeced kernel and invoke code in physical address mode via KEXEC -config KEXEC_HANDOVER - bool "kexec handover" - depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE - depends on !DEFERRED_STRUCT_PAGE_INIT - select MEMBLOCK_KHO_SCRATCH - select KEXEC_FILE - select DEBUG_FS - select LIBFDT - select CMA - help - Allow kexec to hand over state across kernels by generating and - passing additional metadata to the target kernel. This is useful - to keep data or state alive across the kexec. For this to work, - both source and target kernels need to have this option enabled. - -config KEXEC_HANDOVER_DEBUG - bool "kexec handover debug interface" - depends on KEXEC_HANDOVER - depends on DEBUG_FS - help - Allow to control kexec handover device tree via debugfs - interface, i.e. finalize the state or aborting the finalization. - Also, enables inspecting the KHO fdt trees with the debugfs binary - blobs. - config CRASH_DUMP bool "kernel crash dumps" default ARCH_DEFAULT_CRASH_DUMP diff --git a/kernel/Makefile b/kernel/Makefile index e4b4afa86a70..632f692512d7 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -53,6 +53,7 @@ obj-y += printk/ obj-y += irq/ obj-y += rcu/ obj-y += livepatch/ +obj-y += liveupdate/ obj-y += dma/ obj-y += entry/ obj-$(CONFIG_MODULES) += module/ @@ -81,8 +82,6 @@ obj-$(CONFIG_CRASH_DM_CRYPT) += crash_dump_dm_crypt.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC_FILE) += kexec_file.o obj-$(CONFIG_KEXEC_ELF) += kexec_elf.o -obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o -obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o obj-$(CONFIG_COMPAT) += compat.o obj-$(CONFIG_CGROUPS) += cgroup/ diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig new file mode 100644 index 000000000000..eebe564b385d --- /dev/null +++ b/kernel/liveupdate/Kconfig @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menu "Live Update" + +config KEXEC_HANDOVER + bool "kexec handover" + depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE + depends on !DEFERRED_STRUCT_PAGE_INIT + select MEMBLOCK_KHO_SCRATCH + select KEXEC_FILE + select DEBUG_FS + select LIBFDT + select CMA + help + Allow kexec to hand over state across kernels by generating and + passing additional metadata to the target kernel. This is useful + to keep data or state alive across the kexec. For this to work, + both source and target kernels need to have this option enabled. + +config KEXEC_HANDOVER_DEBUG + bool "kexec handover debug interface" + depends on KEXEC_HANDOVER + depends on DEBUG_FS + help + Allow to control kexec handover device tree via debugfs + interface, i.e. finalize the state or aborting the finalization. + Also, enables inspecting the KHO fdt trees with the debugfs binary + blobs. + +endmenu diff --git a/kernel/liveupdate/Makefile b/kernel/liveupdate/Makefile new file mode 100644 index 000000000000..72cf7a8e6739 --- /dev/null +++ b/kernel/liveupdate/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the linux kernel. +# + +obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o +obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o diff --git a/kernel/kexec_handover.c b/kernel/liveupdate/kexec_handover.c similarity index 99% rename from kernel/kexec_handover.c rename to kernel/liveupdate/kexec_handover.c index 7ec9b0826a6e..d7eb0f055477 100644 --- a/kernel/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -23,8 +23,8 @@ * KHO is tightly coupled with mm init and needs access to some of mm * internal APIs. */ -#include "../mm/internal.h" -#include "kexec_internal.h" +#include "../../mm/internal.h" +#include "../kexec_internal.h" #include "kexec_handover_internal.h" #define KHO_FDT_COMPATIBLE "kho-v1" @@ -825,7 +825,7 @@ static int __kho_finalize(void) err |= fdt_finish_reservemap(root); err |= fdt_begin_node(root, ""); err |= fdt_property_string(root, "compatible", KHO_FDT_COMPATIBLE); - /** + /* * Reserve the preserved-memory-map property in the root FDT, so * that all property definitions will precede subnodes created by * KHO callers. diff --git a/kernel/kexec_handover_debug.c b/kernel/liveupdate/kexec_handover_debug.c similarity index 100% rename from kernel/kexec_handover_debug.c rename to kernel/liveupdate/kexec_handover_debug.c diff --git a/kernel/kexec_handover_internal.h b/kernel/liveupdate/kexec_handover_internal.h similarity index 100% rename from kernel/kexec_handover_internal.h rename to kernel/liveupdate/kexec_handover_internal.h -- 2.50.0.727.gbf7dc18ff4-goog