From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2390606A31C for ; Sun, 29 Nov 2026 21:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=p+CxKB/B; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oAuB28+8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=yhedn1nWVpk6eY0lQDFrQl+6Hy69xfRE8zIhQy/AQuM=; b=p+CxKB/BKeerQILY3jSk4UIsE2 XvzrkxUsGrImG5f97WTb8wiODNWq/TjQFeBmp7L2Mxo5ztxeMQyy926a2mIx80UyVMb+sjyYGsEpt aYrfAuVkOV8AkkjLcKYZr8jG1GiE4zYEOXio2oeWbDGk59KuO9+8HWQKhE5oyy3AiDe/TDRGUzk6O 3E6u2KrO6IR1HPDBqE8Cjj2L0KsORXoJNhfXh29IqrRPYtytn2Wv1j64mtLDhJksqvGINvbbr0nVN 3oe+7zAqpqVH07m0qiog6ZLbki542oQqQLLaNUmYB1poiOmJWDWzMFQHXdhUnAtReK6AcbAjkieOy Uhv2eNBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXm3k-00000002UDE-43ot; Sun, 29 Nov 2026 21:03:44 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXm3j-00000002UD8-0weY for kexec@lists.infradead.org; Sun, 29 Nov 2026 21:03:43 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 7F38A60E74; Sun, 29 Nov 2026 21:03:41 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3131fae711e7e2350689ebf4dbf5cb8209625cf5.1795857773.git.chris@chrisdown.name> X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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.