From nobody Sun Feb 8 02:41:24 2026 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (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 F19228F48 for ; Thu, 8 Jan 2026 16:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767890484; cv=none; b=hO3fMp3R6GXTzTUwrNpmfIRdyevLlkm41vYtlkpdZaeD836ej8uIimWbHJT/fPxf01gxw1RK+wB0leyJPTEHyPKs22wrNyLRhDpCY5PSP8qoRDl5Afvkb2Je3C5LDqFEP+UKmIzTcqdk+hQPscO8KHD6VKoH25bltLx+bCYNSDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767890484; c=relaxed/simple; bh=lVq1FcOCQMqfHOK5DcXTIKEzb9rwsZ/ITwXUKRT+mew=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NccYAP/aeo/pqiuR+jr2/TqWGVq8cXC6PMIu0pFGmQSVEv0FS6MthDWu6p8herWuRwdWxhipImFze+eBidU8wzvNAYA7jEY54nGImYzM1sm+ncnjZh+LkCKB9JxaH1J8CvfRVwgBRd9Aav6DWx37E/JIRHB/y4auRynt9vQWyl4= 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.167.169 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-oi1-f169.google.com with SMTP id 5614622812f47-455a461ab6eso1416700b6e.2 for ; Thu, 08 Jan 2026 08:41:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767890482; x=1768495282; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=eEKbCl6eHGkX3T8z34Ba8e5S/FDTyu14lC4qmzFFHFA=; b=bqTBrOzsD2dBQpsZFkkAsIOjJYXMSLrHpUCsEpWYSEYhK+GXuKvg7+lmZBwVoQtWm6 q9wCzr+HAIE8ocIy6vP1GHAsXGIojdkeEuL27zpt1Xn5FwH+5nKLuspPkSh/4mKxtOcF TdV1Gei9zvqI2mErTFK0D7f4/cLnlIjR7Toox0vdhUoXsR2IvnkDp2aGIeZRme5mKU9l zCLrAYwMg68AhSvglwB/fn8Jb3cDLyBarFDHzC/XLiWV9ApLRB1XV4OQK05gHAsorObY 9Bh7uLeKvHse1TV029x9Ouk/n7JG84JEHgh3bCB/3IEIItIVxoAaZusiaWxCmqGgFUtb Jqfw== X-Gm-Message-State: AOJu0YwpW3AlGTSpgLDMeLMSQDYrEazjQ7snUxeQNzI30jG9HyJUGZQY T8zatlCnOueZz69i8qY0hAnRiB1vuAaQKSvLnqKEDu9b42T3U+FXsFMKIYB+rg== X-Gm-Gg: AY/fxX61bl1Z3YchxppRfsTaq3n2jjF0LutrhnjmAg/uU5yomNkxQ3G3vDQzIoXUa0+ lUf8taHrgtFXlw1upNU1iAyAJryymSSZdsp4jH3+jtga/g6tUesIG4zFadWI13yhSBUn4S3ZvEy 2ptsM+cBBxnQiSlsD8QQpNnnWEb5uBbbT9krtXqfvuZcss5321eEvM9hMpPS6G0hHkrGhMoi3Lh pGvcgUWy4yUcbDV/QM8V2mIuTj6EF+EXGH7A8lsKSMK0zF0vZZluxtrLVRCf7XwXm6G5IlC9sQ9 VkbiJSpK6WsCC4sD1unHVaMy9MCq23bZfnle3b12DQoksgbk7vZXF2sb8Qwrd+RYaPjbYHw445s JKtrdJSJMcMmLBChlvH5p83tZLRHSlQ63ZVnbuNOuBRHX+/UboupuWZJ2UJtWZYm9Rrgf2AK3l4 kayQ== X-Google-Smtp-Source: AGHT+IHwg85rGQHbkPrcqt1aBeanOarcVUdF/YJuRLIGyTivBFmbrsvMl5+YqDe216QHSew4Eycetw== X-Received: by 2002:a05:6808:1188:b0:455:7da6:44d5 with SMTP id 5614622812f47-45a6bdaf691mr2406341b6e.27.1767890481759; Thu, 08 Jan 2026 08:41:21 -0800 (PST) Received: from localhost ([2a03:2880:10ff:71::]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3ffa5161468sm5298579fac.22.2026.01.08.08.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 08:41:21 -0800 (PST) From: Breno Leitao Date: Thu, 08 Jan 2026 08:40:58 -0800 Subject: [PATCH v3 1/2] kho: history: track previous kernel version 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: quoted-printable Message-Id: <20260108-kho-v3-1-b1d6b7a89342@debian.org> References: <20260108-kho-v3-0-b1d6b7a89342@debian.org> In-Reply-To: <20260108-kho-v3-0-b1d6b7a89342@debian.org> 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=3243; i=leitao@debian.org; h=from:subject:message-id; bh=lVq1FcOCQMqfHOK5DcXTIKEzb9rwsZ/ITwXUKRT+mew=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpX94v0uvNnwH22s6hbp7/tiFmZZwZTGwvXKop4 GrcufIuHBmJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaV/eLwAKCRA1o5Of/Hh3 bYjfD/4q44IGNvMydiP1wiCUgQyjvqTCiWLge5E7NW/ndXZiqkKPAyOKxtqhbRpe3c4oYG93YXX hY1pBWYWitOmAEIXiasAf7f/hD7fCvP3WLdm+BV+gHCkPrEBOny3qIUyZg2srW6xhWOMsnGMXuY qG5+RTcUmpRnD6HISAobniQawTfwhu85aUGn8ip5IUZ0YNvAGX/bVHCIqnhPSmItE7H/F7uuenO xoXJhbw4VkkHdtk1ybE9RSKp3K0lOV3aqNgwUD3K/yLWx+jibQ2XyLRYDyCYMEaQjToqlSe+NMN aBaWk66cmepQT1SWPJqAxVe2DgTJ0bJvcFPCRvnJabEIIrCZCZ3uH0AFNaSJnNsDDjocfjxNwX4 Tq2CC+Dffe67p72GupDlMCgZBT/Dy4oK3gj2FEZkfgaF0ydlnL5m+E6b9akv0RLs1gaQlXWZ4j1 xeW6PoYuOwmnzxkN64Wa7WKVg+Uh0LRfqU+a/NJgpJwybc4apdsa3iCTRKx3vXqANCwwctaGjbi nK8CZoIV+z5kL8EpHAIKd7NnO7XLIvJOCCfaDyAlIS3gmHIMegwdKiWFlGCZUA5lel0kIgshnLS 34ZfVxSXBK7smuJX22xF2pphNI9HjIPTgiyH52WyWLw3Ov9QQuyvAj2xn8u4jB8MV8oEOAY2S3C wIxZp7CPi87gccw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Store and display the kernel version from the previous kexec boot. The current kernel's release string is saved to the "previous-release" property in the KHO FDT before kexec. On the next boot, if this property exists, the previous kernel version is retrieved and printed during early boot. This helps diagnose bugs that only manifest when kexecing from specific kernel versions, making it easier to correlate crashes with the kernel that initiated the kexec. Signed-off-by: Breno Leitao Acked-by: SeongJae Park --- include/linux/kho/abi/kexec_handover.h | 3 +++ kernel/liveupdate/kexec_handover.c | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi= /kexec_handover.h index 285eda8a36e4..f4f31e8f575b 100644 --- a/include/linux/kho/abi/kexec_handover.h +++ b/include/linux/kho/abi/kexec_handover.h @@ -84,6 +84,9 @@ /* The FDT property for sub-FDTs. */ #define KHO_FDT_SUB_TREE_PROP_NAME "fdt" =20 +/* The FDT property to track previous kernel (kexec caller) */ +#define KHO_PROP_PREVIOUS_RELEASE "previous-release" + /** * DOC: Kexec Handover ABI for vmalloc Preservation * diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index 3cf2dc6840c9..b2d57868d22f 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -22,6 +22,7 @@ #include #include #include +#include =20 #include =20 @@ -1246,6 +1247,7 @@ struct kho_in { phys_addr_t fdt_phys; phys_addr_t scratch_phys; phys_addr_t mem_map_phys; + char previous_release[__NEW_UTS_LEN + 1]; struct kho_debugfs dbg; }; =20 @@ -1325,6 +1327,8 @@ static __init int kho_out_fdt_setup(void) err |=3D fdt_property_string(root, "compatible", KHO_FDT_COMPATIBLE); err |=3D fdt_property(root, KHO_FDT_MEMORY_MAP_PROP_NAME, &empty_mem_map, sizeof(empty_mem_map)); + err |=3D fdt_property_string(root, KHO_PROP_PREVIOUS_RELEASE, + init_uts_ns.name.release); err |=3D fdt_end_node(root); err |=3D fdt_finish(root); =20 @@ -1436,6 +1440,22 @@ void __init kho_memory_init(void) } } =20 +static int __init kho_print_previous_kernel(const void *fdt) +{ + const char *prev_release; + int len; + + prev_release =3D fdt_getprop(fdt, 0, KHO_PROP_PREVIOUS_RELEASE, &len); + if (!prev_release || len <=3D 0) + return -ENOENT; + + strscpy(kho_in.previous_release, prev_release, + sizeof(kho_in.previous_release)); + pr_info("exec from: %s\n", kho_in.previous_release); + + return 0; +} + void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len, phys_addr_t scratch_phys, u64 scratch_len) { @@ -1513,7 +1533,10 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 f= dt_len, kho_in.scratch_phys =3D scratch_phys; kho_in.mem_map_phys =3D mem_map_phys; kho_scratch_cnt =3D scratch_cnt; - pr_info("found kexec handover data.\n"); + + if (kho_print_previous_kernel(fdt)) + /* Fallback message when previous kernel info unavailable */ + pr_info("found kexec handover data.\n"); =20 out: if (fdt) --=20 2.47.3 From nobody Sun Feb 8 02:41:24 2026 Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 EBB862D8DB5 for ; Thu, 8 Jan 2026 16:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767890485; cv=none; b=FBzYZIpo6KDu6H94X2BBqepQUb05+oTwD49SVHNEgIJUkJZUSSxYwYZSqyDpkI3InsNli9937ku4q45espVfKk4Ddr1tUuv/kW+rErr69CDmNQJFYh808KQxiNHVX0bdHzrHF9PM8l/hnSDbI10xGf7EcI2BFWz/mMPqryo95Mk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767890485; c=relaxed/simple; bh=EGjW1NDVm9NCUZnt/TocKG3VnYx6DZQuPLEer3uoR8g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZA9OkVtWfiQP6OFzTK644CcHODlCXMpFW5OMRLclAhoTzGsBTXJi6q88yoF+5G8QH6N5z3sftC22+QE7UDzBT+cBqxgwtLZNWjRsN4UO5QQdCbqMEukEOOlkVqWJFfT+A5Cuf+zZ7nZc0Hw3z1d6p9HP3rOWBgy8Mhi78GQaYBY= 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.167.172 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-oi1-f172.google.com with SMTP id 5614622812f47-45a84c6746cso147478b6e.1 for ; Thu, 08 Jan 2026 08:41:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767890483; x=1768495283; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=iZ8umbGJ/p+Drr1QM9elVdtntyBO93C2g1yduoenlV8=; b=lGAPKSo5cdZzpv0CavsRePyxvdCo4EHTxUctWTp7bvyPJu03A1iVU28D8vx6dfPa8G ZPJGAIqD6+Ub7R+B6Qc4398tBp32hOCf2w9aRVr21jtcUuxPbMYGFj4U/YQ9zbPAK3sE Uz/v/Hm7zmcDEZ+3uw7ba3Ar08+2doX/jjLUpneFodM8Q7TxzU0+tceATheNt14RTWaw ivNqiCsj2ookWLRu8sW1XTlLI0Mfe0b456uXb3YP0lzWXEtBg3ZWagMKyTHdGjY83YLw BjqClt1L0IECOVQ3NYxIKm0puVRwJjnYsXqqngy4mSlb4NF5TE1swVdZaVcfOAOnGMKo xWZg== X-Gm-Message-State: AOJu0Ywc6tjKHuBo+6h2Nsbf5FepVmYu4dros9xLtJsyzXwmISIs2zIj M5o09QxFWW3nVUwZRdNrhDtzgvV3QlkMq8lE0OLhdSKJ0b7AFuLggciE X-Gm-Gg: AY/fxX4zkVHTOHY0lWPmKpLfoILzgr8aKVwgmB0lc9Vv379yQHw6rU4bG2/o0PL0x9D 2Uf/RGnKJc+5ZrDG20PXqGqCbTLMqt8ALhono3yKy59a6WHNOPLvHTTN9GorrZKlNPP1jbxPznA YppCm84UbSrvHCOMC6UkL7YjdgxWEdLsorux3bwgzn+4zfjAP6N7e2uRE2yqPeo0Lvkj8+FEiKk 3ZQe222GwfRtAujNcJX4XjBQj8F3kpO29iF9aCX9HWJyERAm+KFDaOKTduM/vhKS52sikpRk3fH ubmaDYCZB7U9hRSE+ARWkmE0NM/3mVR+4e3U0Zqrwye8SBetI1OBTkpRwaUZewFhZGf7I0SjB3+ eitTQAXmSdM73feXw2yFDXmmQmMoiiy3nGnnf05Jc0knkHfYgx6ZLYCzheoRnhRW768wyceRgZo Y/mg== X-Google-Smtp-Source: AGHT+IHCIuadUBoGbDl8lPNAk2Neo0/wiZHMcJrJn3lIxd7Vxi/rrb+Y2bIjsKx5NXNgYjuC3j6EEw== X-Received: by 2002:a05:6830:1cc2:b0:7c5:3045:6c6f with SMTP id 46e09a7af769-7ce50a28c93mr3497087a34.20.1767890482801; Thu, 08 Jan 2026 08:41:22 -0800 (PST) Received: from localhost ([2a03:2880:10ff:43::]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ce478af8besm5595632a34.14.2026.01.08.08.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 08:41:22 -0800 (PST) From: Breno Leitao Date: Thu, 08 Jan 2026 08:40:59 -0800 Subject: [PATCH v3 2/2] kho: history: track kexec boot counter 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: quoted-printable Message-Id: <20260108-kho-v3-2-b1d6b7a89342@debian.org> References: <20260108-kho-v3-0-b1d6b7a89342@debian.org> In-Reply-To: <20260108-kho-v3-0-b1d6b7a89342@debian.org> 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=3603; i=leitao@debian.org; h=from:subject:message-id; bh=EGjW1NDVm9NCUZnt/TocKG3VnYx6DZQuPLEer3uoR8g=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpX94vFhyv1+q5nq7d3U4aG09l2a2v9OVLjM38M Alw0viiRZ2JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaV/eLwAKCRA1o5Of/Hh3 bYQwD/9eHb6ErCrxXzsTuDNHlKgULxd03DOyrKRfmQu7kTOUtZlqSCyZ4P2EeLCfbluUpJnnESG UAVFWIxNs7YXzhUNd7cWqmoZH+mBLVOby7T8HD+MeG+8z6VuUQXpE9mQVEsS0N5g0L6+FWWFgAd VqezYtxXpJeV32vXCpcmBEcZpUE3od+8MAIK1LqWcUbsCKLy/0kXXemulGMzLks31aLqX86ni/i X+9lZpg99/gVXF8Jz3lqX+hNi9TIRsXWGaU281XTD1tF3BgTcXXCyHE8m15DjbelamQimU3chBg DMteI6JOK4sjOWjTLtutUHeHuUwcuuUpiTc2Zk+pvF6X4ij24/VQcoCVl9QLiHL4EjTlbYaXGMK eh6yLVMjs32YEVhnOxY850v6dWpXovo5PFQUd3ECljjlvTmrD6aLrQh1g92CX7sPIoJYTOEIl8x 81RtpCzW+Gky6ezAfpzbZfnGAJrQi2XvgB6Y7xvZEiDsGTKtnNKeHZ4uZDf2xt0EBZmbk8aP4Rd IQ/tPzLyEsBSAJTjlPDAIaeEFRFmBwoI1s/vu1zCB0DiRnm6/tnremV8GX/ewBSbiyaDWX2+8zH AzQ0hXXhX98UteCdW/+vC7v/59qftT+spmlGWRF8WqkY9v/ZZwZ3kMESQjBGioYQXj3Q3+SR7BB FQswweva+CDz0Zg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D Track and display the number of kexec boots since the last cold reboot. This extends the previous kernel release tracking by adding a counter that increments with each kexec boot. The counter provides visibility into the kexec chain depth, which is useful for understanding boot history in production environments. Add a new property "kexec-count" in KHO FDT alongside the existing "previous-release" property. The counter is: - Initialized to 0 on cold boot (when kho_in is first instantiated) - Incremented by 1 on each subsequent kexec - Printed alongside the previous kernel release version The counter is stored as a 32-bit unsigned integer in FDT format. This is different than counter for LUO, given KHO can be used independently from LUO. Also WARN() if KHO_PROP_PREVIOUS_RELEASE doesn't exist, because it must exist if KHO_PROP_PREVIOUS_RELEASE exists. Signed-off-by: Breno Leitao Suggested-by: Pasha Tatashin Acked-by: SeongJae Park --- include/linux/kho/abi/kexec_handover.h | 3 +++ kernel/liveupdate/kexec_handover.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi= /kexec_handover.h index f4f31e8f575b..9c4fc4c6a212 100644 --- a/include/linux/kho/abi/kexec_handover.h +++ b/include/linux/kho/abi/kexec_handover.h @@ -87,6 +87,9 @@ /* The FDT property to track previous kernel (kexec caller) */ #define KHO_PROP_PREVIOUS_RELEASE "previous-release" =20 +/* The FDT property to track number of kexec counts so far */ +#define KHO_PROP_KEXEC_COUNT "kexec-count" + /** * DOC: Kexec Handover ABI for vmalloc Preservation * diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index b2d57868d22f..34cfc98076b8 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -1248,6 +1248,7 @@ struct kho_in { phys_addr_t scratch_phys; phys_addr_t mem_map_phys; char previous_release[__NEW_UTS_LEN + 1]; + u32 kexec_count; struct kho_debugfs dbg; }; =20 @@ -1319,6 +1320,7 @@ static __init int kho_out_fdt_setup(void) { void *root =3D kho_out.fdt; u64 empty_mem_map =3D 0; + u32 kexec_count; int err; =20 err =3D fdt_create(root, PAGE_SIZE); @@ -1329,6 +1331,10 @@ static __init int kho_out_fdt_setup(void) sizeof(empty_mem_map)); err |=3D fdt_property_string(root, KHO_PROP_PREVIOUS_RELEASE, init_uts_ns.name.release); + /* kho_in.kexec_count is set to 0 on cold boot */ + kexec_count =3D kho_in.kexec_count + 1; + err |=3D fdt_property(root, KHO_PROP_KEXEC_COUNT, &kexec_count, + sizeof(kexec_count)); err |=3D fdt_end_node(root); err |=3D fdt_finish(root); =20 @@ -1443,15 +1449,23 @@ void __init kho_memory_init(void) static int __init kho_print_previous_kernel(const void *fdt) { const char *prev_release; + const u32 *count_ptr; int len; =20 prev_release =3D fdt_getprop(fdt, 0, KHO_PROP_PREVIOUS_RELEASE, &len); if (!prev_release || len <=3D 0) return -ENOENT; =20 + /* Read the kexec count from the previous kernel */ + count_ptr =3D fdt_getprop(fdt, 0, KHO_PROP_KEXEC_COUNT, &len); + if (WARN_ON(!count_ptr || len !=3D sizeof(u32))) + return -ENOENT; + kho_in.kexec_count =3D *count_ptr; + strscpy(kho_in.previous_release, prev_release, sizeof(kho_in.previous_release)); - pr_info("exec from: %s\n", kho_in.previous_release); + pr_info("exec from: %s (count %u)\n", kho_in.previous_release, + kho_in.kexec_count); =20 return 0; } --=20 2.47.3