From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A71ACCD3448 for ; Tue, 3 Sep 2024 16:09:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 359378D01A2; Tue, 3 Sep 2024 12:09:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 309618D016E; Tue, 3 Sep 2024 12:09:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F8758D01A2; Tue, 3 Sep 2024 12:09:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id F07318D016E for ; Tue, 3 Sep 2024 12:09:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 805E01C4093 for ; Tue, 3 Sep 2024 16:09:13 +0000 (UTC) X-FDA: 82523911386.18.E845212 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id B0F59C001B for ; Tue, 3 Sep 2024 16:09:11 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ujGJwoBi; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of jarkko@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jarkko@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725379728; a=rsa-sha256; cv=none; b=Z2hzwCs82woQbRrh1PsUcpubYk4JynCbnBh2OncML2SkfTSZ4zK/o/2iNnIZyTTr+3BvLP z8//RlYUOfbmHc4N8bdSRzOQKdT42rBj4sbM0DN5TTnV83RZMdQL1szjzuaHF/F2kM93Fl mWvm87jkKKB8wenFWAree2knyzvFdhg= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ujGJwoBi; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of jarkko@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jarkko@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725379728; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eg4idakTi1FueA/uTA4hD1gtMKMAFuKuk+E8sWCEMvA=; b=XWxsryDdo63DAIH1TP/cWOR7DqvdEHJf8puPaEF4QiGaXfNzVTuwHHPHuP/OqC+o6C/a6B 5hGcnLyU8A7nNB086likqoaBDL0+W2MwUJVC7yalyQNf9Uu62duZmQisDnRwH6zNCrgYh8 CuNM2TE/J5dr2I4VOk6zwR/V4Gd51bs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0B5A65C59FB; Tue, 3 Sep 2024 16:09:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95293C4CEC9; Tue, 3 Sep 2024 16:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725379750; bh=2oYWilPB6GddQnusHJpSufcnEcbn+RzWwm5DmozUZ5Y=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=ujGJwoBiOh2tAitzebKvJV818ZPaoPQPGoqDLnRbHBC9DXT4PpN9tWumvGo3t5ihn OKUzwmYInDHw+s1JSfEN9mGM6hGjklGRUyjOroraCZYLV7HJivjXdljn72TI34x1w9 rn1br2qKhJ2VlnY1nhQfyi+uRzfy5RZf6lm3H85CvDsX4fGefJaPydF4s3r0luCB2k j5y1XxE2QDmAhogT7Pn1MdOOnOo26OMmxmfyyUkI3LnLq+J50GDjW7bZg3N7o+/L+k DyNUk59BgN9jsvVVvfX/zQC12RXSHTDW8wznhdE4b21z523+iZwNymeTE0sfeQG0dN WuvpuhCHlS5rA== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 03 Sep 2024 19:09:06 +0300 Message-Id: Cc: , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v12 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered From: "Jarkko Sakkinen" To: "Shuai Xue" , , , , , , , , , , , , X-Mailer: aerc 0.18.2 References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> <20240902030034.67152-2-xueshuai@linux.alibaba.com> In-Reply-To: <20240902030034.67152-2-xueshuai@linux.alibaba.com> X-Rspam-User: X-Rspamd-Queue-Id: B0F59C001B X-Rspamd-Server: rspam01 X-Stat-Signature: u57ya1mmafue3c61x39aayc8inb48buq X-HE-Tag: 1725379751-793754 X-HE-Meta: U2FsdGVkX1+ZEVDUX0cC2YQedV729NWur1nsjf1u0cbVc3/qJPW/XZyYHsH7+RQVV2O8aws+yqbdaG08e5o1UauKrcITfmY7kYIzdIvo0jpv2ZJR2vdv3xcHMCNMGpuP26ofY+ZRMYAmr73Tn1wr3gVNTpeebCpgnKLEpOB26hvlsXBkY75oCZX0MTbIhtRpq++IbELPyj1pzLW0adiHxejLOEWbO5IT3gDBgOqO1aUAFJnjaYLq2YSoXZSycUP0MtxjKxc9As15H8iuI6l7QuQRSc4ElzGooLO5yQCU7N8//iDOusGT/p5NpQ12K+Nmu2AYYNWQePPaoDxDAyHlzMOglncUTFqzLz59BzQJJD00YFq6YX4niK+YaRg/YidmdFg3DqJThFUhmZ2SdBI32zjvLBTShEpq3vtK38S9SVizkiCffCogUZYKtNPBn5wXchUJwHJ+92xBxZVvWwhoZ7S4jpMo9RlVwj8y6u5PBfS/geJP5Bty1CS2iTxz6TzNiaIY7uwpkoca2WBC58+ZytgdSZnmiEpyPnk9+IrowW1pfNRyoNOHecSG99w7NWnnq9UT0j2XIQv+VvYDx1KNQzSb5SccsOHK9bvTdTeMzD6eLyMFO4K7w9iWWeGsmUIJDrvaiSby7xElS06iEJbQc1biO3JwebdKo1SOOur6YD9nKgSZchTtvhhtkp/IOMuyK4pZ3j0erxEzpJJma0xCfyvDKBvAs6FbYoojjrePUXCN+ctZ4iprIjLChPD0AMw7E/zuJ/SWmLJfrxTxQOM+zROcs4Lxjtz25l5GYcCEVmRH7UNPBgef++Vy+GBTIh2OKcTuUWNfWVgsSDytGJJnkUHCxBbPp1+vT8f7KUnOGDUSQIcpji2W6V9l88flcZer4v5gJ6ttj5nzt3UkQURU/Kh0Cn0BALPoaL9k2plQV+bphnhXu0pKyHrI+PA/oseD7demibCPWsDu93sCser 6i1rM08C 5I1I1B2cnQ4qzADkynL7TERdWXJAuAzLJUcns72G86gPL86FN2T6VDqYFUK1HZQh3nh+U9Ndb4Amv9Y/TJKh8LYugNRyu91OI66LMnTJcoRT8w5QCitjASIo0Kg2DFlJWgIGait21VuwUA6//2V3P2kkXsDMg9xplOmIy3udaVttmtTUBlknTii1Abz/g6Y6L6EmdGj2ymfpycrimdf2ggQUej1d2C9UUBKsykneKDjqcgfk4R0kjCT/JXLLRdSIWxoc1MsSl2ezTW01SHGkfFl4pcSLYrxwZqVx721lh4D3zR1I= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon Sep 2, 2024 at 6:00 AM EEST, Shuai Xue wrote: > Synchronous error was detected as a result of user-space process accessin= g > a 2-bit uncorrected error. The CPU will take a synchronous error exceptio= n > such as Synchronous External Abort (SEA) on Arm64. The kernel will queue = a > memory_failure() work which poisons the related page, unmaps the page, an= d > then sends a SIGBUS to the process, so that a system wide panic can be > avoided. > > However, no memory_failure() work will be queued unless all bellow > preconditions check passed: > > - `if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))` in ghes_handle_m= emory_failure() > - `if (flags =3D=3D -1)` in ghes_handle_memory_failure() > - `if (!IS_ENABLED(CONFIG_ACPI_APEI_MEMORY_FAILURE))` in ghes_do_memory_f= ailure() > - `if (!pfn_valid(pfn) && !arch_is_platform_page(physical_addr)) ` in ghe= s_do_memory_failure() > > In such case, the user-space process will trigger SEA again. This loop > can potentially exceed the platform firmware threshold or even trigger a > kernel hard lockup, leading to a system reboot. > > Fix it by performing a force kill if no memory_failure() work is queued > for synchronous errors. > > Suggested-by: Xiaofei Tan > Signed-off-by: Shuai Xue > > --- > drivers/acpi/apei/ghes.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c > index 623cc0cb4a65..b0b20ee533d9 100644 > --- a/drivers/acpi/apei/ghes.c > +++ b/drivers/acpi/apei/ghes.c > @@ -801,6 +801,16 @@ static bool ghes_do_proc(struct ghes *ghes, > } > } > =20 > + /* > + * If no memory failure work is queued for abnormal synchronous > + * errors, do a force kill. > + */ > + if (sync && !queued) { > + pr_err("Sending SIGBUS to %s:%d due to hardware memory corruption\n", > + current->comm, task_pid_nr(current)); Hmm... doest this need "hardware" or would "memory corruption" be enough? Also, does this need to say that it is sending SIGBUS when the signal itself tells that already? I.e. could "%s:%d has memory corruption" be enough information? > + force_sig(SIGBUS); > + } > + > return queued; > } > =20 BR, Jarkko