From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 E645D30FC32 for ; Thu, 8 Jan 2026 18:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767896766; cv=none; b=NmWTqSjVFrXvI8BqizWUpE3ILmJuBdfEXO5SefADOA8ZennvV9prmaY0ZqZKdyu0I1YeAhhfZK0Dlqk9b3kj6wfoIa/t9NA6vsPiYbapTTWbtzeloMuDrNV4Ztb2SbrgRP2HWaERRXgxYv3VcR9FdEtl4veggU8xn1Do3pOD56w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767896766; c=relaxed/simple; bh=s1RRLh1s24N8vch0efEW4crrg2HPdZCHGJl+fLq95DU=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=ObTSQDUBXUxaafCGGIQ44Cuh6GlMA6P07IZPnUWmto1UvP01grKViQh8vnwXZjjxUXGIOB9nIzmFRTCNDKFav/5vEpurDSdYWOY+O++hfWzlTRAwv2IXfgKFh1It5qUuKiIrsbshMyjSqe/EUvqQlpBD8wbmTRsjRTLIyOsafJM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-7c7545310b8so1919320a34.1 for ; Thu, 08 Jan 2026 10:26:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767896764; x=1768501564; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GxGOI4fTfH8u55B1DL8U4nm4ObzNusp9OL+d9L8pE9k=; b=jcoPUCQTCzRDPW3yi1seYPl1PhlyBL3mE7V8qkiiysuES9sVb7wrKRBGvGgdkdHe0X KQUDypDeYC/Jd2xjGg0tFYLWcw6BwvJ1jargSYqSt6HcVAeSiOy3a5R/44gAG5fJbt6P juojUWY/dLaQHOtc8cMe/lUkhmUDrzY3zweiCGen354crMAGBmF4oKlX1nyle7cmEswd RoBl90d0JaTAcVeZ/DIv8MqNanxOAaO703yAMPEFcTvXfontMJgte1dQHik66d+2gkXl wm1DQ9PT37WjWw+TqnW6RVEd0vyyLUgWWtnAAu0eRpa5+oeMz/i1Q1dM6ZWolV1kzX4W BQsg== X-Gm-Message-State: AOJu0YwYwan2EgMFwlcina7EBBHSKICJ2D6xQupT2tzaJ4PHbBFYHEi7 /oq74G7fpvbbJU+5xWooOh+xt5hGw/pwceSus5CSiQgKRjuHbCO6yAqdHIlxNQ== X-Gm-Gg: AY/fxX4rnrjwXgSrScbM3XWrESUtFOUx2WU9yq1HcDCZfu4YwZXspW5oOFcTzGsa8bB 9LHtKIW1jUO+7UNWaXc9ncGxqPrjiuFmJs4pwXC66oaD6lQ2NfInJ1YppQXDO/8/kZqLCvOKMqc npQIDvop2HKnwLMtTr4QwE+ey6blwDtVtGdKUAmwFAWPeGlqnHOgz6r6N3yTJFw5UOMHKTFGYIt TApI775pnB07SLggpM/YFzqmmB15BArZ1xcgtm+uH5hE449RcfFCcKpUrAQOOsAHrVWCEystUza 8+VnpV6QTiAsPkEeuVYmkAzSp4kXwCJHUFRmL9++eLyCdKyUrklbcjWCSytn+VHY1RRO/dt6Ye3 XHhVc1T7nwBQYthNJ5ip7+ba5bHHugKGzCgwnEskOaYvIu169YN3RTJM1hMgLkFEF/u0hBrS69E 3jNQ== X-Google-Smtp-Source: AGHT+IGjo79YzWbsVuqisuDsj8X6jFxioSTkbz2DzVGWWCeD2vs2aw6tQvT8I6ProgsJB1hbR2WPuw== X-Received: by 2002:a05:6830:4426:b0:7c7:6626:b595 with SMTP id 46e09a7af769-7ce50a54edcmr4043973a34.3.1767890480527; Thu, 08 Jan 2026 08:41:20 -0800 (PST) Received: from localhost ([2a03:2880:10ff:4c::]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce4781c447sm5684987a34.9.2026.01.08.08.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 08:41:20 -0800 (PST) From: Breno Leitao Subject: [PATCH v3 0/2] kho: history: track previous kernel version and kexec boot count Date: Thu, 08 Jan 2026 08:40:57 -0800 Message-Id: <20260108-kho-v3-0-b1d6b7a89342@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIABreX2kC/1WNyw6CMBBFf6WZNTWd4VFl5X8YF4UOUE3AtNhoC P9uCnHB8ibnnLtAYO84QC0W8BxdcNMItcgzAe1gxp6ls1ALIEUlUq7kc5ik1krz2RB3yJAJeHn u3Ger3O77Du/mwe2c1EQMLsyT/243ERN3LEaUKAurL6WhwpoLXy03zoynyfeQkpH+UqVQ0S6RV BJ1oRs0uUFbHaR1XX9d6ZyF3gAAAA== X-Change-ID: 20251230-kho-7707e8a2ef1e To: Alexander Graf , Mike Rapoport , Pasha Tatashin , Pratyush Yadav Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, usamaarif642@gmail.com, rmikey@meta.com, clm@fb.com, riel@surriel.com, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=openpgp-sha256; l=2859; i=leitao@debian.org; h=from:subject:message-id; bh=s1RRLh1s24N8vch0efEW4crrg2HPdZCHGJl+fLq95DU=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpX94vATIWGxdN1+hN2/iDpZ64iATDNHKnAMXR/ MS4BU5sz6yJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaV/eLwAKCRA1o5Of/Hh3 bet1D/95jPd+3qRKS1ZBojBwI12XNWkxdzy/CpGuJX8MMI48vM1yS3kFweMp50BdaDU55SeilrV awhMthz6pAeCD99uMtDpQqIAtwtvxHK3gwMlI+SKxusGJaBnAo8XQ3n6KToJJuVPmYN/qXYkUwy K6WT4utD8kSPPCEXnsKKJyqPVMNvpLCWQlakaeZ5cVdgEf0f8w3tom9dG9WoNj3e3Gf2RQrWF7O HcRBAYjakjQjAPOxAV29/bxedtC5oiMF2WKrdPcmSRXUzDTJD/MPtoFH0mxOmqtbV37yNEUCL7z 48bI4jeGkHv3h6dZGEUECk2P1zXrEiQH9kBRnLD6O5LiiiCXmx6P5ZishQyRFsy/EF0e5T2Y5OJ mvvLfYWb6WLvVVgV6IIJbFplD9T8EmRi40rSXPgTx+nrpAQWfabxlET6zuJ2wnIwS62emdYOhIQ 7K+6vk9GWH2oSAYmrTkautpuE4rn/yQFv7PCO8J6mK7Wa6Kg/w/YqLw/rnVOKsg0UEzJH0tX2Oi jJFFtR8KTew9WLjXGfCkTA6agW21iWGwWmchIvSZeqgVdZX51cXF5udYkqk5/PsFDAgfd5YxFYT FO4W2yLAQmoN6CgjTzAbtXvBNDsBNy99A2q0SYl1KhR4y11iFfpsNYaLzm+HJkCfhUkOAEYXZVS ZcN/EBby9Yo3wMA== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Use Kexec Handover (KHO) to pass the previous kernel's version string and the number of kexec reboots since the last cold boot to the next kernel, and print it at boot time. Example ======= [ 0.000000] Linux version 6.19.0-rc3-upstream-00047-ge5d992347849 ... [ 0.000000] KHO: exec from: 6.19.0-rc4-next-20260107upstream-00004-g3071b0dc4498 (count 1) Motivation ========== Bugs that only reproduce when kexecing from specific kernel versions are difficult to diagnose. These issues occur when a buggy kernel kexecs into a new kernel, with the bug manifesting only in the second kernel. Recent examples include: * eb2266312507 ("x86/boot: Fix page table access in 5-level to 4-level paging transition") * 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption") * 64b45dd46e15 ("x86/efi: skip memattr table on kexec boot") As kexec-based reboots become more common, these version-dependent bugs are appearing more frequently. At scale, correlating crashes to the previous kernel version is challenging, especially when issues only occur in specific transition scenarios. Some bugs manifest only after multiple consecutive kexec reboots. Tracking the kexec count helps identify these cases (this metric is already used by live update sub-system). KHO provides a reliable mechanism to pass information between kernels. By carrying the previous kernel's release string and kexec count forward, we can print this context at boot time to aid debugging. The goal of this feature is to have this information being printed in early boot, so, users can trace back kernel releases in kexec. Systemd is not helpful because we cannot assume that the previous kernel has systemd or even write access to the disk (common when using Linux as bootloaders) Signed-off-by: Breno Leitao --- Changes from v1 to RFC - Track the number of kexecs since cold boot (Pasha) - Change the printk() order compared to KHO - Rewording of the commit summary - Link to RFC: https://patch.msgid.link/20251230-kho-v1-1-4d795a24da9e@debian.org --- Changes in v3: - Remove the extra CONFIG for this feature. - Reworded some identifiers, properties and printks. - Better documented the questions raised during v2. - Link to v2: https://patch.msgid.link/20260102-kho-v2-0-1747b1a3a1d6@debian.org --- Breno Leitao (2): kho: history: track previous kernel version kho: history: track kexec boot counter include/linux/kho/abi/kexec_handover.h | 6 ++++++ kernel/liveupdate/kexec_handover.c | 39 +++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) --- base-commit: 5eec2b2e1f37acff8b926d2494eadaeef59be279 change-id: 20251230-kho-7707e8a2ef1e Best regards, -- Breno Leitao