From patchwork Mon Dec 2 03:05:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13889890 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 9E13AD49797 for ; Mon, 2 Dec 2024 03:05:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9754B6B0089; Sun, 1 Dec 2024 22:05:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FD8F6B0083; Sun, 1 Dec 2024 22:05:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 776576B0089; Sun, 1 Dec 2024 22:05:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 53CAB6B0083 for ; Sun, 1 Dec 2024 22:05:49 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CD21381A27 for ; Mon, 2 Dec 2024 03:05:48 +0000 (UTC) X-FDA: 82848528840.10.4BE3E85 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf25.hostedemail.com (Postfix) with ESMTP id 644FDA000C for ; Mon, 2 Dec 2024 03:05:37 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=Bg38G7dm; spf=pass (imf25.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.118 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=1733108741; 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=pqr4qtbg8/QB4DLMtl/No6G4nDmaLNcyvKm7QGNmTRc=; b=O3UPu7Dugl5bRDipdWMmK2zw7mFF9Ix24PqaSJRPFlmkDjhP/BqW730aXUDdhVBsNf4E4c br4eLhLFNPtMJwOEhCEIg17YrU5nTJcBMttGd/jqBWQU7QwqanyDTGTnf0LyLlT21fr8Mb DwLaTQnYX6dMEZ16ze5R00E869hfWK4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=Bg38G7dm; spf=pass (imf25.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.118 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=1733108741; a=rsa-sha256; cv=none; b=u1auETn4Ac6n9EGgEcxYx0DAkJsGgTVcs0Y14IZCM0r4MrHZTipwzrfLz7RNEFHjW3eH/m 1NrrSAqEDYajMryAVZIAc7DHyjdUAzrbfcSA9Atpo8YH6vHezDy7fvZtd/QaLsFrDsmLrp kQQpB9Zaqs1/E9vOAU8Lo23P+mQw7/U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1733108743; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=pqr4qtbg8/QB4DLMtl/No6G4nDmaLNcyvKm7QGNmTRc=; b=Bg38G7dmPyoF2DxqyynOCvjjfLNFetoTqUJkBELQwW8W7lh2Twwgw/Qti/Dwq/YZ70tIM6H2QPXnC70d3Yv9aFkpgJSHZtjx3QG80mtb/L0mHQx5g/MZCS7lm2nLs396YGlBqBzrumXIOWTUNspcCZgihtRrVv6qDCnNHIbvLkg= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WKbh0WB_1733108739 cluster:ay36) by smtp.aliyun-inc.com; Mon, 02 Dec 2024 11:05:40 +0800 From: Shuai Xue To: yazen.ghannam@amd.com, 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, linux-arm-kernel@lists.infradead.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 v17 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Mon, 2 Dec 2024 11:05:25 +0800 Message-ID: <20241202030527.20586-2-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241202030527.20586-1-xueshuai@linux.alibaba.com> References: <20241202030527.20586-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 644FDA000C X-Stat-Signature: gyggu7nqpi19ryf1gdia5i9dps587qin X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1733108737-976445 X-HE-Meta: U2FsdGVkX19cUKEnoGuA7j1+BhtRwuJgBy12Cc8Qgckj08lgAGFop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N0xq8NlrI2TM3r4HDGX9rHsziLdgc28d51Ad8aWfpvLZpYlLxUWB8oKvNEot4UEDqhS95wC9cENIvyb+EtxmmQodbVFI6Qnh5B2aSByUhE/OX1NaTGiKG2JTqVP0ac8zjTlBjMCmlnYdAkEnpFS7pzj179fpP5OexqfQI= 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 Reviewed-by: Yazen Ghannam Reviewed-by: Jane Chu --- drivers/acpi/apei/ghes.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index a2491905f165..106486bdfefc 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -801,6 +801,17 @@ 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) { + dev_err(ghes->dev, + HW_ERR GHES_PFX "%s:%d: synchronous unrecoverable error (SIGBUS)\n", + current->comm, task_pid_nr(current)); + force_sig(SIGBUS); + } + return queued; }