From patchwork Mon Dec 18 06:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13496263 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 724FEC35274 for ; Mon, 18 Dec 2023 06:45:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9ACDF8D0005; Mon, 18 Dec 2023 01:45:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 95C108D0001; Mon, 18 Dec 2023 01:45:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8719B8D0005; Mon, 18 Dec 2023 01:45:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 728948D0001 for ; Mon, 18 Dec 2023 01:45:39 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3EAEA1205F6 for ; Mon, 18 Dec 2023 06:45:39 +0000 (UTC) X-FDA: 81579003198.14.8D4CF7E Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by imf21.hostedemail.com (Postfix) with ESMTP id B106C1C0014 for ; Mon, 18 Dec 2023 06:45:35 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf21.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702881937; a=rsa-sha256; cv=none; b=6w9UMVef07F9EanhBVk2TrNktlszQ08oQfgS30Is1nXpQT+YzQBqQbqqfWUHu6Rgyv7+F+ h51vs6omPKys3qVhuZwQRERGDR9DwJQgf9GIocIgQ6UWFRrBiT9rxPWq7tE+FHAC+TG3z3 7j0oLyIWKhHll/FVQ7MMyVEoKbAOBug= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf21.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.131 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702881937; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/sRQfPLo2YFRl3757JNepg4wTl7qVsEe6Vc13KNsBKw=; b=hHLv7vklk8KmHXPZbQ/cyNLpahrFEc7LRShVdHRzHFgDv+T+3NWyRhfJtJJO2CLMZr5ClZ 64hJNG/rPNA/IUSykylwz9oXr3agX+mDzjju/oXFMN+jpaj0AvMERYebve63z9LEWT6wcQ 99/D9pxWSUX3poeL3UxFHLhXEe+6uEs= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R991e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046060;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=35;SR=0;TI=SMTPD_---0VygHb-B_1702881929; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VygHb-B_1702881929) by smtp.aliyun-inc.com; Mon, 18 Dec 2023 14:45:31 +0800 From: Shuai Xue To: bp@alien8.de, rafael@kernel.org, wangkefeng.wang@huawei.com, tanxiaofei@huawei.com, mawupeng1@huawei.com, tony.luck@intel.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com, james.morse@arm.com, gregkh@linuxfoundation.org, will@kernel.org, jarkko@kernel.org Cc: linux-acpi@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-edac@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, stable@vger.kernel.org, x86@kernel.org, xueshuai@linux.alibaba.com, justin.he@arm.com, ardb@kernel.org, ying.huang@intel.com, ashish.kalra@amd.com, baolin.wang@linux.alibaba.com, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, lenb@kernel.org, hpa@zytor.com, robert.moore@intel.com, lvying6@huawei.com, xiexiuqi@huawei.com, zhuo.song@linux.alibaba.com Subject: [PATCH v10 2/4] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 18 Dec 2023 14:45:19 +0800 Message-Id: <20231218064521.37324-3-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221027042445.60108-1-xueshuai@linux.alibaba.com> References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B106C1C0014 X-Stat-Signature: f9tj5rcq8gwcksemros9w1ossxrdnwwy X-Rspam-User: X-HE-Tag: 1702881935-46037 X-HE-Meta: U2FsdGVkX1+vGq/DO/2GidFVvESapkJMs9QQ+mcDhTnNadK3p7GI70fz84pozcRAjF7aDcyofuQypT8IXPfGwSEb/ul0jA5M6wu1c2++MitdeXWuf/xpn59RfGZUjMWguKP1y+o+/TFKA9pLcctebvbqjTtS+HEh+v8YqbvG54tKn7JXrvOpzEvle8/Dx/E4PR5e9e6KM9nkeH+eEIE5rwePxLWRnLw5hl9ctXAGWH01s73ZzIBUXHETvtWodX1f3kJBLSRx5ctkUF5WhV1MquPyrwCuxWZULGb75fb/wLKOdINXE4VOP9ltozSubuNhqKn0/XKgIY7qftu7MCssZlsb6gyKAli/e+jBvxN4oP8aCqe1cPh4UKN/eV3bPb46qeJuBmE2pNvqVkUFaIr2moBSIFN4nCDfZA9GddNuP7kseqH6fZC1ofZiTxEg1nH9c7cIGfFc9hM+taKW+xJsdnQFUE/t98PKORUcQ0vUl+EDjoFcp+QZgdbb2l2SrUGlNkcTOL1whYDnQrdmseEK8etjCMNEmS09asEDafWsCZt8d95jxZB8Ewh9Uzk07x4X0fjWLpS9SYHtUKY5ZGOHq8KDG2zlgml9CQvTiysJTgCBX6+i5N7NwvmrhwBv/sJOnqFwLkWS9uKHoZGRhUUo7i9eqpF7irfDdTiVe0vO5CfZ+tQkkiG52y0NYwxcdfjq81CWmXXzgKP7kAv5y12AqNW+HVyxrTut5PDzv0B18peJcz+0VdJzKb8b6Dqfp+Q7bIw9y42AhD2EvkOpEtmFn489Coley7n/uXGRPlab1+mxM6X90zGKw5k0J4PXAgaA1DsqaocALbhdeNc3O1TtFyss5240Q2lEmtY6VUq2IojjTIuNPdnyFtvNWtnMNez6UwUZxiAJzM9Mj4FFwMOkbLO4zPiZyMmyNw02mlmy598w+KwmXBzIxPk3U9z5l4AaYby6PBOTX2T4KmcKMQz RVuTtqtK 87hpB5nPKs2/0TIhY3UJt+LkLwhhDNGXTvM7cZQ/7efJyPOcSwUw8t9LKw8yj4D98xufy/Qofx/lZN4CYHh6aIietOQO2WG8baSH+7sp+u7XjOhfIexZfhax+RQ== 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: Synchronous error was detected as a result of user-space process accessing a 2-bit uncorrected error. The CPU will take a synchronous error exception such as Synchronous External Abort (SEA) on Arm64. The kernel will queue a memory_failure() work which poisons the related page, unmaps the page, and then sends a SIGBUS to the process, so that a system wide panic can be avoided. However, no memory_failure() work will be queued when abnormal synchronous errors occur. These errors can include situations such as invalid PA, unexpected severity, no memory failure config support, invalid GUID section, etc. 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. Signed-off-by: Shuai Xue --- drivers/acpi/apei/ghes.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ab2a82cb1b0b..f832ffc5a88d 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -717,6 +717,15 @@ static bool ghes_do_proc(struct ghes *ghes, } } + /* + * If no memory failure work is queued for abnormal synchronous + * errors, do a force kill. + */ + if (sync && !queued) { + pr_err("Sending SIGBUS to current task due to memory error not recovered"); + force_sig(SIGBUS); + } + return queued; }