From patchwork Tue Jan 7 08:17:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13928412 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 789B1E77198 for ; Tue, 7 Jan 2025 08:17:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCC156B00A4; Tue, 7 Jan 2025 03:17:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D53FB6B00AC; Tue, 7 Jan 2025 03:17:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B80FB6B00C4; Tue, 7 Jan 2025 03:17:48 -0500 (EST) 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 5D62C6B00A4 for ; Tue, 7 Jan 2025 03:17:48 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 13E1A1C6A93 for ; Tue, 7 Jan 2025 08:17:48 +0000 (UTC) X-FDA: 82979952216.16.E15E072 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf10.hostedemail.com (Postfix) with ESMTP id 10C5EC0010 for ; Tue, 7 Jan 2025 08:17:45 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=MhaBbna1; spf=pass (imf10.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=1736237866; 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=FVLlDvOc/WmPvf7983kR+UwF2h9MmqIpndaukwqMXSs=; b=Ywhx3+GDIHSs9gqoPBIDxQapyVKv94q+j/BRJ+jdp53yrp6ZXCcA/5gbCawTyYQV5jPpZV +kZnrsgqkVKpp4yrRw3pxLQ0An2qQjaf/55Bm7tPcCnQB6JtFhOkZ0FAlUxXsTB+RrwjWZ D9dBWaPnC2QnvXzlFRy3Qf3MHHrhqhw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736237866; a=rsa-sha256; cv=none; b=2s6T8mr+o5CvbAkgaUolCsTUkoC3odaZt5cTpXdu95DwcABy2K60JewowFutJkR0QVbJFS YnchBam/HVSz9a/n9m8qHfTUBOBrUiPkSDmaA96WEpV5N6QVypYtJBPWrSElHrtpJ8yIvd PKkKyUVBfDM3KW7GKgUomfIupvb4Olc= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=MhaBbna1; spf=pass (imf10.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1736237863; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=FVLlDvOc/WmPvf7983kR+UwF2h9MmqIpndaukwqMXSs=; b=MhaBbna1yMTgDZEU6gFUkB9GKL8NMlzEqTEaCWjO0/bUL+Kz34zVHZUqYEn9lrpwhTOu/wv/rdXcEtbxJKUmnxDz3rE137M37pv5xhU1U2B30tJVeOEwnHRUxBclpImhBslTNqGwxZVnyj6JMvoe168TE2lOKmhI8Eohq4HDK4Y= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WNA-B3T_1736237859 cluster:ay36) by smtp.aliyun-inc.com; Tue, 07 Jan 2025 16:17:41 +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@linux.alibaba.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 v18 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Date: Tue, 7 Jan 2025 16:17:33 +0800 Message-ID: <20250107081735.16159-2-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250107081735.16159-1-xueshuai@linux.alibaba.com> References: <20250107081735.16159-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 10C5EC0010 X-Stat-Signature: jxi7m3im87h7ip8km1znw79qyb3aws1n X-Rspam-User: X-HE-Tag: 1736237865-12499 X-HE-Meta: U2FsdGVkX18EzcVybfpwqba6/edwKAjcw4zg0bkj7ASfODEui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BngtrAoOp4WXR8ACR4fbkirQbeWqJpAHqB4K+Cx7eXtsZLUMaMBN5jjdVxnf3CMJ6ETnO3DQMb+S0VlUkR9oPdA1o5Qbz8hLiIe1R//XlsbfH9AkkatHN0OucPIXvMk/f3Zo7dVZMTI9sBLoX4V97qpk7TCmr/fO1tzmUwHD9yHhAngGZwZr3csIp 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 07789f0b59bc..0e643e26c8ad 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; }