From nobody Mon Jun 15 20:32:55 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9E8E3CCFAD; Mon, 13 Apr 2026 13:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776086820; cv=none; b=mU7WNt6foKpKTz34unjMR6RqBqWuSFHW5FM5vQqj4k32t3+xxopHNnNzGs4z/v6sNjabF+Z+jjsaMM/1MADA0GhLgxYQfcoL6PFcqJG4/jTFalO3+xHWfGeBFnc4T/tQtPZi1svFqioG8dM8Xgv6dSIXwr1rcVvMdKC6XgiwKzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776086820; c=relaxed/simple; bh=5kticVozScC6u8qmLk9+hhZd71yiocm3BKCHqXfpTvc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B96+yO7rdXBmh8/azbxa4+fT7ieTbHq1EtPxTHCLXC48FxOgAGXu0UQbLX4BGHOMUZraTmB+p1yoPE7KM6EfiXoRGjUuTcEKX1IWqrIFaaEN35Bl3dWtCyYXUQjq9xfuPw5QN/eKL/CIqLbJhEoJ2Kaa/Syn++XTXzbEr1EVmWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=none smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=SegWXM+3; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="SegWXM+3" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=Ts5NH0xUvZdmVlkgq9z2yi5cSaxNAbH4JcbwnyOwfPI=; b=SegWXM+33+iQB4lzbciiQtJfqE y9zWi3WdYV5DpEeTro/sk84OUYQNQVXiNyWsbRLqt2/N/CcK9paVcPJMRqKbsthaKoz/3+sb9beNI 32BB5VuwvDNg5IYdhiB8D4GkP6b0PVIVf9kgcd6j2pdv3fhtNe2llJUC/6GN7RNCqkimqw2o/+OeO NKNCv7SIBZFbG4myyCZ+8dlwRID4SOHvnyI/s6P5IIpZ5dIjaQ6vtfYmLu3p/zCz8QvhgJkLoeZ26 KAkWfydAemXmFix9QXWrfWTCDPRnQZPYlEXq2vOUFVXsCPo8VrviOsUf/V66pCLP6SgF1rjhYamtx Gh5qEKDQ==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wCHJQ-00CKEQ-2C; Mon, 13 Apr 2026 13:26:48 +0000 From: Breno Leitao Date: Mon, 13 Apr 2026 06:26:33 -0700 Subject: [PATCH v3 1/3] mm/memory-failure: report MF_MSG_KERNEL for reserved pages 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: <20260413-ecc_panic-v3-1-1dcbb2f12bc4@debian.org> References: <20260413-ecc_panic-v3-0-1dcbb2f12bc4@debian.org> In-Reply-To: <20260413-ecc_panic-v3-0-1dcbb2f12bc4@debian.org> To: Miaohe Lin , Naoya Horiguchi , Andrew Morton , Jonathan Corbet , Shuah Khan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-453a6 X-Developer-Signature: v=1; a=openpgp-sha256; l=3839; i=leitao@debian.org; h=from:subject:message-id; bh=5kticVozScC6u8qmLk9+hhZd71yiocm3BKCHqXfpTvc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBp3O8OGjMhJ00sPwi1tkdTGacpr0NdoWmXFCwqB fETGcica/uJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCadzvDgAKCRA1o5Of/Hh3 bTMOEACDVZS/51etxbpUL7Fkz6ajXdmMgOGgxmuNv7buSOZbViDuCi1ds2F/1rXwxwpxHG83XA3 KYdFSDzqS9bqK17+lFSC4W7hfOXqLUID2NYoVCuvKScI1sk6JL9UHn8Q8mQFh7ohtfQgnYRJd/p VSDvW4wpIgX8+UavBQCvtRr5QIaH2zAhJD6DD6OUBQyn8/l4LSFOfVZHtEiCkOJO2xB8HrHDtM1 UHQMlsndcKtDtErSj1OJlbqmy19xM/jD2HOf9zWN4RsGGOgz97uhbFYRHzb1ZgKdPagi+4Wm3v1 R4SYPz6OHHtb+orElndz4KXEwwozJA5N8Msh+7efgPPho7Jpxxl789+XZVNVEiXfpOzqMSRVZD3 DdnbIlV4hNrspnEz4iBuzVy9p5xJxn4yPSi4fmudxWGxon8iLyvzYdwGDhXi8kW5xzRvAh03Gry pttT2Vl7BcM81su4p1IOFRkj/WrBpcdWJOXhy4yzxkbHIEwYIHNldDBO5QRiRvm7zcGmY0R024/ 70ETzBG98+7b2FHdnFxlg7HzcOw9SRPCfF+ODwTOYVoEn0twZKFTT1GOqqLlvVKEcPVAlloxV/G OJfI0egBuyqFiBQIx8+pdyhjLqBKL/oY3hldDPmapM2IONXLZpO1kjwarMk4T8KCFQKbhTf58Sv ET1F4s/x9fIsJGg== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao When get_hwpoison_page() returns a negative value, distinguish reserved pages from other failure cases by reporting MF_MSG_KERNEL instead of MF_MSG_GET_HWPOISON. Reserved pages belong to the kernel and should be classified accordingly for proper handling by the panic_on_unrecoverable_memory_failure mechanism. Signed-off-by: Breno Leitao --- mm/memory-failure.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index ee42d43613097..852c595aff108 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -74,6 +74,8 @@ static int sysctl_memory_failure_recovery __read_mostly = =3D 1; =20 static int sysctl_enable_soft_offline __read_mostly =3D 1; =20 +static int sysctl_panic_on_unrecoverable_mf __read_mostly; + atomic_long_t num_poisoned_pages __read_mostly =3D ATOMIC_LONG_INIT(0); =20 static bool hw_memory_failure __read_mostly =3D false; @@ -155,6 +157,15 @@ static const struct ctl_table memory_failure_table[] = =3D { .proc_handler =3D proc_dointvec_minmax, .extra1 =3D SYSCTL_ZERO, .extra2 =3D SYSCTL_ONE, + }, + { + .procname =3D "panic_on_unrecoverable_memory_failure", + .data =3D &sysctl_panic_on_unrecoverable_mf, + .maxlen =3D sizeof(sysctl_panic_on_unrecoverable_mf), + .mode =3D 0644, + .proc_handler =3D proc_dointvec_minmax, + .extra1 =3D SYSCTL_ZERO, + .extra2 =3D SYSCTL_ONE, } }; =20 @@ -1281,6 +1292,35 @@ static void update_per_node_mf_stats(unsigned long p= fn, ++mf_stats->total; } =20 +/* + * Determine whether to panic on an unrecoverable memory failure. + * + * Design rationale: This design opts for immediate panic on kernel memory + * failures, capturing clean crashes other than random crashes on MF_IGNOR= ED pages + * + * This panics on three categories of failures: + * - MF_MSG_KERNEL: Reserved pages that cannot be recovered + * - MF_MSG_KERNEL_HIGH_ORDER: High-order kernel pages that cannot be reco= vered + * - MF_MSG_UNKNOWN: Pages with unknown state that cannot be classified as= recoverable + * - and the page is not being recovered (result =3D MF_IGNORED) + * + * Note: Transient races are mitigated by memory_failure()'s retry mechani= sm. + * When a buddy allocator race is detected (take_page_off_buddy() fails), = the + * code clears PageHWPoison and retries the entire memory_failure() flow, + * allowing pages to be properly reclassified with updated flags. This ens= ures + * that false posiotives are not misclassified as unrecoverable. + * + */ +static bool panic_on_unrecoverable_mf(enum mf_action_page_type type, + enum mf_result result) +{ + return sysctl_panic_on_unrecoverable_mf && + result =3D=3D MF_IGNORED && + (type =3D=3D MF_MSG_KERNEL || + type =3D=3D MF_MSG_KERNEL_HIGH_ORDER || + type =3D=3D MF_MSG_UNKNOWN); +} + /* * "Dirty/Clean" indication is not 100% accurate due to the possibility of * setting PG_dirty outside page lock. See also comment above set_page_dir= ty(). @@ -1298,6 +1338,9 @@ static int action_result(unsigned long pfn, enum mf_a= ction_page_type type, pr_err("%#lx: recovery action for %s: %s\n", pfn, action_page_types[type], action_name[result]); =20 + if (panic_on_unrecoverable_mf(type, result)) + panic("Memory failure: %#lx: unrecoverable page", pfn); + return (result =3D=3D MF_RECOVERED || result =3D=3D MF_DELAYED) ? 0 : -EB= USY; } =20 @@ -2432,7 +2475,11 @@ int memory_failure(unsigned long pfn, int flags) } goto unlock_mutex; } else if (res < 0) { - res =3D action_result(pfn, MF_MSG_GET_HWPOISON, MF_IGNORED); + if (PageReserved(p)) + res =3D action_result(pfn, MF_MSG_KERNEL, MF_IGNORED); + else + res =3D action_result(pfn, MF_MSG_GET_HWPOISON, + MF_IGNORED); goto unlock_mutex; } =20 --=20 2.52.0 From nobody Mon Jun 15 20:32:55 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FC103CCFCE; Mon, 13 Apr 2026 13:26:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776086821; cv=none; b=T+qg9rS2DayTIp0WR+U/6rCmOyqdK1fcDX+kzYhTb4kC5vFJ+Nb6qBqK/UjNni148rmXqGpB4mWAu6a62WS3fQT6Cr77Q9MIIW0scprf57oE+MnVZ54etNp+qCRWxMGbnImTmNhqj8U0w3GaUhO+el0n1wO7vmDdD2N9ANMN1Lw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776086821; c=relaxed/simple; bh=bjhevl0rGny8MBH5z4YjsMVd08Vv7Qa3pt9kmLqdPhg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jpHf5d1Iji0Mlj++RhKqWEtueYlOlNLQT+uK14byzR2MLf282TZOH99aUfJ1eSTllwK/FquMF9/uin0TrSNyGxiXU90j26n84magkT/7j60JchpmmS8QDsVbcsAc9NGds60nx0ch/E0TWRMUEWWXDUtpigsn8aHFgrJuT7Hrbds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=none smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=GoM5tt+g; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="GoM5tt+g" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=glADREE+VEmEvXEBjVhecQZeEIPkFQqH+en5bctHaaA=; b=GoM5tt+gkJHHCFvIY8VycuA09j dx6RZ3UWH1pXUr8olEKT6e5C4EpFAiJmhCidL3pz9AmJGuG8/uOghmWuwCQVue4EP6/cehujA2ZzM MB93Yk6xGSLy5LoZI+qxEL3LSMlMIN4iqtQJcDg96G+rLgTm7zVrXler+RVhQt46PRTkCyQPZYojM rOZnHtIi1a3nH34iT9JEdyOSzMMjOrIQ5EBm8jtBHsGRLjtoQPCoWeppd/5iuInMTJX+osJViQx1d PbEpxQWmfoeYj3SMJgifSMRQ7Sr8KDWfZ+xk6vtHQHFWRoTvGmFNsu2IoVeyDMKIpmf8qFdgHfYZc /UL015ig==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wCHJV-00CKEV-1k; Mon, 13 Apr 2026 13:26:53 +0000 From: Breno Leitao Date: Mon, 13 Apr 2026 06:26:34 -0700 Subject: [PATCH v3 2/3] mm/memory-failure: add CONFIG_BOOTPARAM_MEMORY_FAILURE_PANIC option 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: <20260413-ecc_panic-v3-2-1dcbb2f12bc4@debian.org> References: <20260413-ecc_panic-v3-0-1dcbb2f12bc4@debian.org> In-Reply-To: <20260413-ecc_panic-v3-0-1dcbb2f12bc4@debian.org> To: Miaohe Lin , Naoya Horiguchi , Andrew Morton , Jonathan Corbet , Shuah Khan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-453a6 X-Developer-Signature: v=1; a=openpgp-sha256; l=3040; i=leitao@debian.org; h=from:subject:message-id; bh=bjhevl0rGny8MBH5z4YjsMVd08Vv7Qa3pt9kmLqdPhg=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBp3O8OF6tcX6PKJIBNETopoLJS8dwox8KQs2U4y BFoRT7EAtuJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCadzvDgAKCRA1o5Of/Hh3 bc8MD/9AxahVhWW8Xw4b1CRGc/JOcFzM8uT6pxI5EuHMeo8DCmrD/HLeYtkEmbQzqvIkvCPqiLv CvCim+4708mbhR4OP2HuM5+ojhiZ2FWhTT6fl6KVvVFcjzboF/3yRynwezzQtEVNNF2rsjsqIXL LnDH/M7W1LH7BbiKy2GzzcqLooGr8+u1Cs0NorzgATzvrw/nHd+Xq6O9m+j34H56tG3nYctQj/k faKtHcQr7swEdAPFypQXWDCG1OgoOpzNOMzkz/xhztftSluBoyfeA/13pspc/+PQeVC71DTrfd9 juJMe5Rmu+SoAdp5MbPNuRU3BOQvqwIgsJ/u6GbXeJUa31TVR+OlsicTlRaVlnTBRy/0MlWOKXF bIrNDWWLAImz9hN2G66hqMmDM++3pagzs38I7C0NvTcP5y4/ngLr3DhIvuJFICgooWuAqZJ7C+z Z5k+e0mNVkTRRoc9IiufcU2AjCIknGJo/X+WuAV6qPI/Y5IrfjrxpWLHNW1ssjm6OZpy4o0ENM+ 5NMxSOBEiSKEvJK4IdK0Poe7/i34DqFGt0hLPnAJbSjkOkXP42qZdtrauXu29SswtCxCteLLJEI cyleZoYrTMKo1w74d73f6Orn9HDOS40Ejfi9TXRWuMVYAPzucjeUVVwIVX44qO/Krc0xZK6f3Tq +Hrh9IaHgpTB4lw== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Add a kernel configuration option to enable panic on unrecoverable memory failures at boot time, similar to CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC and CONFIG_BOOTPARAM_HARDLOCKUP_PANIC. This allows systems that prioritize availability over recovery to automatically panic when encountering unrecoverable kernel memory failures. The behavior can still be controlled at runtime via the panic_on_unrecoverable_memory_failure sysctl. When enabled, the kernel will panic if: * A memory failure affects kernel pages that cannot be recovered * A memory failure affects high-order kernel pages * A memory failure affects unknown page types that cannot be recovered Examples of BOOTPARAM configuration usage: 1. Building with the panic option enabled by default: CONFIG_BOOTPARAM_MEMORY_FAILURE_PANIC=3Dy 2. Disabling at runtime even when compiled in: echo 0 > /proc/sys/vm/panic_on_unrecoverable_memory_failure 3. Enabling at runtime when not compiled in by default: echo 1 > /proc/sys/vm/panic_on_unrecoverable_memory_failure Similar to other BOOTPARAM options, this provides a balance between: - Safe defaults (disabled by default without CONFIG option) - Production flexibility (can be enabled at build time) - Runtime control (can be toggled via sysctl) This is consistent with the kernel's approach to other panic-on-error options that allow systems to choose between attempting recovery or failing fast when critical errors are detected. Signed-off-by: Breno Leitao --- mm/Kconfig | 9 +++++++++ mm/memory-failure.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index ebd8ea353687e..596f24a872ff6 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -733,6 +733,15 @@ config MEMORY_FAILURE even when some of its memory has uncorrected errors. This requires special hardware support and typically ECC memory. =20 +config BOOTPARAM_MEMORY_FAILURE_PANIC + bool "Panic on unrecoverable memory failure" + depends on MEMORY_FAILURE + help + Say Y here to panic when an unrecoverable memory failure is + detected. This covers kernel pages, high-order kernel pages, + and unknown page types that cannot be recovered. Can be disabled + at runtime via the panic_on_unrecoverable_memory_failure sysctl. + config HWPOISON_INJECT tristate "HWPoison pages injector" depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 852c595aff108..cf06960b4d069 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -74,7 +74,8 @@ static int sysctl_memory_failure_recovery __read_mostly = =3D 1; =20 static int sysctl_enable_soft_offline __read_mostly =3D 1; =20 -static int sysctl_panic_on_unrecoverable_mf __read_mostly; +static int sysctl_panic_on_unrecoverable_mf __read_mostly =3D + IS_ENABLED(CONFIG_BOOTPARAM_MEMORY_FAILURE_PANIC); =20 atomic_long_t num_poisoned_pages __read_mostly =3D ATOMIC_LONG_INIT(0); =20 --=20 2.52.0 From nobody Mon Jun 15 20:32:55 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2A723CAE95; Mon, 13 Apr 2026 13:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776086839; cv=none; b=meWV+2prlpPe7Ygi/GATK9sN5QidfZ2vn0+DGEbgYjOCYszqsM0Ue76YsofhG6TJghDpBwOnZuzwQc116UykCUl1xtpYfqqX4M7gQ1VI27TBfq3e8sXpDOcxzRIDsu39Y/g+edr/gnfAB28T+c/LeUVDxewU4S+3UP0+ne2Jyyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776086839; c=relaxed/simple; bh=Mp1Qv6rhhs0jzy9DwGJSWL5EM4TqsDFHcgB+US1rhmY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DiSm5ys/gSAEnV0EgHIhuIHJI51MXNdq1qMWQFjBmTQQqxZs4AZTawzEYVjMGSbwLWaaa16oO+DxLW9jXZj5Vo3EVVy52ErGhUPOx9YQQrZtfnRX7+UrlLHBuIWpQS+S0QPks3CIgIvg1UPXw/RWbEBfTZymatYum3BgI+AtO2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=none smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=QBzc305O; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="QBzc305O" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=nbtwqqP04/XwB92jTwUHTtIQvE/SEZDBq3VRc3N6Y6I=; b=QBzc305OGUU3CKBmxPvJpBa4Oi I+/4n5il8SogHtoZ9MYMe5yABscVp4Uwgzh7udwzt87tchgUBR60wrkk3013QEZGquOerBE/DLD6y I+rFCji1nIzcCUrJJ++zbGDBJANL6pQRdpdDLuinvsc9TNjaujyOLdviEwyNIbBayln7o509HIBre Wic1Em1XHS3+OKmfW9u9rOJ1B2ipR/UxyfAneocY+8yVQKj51+KYTOvC4M2+068/5Nc0unBm+gz+2 6yfunAVklS9x8MwaYjqT5W9Tu0FsVhUTnxel7+gKsAbEs3NZc9MtgWZazik+Kr8QK9RHHvsfede3r voQFxuVA==; Received: from authenticated user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1wCHJa-00CKEj-03; Mon, 13 Apr 2026 13:26:58 +0000 From: Breno Leitao Date: Mon, 13 Apr 2026 06:26:35 -0700 Subject: [PATCH v3 3/3] Documentation: document panic_on_unrecoverable_memory_failure sysctl 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: <20260413-ecc_panic-v3-3-1dcbb2f12bc4@debian.org> References: <20260413-ecc_panic-v3-0-1dcbb2f12bc4@debian.org> In-Reply-To: <20260413-ecc_panic-v3-0-1dcbb2f12bc4@debian.org> To: Miaohe Lin , Naoya Horiguchi , Andrew Morton , Jonathan Corbet , Shuah Khan , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-453a6 X-Developer-Signature: v=1; a=openpgp-sha256; l=3210; i=leitao@debian.org; h=from:subject:message-id; bh=Mp1Qv6rhhs0jzy9DwGJSWL5EM4TqsDFHcgB+US1rhmY=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBp3O8OOxyyLmnEVBgYOxqnlJRNzEM32jMwRHuJl lp++LJaOeOJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCadzvDgAKCRA1o5Of/Hh3 bbCzD/9leaOJbS39F2fvv+N0M66/TmFRtRCcOvuRaKUAiQBKdSD1YSoEQj/XTjfciF6P5hnM7xz z+aS5nQ1qmxSLt/HRHr7rxoCfaSg0I+P0ltripbJMdGICH4kW1rvmfUcGQT8wRwz/4lipjlOFec jFublJBDLwhJmN9e2X3x4uXgJu4D4w8QWlXAW/ScqPcOYARBsjIsbWn44+1JoehOLSovAcWL/Pp LT+uIQxpkclyud2f+JDVRHE+vZDjl+PIgNWUBQBLCHWUmTCmxgh8jkkpMgVblybwg6t2113OfPw fHUQy5kQesNq2FKEU7QUESbLK0nXapRElS1AFOJvPhm7hkXbtTsa+k+39jLu4/zxFv8ToGhG6i/ PQWe2A/8s9edOQR1dEQ6MVbsrzZE1gduOsoMmFv2REu4gqWiEyFdDynidGUS6evfEBTgOV72gSd nfFItHI9Iha6SBepQQB0W2IGVk587944kax9CtNXIWL5JOyt88lDUXkZy7h/L0R8rP2jlRPWjWm bpiDU2XojNGjjJeOJiQHh20p54N+ghvu63JKOZeeNlw6/dKxYqUFTPznWPwtm4NGxsO8+V10KmE 3WopOzwuVW+t8nmq3ORD19ijF9bZwM8FQsKnklTlw19aTltDK+/URDsNvwZFEfveAYI0aJArQeU m2XO1b/mwZvaQ6A== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao Document the vm.panic_on_unrecoverable_memory_failure sysctl in the admin guide, including the CONFIG_BOOTPARAM_MEMORY_FAILURE_PANIC kernel configuration option that allows enabling this behavior at build time. This follows the same format as panic_on_unrecovered_nmi and other panic-on-error documentation, providing clear examples of: - Enabling panic at build time via CONFIG option - Disabling at runtime via sysctl - Enabling at runtime via sysctl Signed-off-by: Breno Leitao --- Documentation/admin-guide/sysctl/vm.rst | 46 +++++++++++++++++++++++++++++= ++++ 1 file changed, 46 insertions(+) diff --git a/Documentation/admin-guide/sysctl/vm.rst b/Documentation/admin-= guide/sysctl/vm.rst index 97e12359775c9..af545869bc1b4 100644 --- a/Documentation/admin-guide/sysctl/vm.rst +++ b/Documentation/admin-guide/sysctl/vm.rst @@ -67,6 +67,7 @@ Currently, these files are in /proc/sys/vm: - page-cluster - page_lock_unfairness - panic_on_oom +- panic_on_unrecoverable_memory_failure - percpu_pagelist_high_fraction - stat_interval - stat_refresh @@ -925,6 +926,51 @@ panic_on_oom=3D2+kdump gives you very strong tool to i= nvestigate why oom happens. You can get snapshot. =20 =20 +panic_on_unrecoverable_memory_failure +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +When a hardware memory error (e.g. multi-bit ECC) hits an in-use kernel +page that cannot be recovered by the memory failure handler, the default +behaviour is to ignore the error and continue operation. This is +dangerous because the corrupted data remains accessible to the kernel, +risking silent data corruption or a delayed crash when the poisoned +memory is next accessed. + +Pages that reach this path include slab objects (dentry cache, inode +cache, etc.), page tables, kernel stacks, and other kernel allocations +that lack the reverse mapping needed to isolate all references. + +For many environments it is preferable to panic immediately with a clean +crash dump that captures the original error context, rather than to +continue and face a random crash later whose cause is difficult to +diagnose. + +=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +0 Try to continue operation (default). +1 Panic immediately. If the ``panic`` sysctl is also non-zero then the + machine will be rebooted. +=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This sysctl can be set to 1 at boot time by enabling the +``CONFIG_BOOTPARAM_MEMORY_FAILURE_PANIC`` kernel configuration option. +This provides systems with the ability to enforce panic-on-error behavior +from the kernel build, without requiring runtime sysctl configuration. + +Examples: + +1. Enable panic on unrecoverable memory failure at kernel build time:: + + CONFIG_BOOTPARAM_MEMORY_FAILURE_PANIC=3Dy + +2. Disable at runtime even when compiled in:: + + echo 0 > /proc/sys/vm/panic_on_unrecoverable_memory_failure + +3. Enable at runtime when not enabled at build time:: + + echo 1 > /proc/sys/vm/panic_on_unrecoverable_memory_failure + + percpu_pagelist_high_fraction =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =20 --=20 2.52.0