From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout06.his.huawei.com (canpmsgout06.his.huawei.com [113.46.200.221]) (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 48BAB358391; Tue, 7 Apr 2026 02:57:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.221 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775530668; cv=none; b=SF2TGtIqxIF8DlLc0r3h/Z4QgT+WcZgnbYYBpSpLI4T/0EzdndFLKfJK8Aa/naqHNN5NJQwnU6t5EelLDJjhDPn65gC9yAwLAjgtcb7IkbOa5Fy4QptFWk0wCjrOIpSuzOX4luMbpZB6IaWUq7GvqcMOsRPJupSrbNBBndXQBqM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775530668; c=relaxed/simple; bh=RuKcCmM1WHdyHcmJHDTDYNNNWUMPVrD4Dw0u1UP150o=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=iqYEYb/QDXcE6TKEg07BXFys1O5DM4llzjcrLrf67PH4i8WD+Pp8uT1q2dAAFXEb68PMr6rxc+8r+Qc1pBth1CdY1sCbf5RA4IXGs0Z1q50BAsIMevObebrFGhJ+FArU+3CHMuGehxHdtxK/hbjkRtRC48MeGxtPIkOOSCwZrKs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=JJEk76RO; arc=none smtp.client-ip=113.46.200.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="JJEk76RO" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=ETgww+HwxHhmO9mtPFnDQxT1EU42o/a0milwkwWeNSg=; b=JJEk76ROATZJcg+uB4TytQD5rt+o3NIKXmfoiiOyV4i7Ss3LYwRSYNSeP1xYcT7+ck2jzGq1j 1fL3gTZYY7h1/9QLTuXeYaM6S06MWVCjPRRgNlCYEbxohec4zZZvQhQds9tJIhuwKvuQYWGsJSd EuyEd/6cb1TyCiJVFy2dLoQ= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4fqW184C0gzRhQv; Tue, 7 Apr 2026 10:51:24 +0800 (CST) Received: from dggemv712-chm.china.huawei.com (unknown [10.1.198.32]) by mail.maildlp.com (Postfix) with ESMTPS id E04222025F; Tue, 7 Apr 2026 10:57:37 +0800 (CST) Received: from kwepemq500010.china.huawei.com (7.202.194.235) by dggemv712-chm.china.huawei.com (10.1.198.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 7 Apr 2026 10:57:37 +0800 Received: from [10.173.124.160] (10.173.124.160) by kwepemq500010.china.huawei.com (7.202.194.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 7 Apr 2026 10:57:36 +0800 Subject: Re: [PATCH v2 2/3] mm/memory-failure: add panic_on_unrecoverable_memory_failure sysctl To: Breno Leitao CC: , , , , Naoya Horiguchi , Andrew Morton , Jonathan Corbet , Shuah Khan References: <20260331-ecc_panic-v2-0-9e40d0f64f7a@debian.org> <20260331-ecc_panic-v2-2-9e40d0f64f7a@debian.org> From: Miaohe Lin Message-ID: <59c133a7-74a7-4678-d907-add764bbd107@huawei.com> Date: Tue, 7 Apr 2026 10:57:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20260331-ecc_panic-v2-2-9e40d0f64f7a@debian.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemq500010.china.huawei.com (7.202.194.235) On 2026/3/31 19:00, Breno Leitao wrote: > Add a sysctl that allows the system 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. > > Signed-off-by: Breno Leitao > --- > mm/memory-failure.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 6ff80e01b91a..d0d911c54ff1 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -74,6 +74,8 @@ static int sysctl_memory_failure_recovery __read_mostly = 1; > > static int sysctl_enable_soft_offline __read_mostly = 1; > > +static int sysctl_panic_on_unrecoverable_mf __read_mostly; > + > atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0); > > static bool hw_memory_failure __read_mostly = false; > @@ -155,6 +157,15 @@ static const struct ctl_table memory_failure_table[] = { > .proc_handler = proc_dointvec_minmax, > .extra1 = SYSCTL_ZERO, > .extra2 = SYSCTL_ONE, > + }, > + { > + .procname = "panic_on_unrecoverable_memory_failure", > + .data = &sysctl_panic_on_unrecoverable_mf, > + .maxlen = sizeof(sysctl_panic_on_unrecoverable_mf), > + .mode = 0644, > + .proc_handler = proc_dointvec_minmax, > + .extra1 = SYSCTL_ZERO, > + .extra2 = SYSCTL_ONE, > } > }; > > @@ -1298,6 +1309,11 @@ static int action_result(unsigned long pfn, enum mf_action_page_type type, > pr_err("%#lx: recovery action for %s: %s\n", > pfn, action_page_types[type], action_name[result]); > > + if (sysctl_panic_on_unrecoverable_mf && result == MF_IGNORED && > + (type == MF_MSG_KERNEL || type == MF_MSG_KERNEL_HIGH_ORDER || > + type == MF_MSG_UNKNOWN)) > + panic("Memory failure: %#lx: unrecoverable page", pfn); Will it be better to add a helper here? Thanks. .