From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795986221; b=sOOktnvf59ovyXWpWGWEUg6tX8tRF2noHm8DzB9XKBRElec361fZ4YvZh5UVb3OpPATq /E9fzx+ZUB805nd37Qi4sgcFNDObut/dKOxxCr0YFDnlSf3Y1l6fl9h2QYm3ZNMuTrAW4 +THF+st8Sm/pKJvDN12us0KR7XVek9NvpmhHwryPR1miXgcaw3EYYVyruotkx2prhgmHf jVNE1LO61bj+ZC6HGfaBWrZiA0g3WPwfbBRjESXMYpAroFfi5sJZu6mln7mWk91L68TdP KvQ2DFnh5rb3gRosVf3si3tiQoxxujDCEtKlIfo5wwJ7hkA//IuzckiYXAILfBJocrw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795986221; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=yhedn1nWVpk6eY0lQDFrQl+6Hy69xfRE8zIhQy/AQuM=; b=Yp7Si/Lr6+zVeWfAdBozqECR7OdbTF4goAsWBYD/MxBCCI2qFkoWLJ8IQY4N+tZR5ofM b7tH/L2RpkMAbCPxu2vyutEjfJL4WWST/frzTMoVfvpPUPgIOq+BVwJBAMhBNu1cUwh5G O+biZjlxAaVFSQRiLmwiL/WVj9eGqVxLxr1Hq6gDgHOznO1PLWQ6Ixf+F7unP9bxcFjoY eGLjzL+CIs6BWp+O0XP+BeI70xNipdJuZQITEe0ZvsKuajT2XGLoblGYP3T8FF+HLDclp mOPnrKp/Ddpb8QablVufC6Q6fRLeAek35+ERMlvgc2ScAED4PWnITRvrFZ8mP+/73og== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oAuB28+8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A517606A31C; Sun, 29 Nov 2026 21:03:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oAuB28+8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 237881F000C1; Sun, 29 Nov 2026 21:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795986221; bh=yhedn1nWVpk6eY0lQDFrQl+6Hy69xfRE8zIhQy/AQuM=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=oAuB28+8Q5GpcpOFuKof5huLl5X3PLEonNj4S9TK6YwPneBbO9mlfSJxJ7QQhYNq+ B0lzmBVYZA+Ct+SUIJFBDqsdWEqVo57avYjraX2kICl1L53IvmRx+Bkl/HkF4PfATm O+VKXL+u4PI39srnYWN5kmypyMVrVi8eR/WjDVpM6Op0a/GoS8AhldzmOz81khJiWL gDjz4MkRqCGajP+uwxf7ZUEtjwLl67PRM+/1+ulRx9IsYjEPNammz6cwHUpXpiMoM4 48Qv9D4TC60qIfhcMoS9ksHBsb7Oc26ISdk+9QhEt3c3TWpFNX+8jlJgAE12MUA4UI jQTqiWIJmN9Vw== Date: Sun, 29 Nov 2026 23:03:31 +0200 From: Mike Rapoport To: Chris Down Cc: Pasha Tatashin , Pratyush Yadav , Alexander Graf , Baoquan He , Jonathan Corbet , Shuah Khan , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@meta.com, Breno Leitao , sashiko-bot@kernel.org Subject: Re: [PATCH v2 4/7] kho: Expose rejected handovers that look like cold boots Message-ID: References: <3131fae711e7e2350689ebf4dbf5cb8209625cf5.1795857773.git.chris@chrisdown.name> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3131fae711e7e2350689ebf4dbf5cb8209625cf5.1795857773.git.chris@chrisdown.name> Hi Chris, On Sat, Nov 28, 2026 at 10:27:38AM -0800, Chris Down wrote: > Subject: [PATCH v2 4/7] kho: Expose rejected handovers that look like cold boots Maybe expose handover status in sysfs > At Meta, our rollout needs to stop if the new kernel rejects the KHO > handover. For example, if it doesn't recognise the handover FDT's > compatible string, it can boot normally with all the preserved state > lost. LUO's incoming/state reads "none", as on a cold boot. We log > "disabling KHO revival", but our fleet collector reads procfs and sysfs > and can't rely on kernel logs from every host. > > Let's add /sys/kernel/kho/incoming/state so the collector can tell a > rejected handover from an ordinary boot. "revived" means the kernel > accepted the handover and completed the preserved memory map walk. LUO > reports the outcome of restoring sessions separately. > > KHO has no sysfs directory yet, so this adds /sys/kernel/kho in its own > file, kho_sysfs.c. It is set up separately from kho_init(), because > kho_init() returns early when KHO is disabled, and a rejected handover > still needs to be reported then. > > Signed-off-by: Chris Down > > diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > @@ -1744,6 +1745,7 @@ err: /* static void __init kho_mem_retrieve(void) */ > */ > kho_in.fdt_phys = 0; > kho_in.radix_tree.root = NULL; > + kho_in.state = KHO_INCOMING_FAILED; > } > > static __init int kho_out_fdt_setup(void) > @@ -1981,6 +1988,7 @@ err: > */ > kho_in.fdt_phys = 0; > kho_in.bootmem_phys = 0; > + kho_in.state = KHO_INCOMING_FAILED; > } > > void __init kho_memory_init(void) > @@ -2079,6 +2087,7 @@ unmap_bootmem: /* void __init kho_populate(phys_addr_t fdt_phys, ...) */ > unmap_fdt: > early_memunmap(fdt, fdt_len); > report: > + kho_in.state = populated ? KHO_INCOMING_REVIVED : KHO_INCOMING_FAILED; This is too early to say "REVIVED" here. Although the state stays REVIVED unless we overwrite later with FAILED if something goes wrong, I think it's better to make it explicit there. Maybe even start with FAILED unconditionally in kho_populate() and only reset it to REVIVED in kho_memory_init(). That way the state starts with NONE, then if kho_populate() is called we know that's a KHO boot, and from there it's FAILED until proven otherwise. This way we won't need to chase the points that should reset REVIVED to FAILED after kho_populate() or check the current state before changing it. > if (!populated) > pr_warn("disabling KHO revival\n"); > } > diff --git a/kernel/liveupdate/kexec_handover_internal.h b/kernel/liveupdate/kexec_handover_internal.h > index e9685e1ef6d7..b559f5d43116 100644 > --- a/kernel/liveupdate/kexec_handover_internal.h > +++ b/kernel/liveupdate/kexec_handover_internal.h > @@ -22,6 +22,14 @@ struct kho_debugfs {}; > extern struct kho_bootmem *kho_bootmem; > extern unsigned int kho_bootmem_cnt; > > +enum kho_incoming_state { > + KHO_INCOMING_NONE, This one is never set. Can we stick an explicit state = KHO_INCOMING_NONE at the declaration of struct kho_in for clarity? > + KHO_INCOMING_REVIVED, > + KHO_INCOMING_FAILED, > +}; > + > +enum kho_incoming_state kho_in_state(void); > + > #ifdef CONFIG_KEXEC_HANDOVER_DEBUGFS > int kho_debugfs_init(void); > void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt); -- Sincerely yours, Mike.