From patchwork Mon Oct 28 08:11:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13853142 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 932A2D13588 for ; Mon, 28 Oct 2024 08:12:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF0AF6B0088; Mon, 28 Oct 2024 04:12:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C65316B0093; Mon, 28 Oct 2024 04:12:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 957F76B008C; Mon, 28 Oct 2024 04:12:02 -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 652D96B0088 for ; Mon, 28 Oct 2024 04:12:02 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7EA511A040D for ; Mon, 28 Oct 2024 08:11:21 +0000 (UTC) X-FDA: 82722291708.13.F5CDE86 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf11.hostedemail.com (Postfix) with ESMTP id B85554000D for ; Mon, 28 Oct 2024 08:11:31 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=nNEQ3Eqq; spf=pass (imf11.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730102910; 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:dkim-signature; bh=8brKTW7uO02ZOn/x4lpZT/JYszcIfoEiVfeoh4hX2X0=; b=Zchcd4s8sGlR63eUgpTINLakUmZ/7yvAjNOKjKOCd6VNmW7LO18LjavZDh57cuGHoUe0Og fMeqCOWg96RSkUwMr1KfAfFq8/uyc991C+/suqbkq35F4TmzLrkUctrlTV3o130+FZxi19 XTisMh+kRbWLfNyWNf9J8Bfw90AldHY= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=nNEQ3Eqq; spf=pass (imf11.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730102910; a=rsa-sha256; cv=none; b=uvEIFYOwH7zh1dpOF/+auPW59k/JMi6JJb3gH+DtX8GSfLpF4SoS7QAbkxrztj2a+xXc9g hedH3hJWbiuajRzn159xy2I3q1j0RPTE4RAs4p6uYh1aUKbQ1wtGb+s+YlgZof3lkMiLKq KefYTNoS0i3yqBp30pfydEW6wyk7jhA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1730103117; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=8brKTW7uO02ZOn/x4lpZT/JYszcIfoEiVfeoh4hX2X0=; b=nNEQ3Eqq2X9g0SdSlinj3OWZlNZ7fj/YQuVMxh3j8R0X5GZVHEt1Y4qiDLbabDuTw9vveMaqtNs1ZXjdaJqRGGfBvxtn1AGy0AHSyzk18ztT4W4ty7cBpVZiZ1kAn1UTzA5tJsvGxSsFbG3NClhRHiER3nnKXP4cpl6Iq36Rm8c= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WI0hO4H_1730103114 cluster:ay36) by smtp.aliyun-inc.com; Mon, 28 Oct 2024 16:11:55 +0800 From: Shuai Xue To: mark.rutland@arm.com, catalin.marinas@arm.com, mingo@redhat.com, robin.murphy@arm.com, Jonathan.Cameron@Huawei.com, 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, tongtiangen@huawei.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, 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, 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 v15 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 28 Oct 2024 16:11:40 +0800 Message-ID: <20241028081142.66028-2-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 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: rspam06 X-Rspamd-Queue-Id: B85554000D X-Stat-Signature: 4ief3u94cw7aw6cr9jcyt8wxta5m1rxx X-Rspam-User: X-HE-Tag: 1730103091-162245 X-HE-Meta: U2FsdGVkX1+AOjpSC4Uy3EfZ99W6r0TKwr8WnYdnmdp6fDDKVs7nut1klfdrgHSKi9DCf2/yleHrdRgZfrVFY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kE03ELfFcr4i0MdBB7nPIYd0D/lY9TV9K4vIo3UhhyCzjZHtKaGhz3mmSDZVSDUNwUVtnXvmfNDYm2QbhfGHoD/jKlVtRdvs0g== 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 Reviewed-by: Jarkko Sakkinen Reviewed-by: Jonathan Cameron --- 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 ada93cfde9ba..f2ee28c44d7a 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, } } + /* + * If no memory failure work is queued for abnormal synchronous + * errors, do a force kill. + */ + if (sync && !queued) { + pr_err("%s:%d: hardware memory corruption (SIGBUS)\n", + current->comm, task_pid_nr(current)); + force_sig(SIGBUS); + } + return queued; }