From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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 163161A3157 for ; Fri, 2 Jan 2026 14:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767365625; cv=none; b=Kt4lnvrYc93Jq+bWg5MWUIm7n7tg8VVZy0p+dxVKSH/ZLTcWJMrDz777U3Wj6DCUj1MZt92r2q1pzRCN5i/DInxT4792ttMMfZ9jR7axa0xl3yDY14ptGGsIeV1ZPL3Yc9q5/LGcfQW0b8PCo7DHsJsH8Yvk5TAn8LxULhX77mU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767365625; c=relaxed/simple; bh=i3CmEWPm0Y4/Vry1pju4wRoGsXN3c5nNvQGe4fhn/iY=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=b4/1XtBCTy02owYT/1e1mPaY2SoEQNpUhgxZ1BuSOLkiwxgJG+3c34ximk0p4ZQWn91tfQlelzOsbSOEs7vcqCE9YKcPazhlA5E98umOm+6czRFc3coi0o7ub1xaB9wTEUpfPl5zpb46A8xchTXDfrXtG8eGv9y1xQ3xD/y2jBs= 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.43 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-f43.google.com with SMTP id 46e09a7af769-7c76f65feb5so9272522a34.0 for ; Fri, 02 Jan 2026 06:53:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767365623; x=1767970423; 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=lVaoN1eh3C57/bKSyAYQv7yupDKJUH9rxo6P57vyXQE=; b=SpkwIYi5FfYNgXPhPi+I1RKXAwdETs5OZR7laG/DLbfoor/CYfiCjzo15z1lbySFNI bfctcrDRvEfp7U1Zk2OBIrxAK+qat6MF3EeSr55zcLXopB7Kn12U+tYvaYmWdIbGpa0S wrQgJsL8ir66nB03fKF17WDh833AU4rVGqs/eYUdQRGTLILdliPxQuCQO0Zf1795rlAa 4MSqtvWdbdqWt6SAB4BmiDhH9coEm+CpjsuER9cqcpck6dkqqnQvCrr4yuQYadfFta9R gKHb7zsh3xSgrGdeB975OWoj8bBXh8te5jzCHwgPHQjspS3iCIXv2niFOpAyxI6G3J4A vYOQ== X-Gm-Message-State: AOJu0Yww5hZTrEJzlXeN6fklFjg2HcIWFmAG/IWA5toz/epAcAcmuJnc U6jxGw1r5npRO2RLoGILkjdPT6IeInYxtwlmRkNVqUFvLzTQiMlnDy+F X-Gm-Gg: AY/fxX7SqQstMQMXvwcfx9i5zQtXLsKlzZNbvwQORhuofwEQhD+EuTUng9v6FtBKt/k yWfQhmVNc1dZ1pdqyScI8e9qhOHKy/+hSNaFlcUiobFhZIBtfpHbaVJe+Ta5bjr4/gwtPI2rHO4 t0xjaYUiYTG5CIUdbgmj+HywbCC62Q1yCdshgjE/UiYMHZC6nLn03SRkZiGMOobodQh6xdPXA1a ceVGFmSk28KFzT7PVFTvD4OjB2gX0oMnd9BUf3VPT8qch4tkXETXvcJc1zwZuiXgMeS+UYGL8oZ urYC+UU3HVYl9qJnIpVCZBi7OwJ5DbjtZaMOGZV+BVWQy9Thf5hhtSeUUJxDNSSlyhqAosM2wPf XO6pO0QqrYhlV1vmaLqFBuNjXGJHUnESD1EBXcG2KFKj4uN8uOZiph9FFYH9AAh4WF0jEMbEePY zPCMnbimEwE4niACbbKe16b9F9 X-Google-Smtp-Source: AGHT+IHeJsGZ/SX/hNY+45CMBgjyMFy5KgBCY+PBAVGiHHhPJdSaaqy8TMKvsf79sPPpSXptC0AkzA== X-Received: by 2002:a05:6830:6d05:b0:7c7:6a17:ba35 with SMTP id 46e09a7af769-7cc66a49319mr27427721a34.31.1767365622904; Fri, 02 Jan 2026 06:53:42 -0800 (PST) Received: from localhost ([2a03:2880:10ff:41::]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7cc6673ccc2sm28367487a34.12.2026.01.02.06.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jan 2026 06:53:42 -0800 (PST) From: Breno Leitao Subject: [PATCH v2 0/2] kexec: history: track previous kernel version and kexec boot count Date: Fri, 02 Jan 2026 06:53:22 -0800 Message-Id: <20260102-kho-v2-0-1747b1a3a1d6@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=H4sIAOLbV2kC/1WNwQ7CIBAFf4XsuRjANtie/A/TAy3bspqAgUo0D f9uqCePL5k3s0PCSJhgYDtEzJQoeBiYahjMzvgVOVkYGCihOqnOgj9c4FoLjRejcJEIDYNnxIX eh+U2/nZ6TXect3qthKO0hfg5MllW7t+YJZe8tbrvjGqt6fFqcSLjTyGuMJZSvhGNpRqpAAAA 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=2329; i=leitao@debian.org; h=from:subject:message-id; bh=i3CmEWPm0Y4/Vry1pju4wRoGsXN3c5nNvQGe4fhn/iY=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpV9v12c+ZP5H2du0LVIKF7c1HtTaqzRJyfSxRA vimJBZ+gq2JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaVfb9QAKCRA1o5Of/Hh3 bT4HEACpMoA/+5gfeqIvqHqN6gPej2Pyzyh+VChw9mh70O9Hvkw2x/R/PcPDxAa4cGNgN7FSqyl eTtdEYZDfzHqnWoZu/+3INPDVs549mMYYFI/eLLHjJ4wAevmGRVrWSJKL98VIAvNe07TR0DFM97 1wiqosuV1WoNekZj1vxlwq0cruI65HuWh2eHEJyepVuGkTiEOJVtxgAIfZz4/v8SoF3e2vq7/6K 3QVmO8DA49GnOHkbu636cWyeQsMAAVBru22UNBo4L9hm4VIXJrfn/L4gwCf7rGCEIqJG508VaD+ 5xzUojyuc0JeuTSZcXLVQi3C5XE3uQxYf/R5seyzlw0m1qnGWPd5L1svaWw5s/1SawV/WxEK7QN HyhUb0DBykr2GrCcaYjf7LDZIjqlhqm1in6pKejY7ZMD5kH8TL4HktZepYJk7BYTARwQe/2VHH/ jdTXiKe5+wqcGmQ8ojVQW8+D16yvWdSw8lWx44jSO2z6/p6sg8lbcnttEgPmNxn1Z3xYuQIzvax SPnbnWtwQ12k439dDzccUTYj6nOFQ+zYdZtiRwDjOHXaV/gz5T5K/Zp21ktl1v/OF51ApRQy57X V1tAgqFH2DD2FvQPjo5jeAnyspCMxVOndYxEw3jjjMnnGrFYEnznI54N5uHTDZYf4IKqR/7M9yU k/hgCgo34DcDsuA== 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: This kernel was kexec'ed from kernel release: 6.19.0-rc3-upstream-00048-geda7d9110f99 (kexec count: 3) 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. 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 --- Breno Leitao (2): kexec: history: track previous kernel version kexec: history: track kexec boot counter kernel/Kconfig.kexec | 13 ++++++++++ kernel/liveupdate/kexec_handover.c | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) --- base-commit: 7620f9ccfabbdaf07620381264d8b8d91412542f change-id: 20251230-kho-7707e8a2ef1e Best regards, -- Breno Leitao