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 366EDCD5BC7 for ; Thu, 5 Sep 2024 14:15:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 947296B0106; Thu, 5 Sep 2024 10:15:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F7C96B0109; Thu, 5 Sep 2024 10:15:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BEC96B010C; Thu, 5 Sep 2024 10:15:02 -0400 (EDT) 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 5CE836B0106 for ; Thu, 5 Sep 2024 10:15:02 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 00E6C40409 for ; Thu, 5 Sep 2024 14:15:01 +0000 (UTC) X-FDA: 82530881244.17.877F548 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf25.hostedemail.com (Postfix) with ESMTP id 2A8A8A0015 for ; Thu, 5 Sep 2024 14:14:59 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R360bgrM; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.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=1725545621; a=rsa-sha256; cv=none; b=beFg5jws7vrNGDLORPWmxR7OM2kIWK0d4ACpt7vZ/Hv2Yd8LSuxvZoqaGQh0zR7ww9/h59 LB0O4k/EgmYnTWK+STgKx0A7547p10ffDkEXY54rMfVzkl8h01HHLQelBNORQzYvhNoqpJ YjZ8QkqVehpJbQBuq2ERuBcXuWDDgb8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=R360bgrM; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf25.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=1725545621; 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=tmXm6IsaUUzfWBo2epr6RdnQePLEDW30LBZShYCAP6Y=; b=G/TKGL9pDgj7sKNrlQ5ralIupgMVyqf9/IzYX/r2u+FG5PuusqwyXOZNI86U0+MwzE7Gb6 9VxVBN35vEq3VVYnj5wIM+jEYzR0FHdp82TQolVkkAB4cJ7mVl+wNUv0XFvxCMMleN5SZp p0a5JRutAmx8pvICQ7Ffy+izIeSoAHs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8F1435C5CD1; Thu, 5 Sep 2024 14:14:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30C8EC4CEC5; Thu, 5 Sep 2024 14:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725545698; bh=EsBw3yPNu0bH1zfvQrN4wz32OLkncS3WVmWwvRCuNwM=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=R360bgrMAiS3CivOOjXyUdgY5mo2H3g7KkCXk1zaPYonwTIA037emLJBTORDXoNqW rdDZsAFSOeQ+TrCWcsfJvPZoVhMhP53ytT83TXufLoFiTy2YfH0jPAUuU2iUjZbdQm 8jb1lOoaa0FXqu+xjElA9pQllZXxwgETe/9oAn6zJykfdYBX3OflfzeiBOYBh/VEnf bznsvlEMus1xyVUIJjnnTLKF3wNAKTNGFtHetuzxHPQHAXtvDAlKF0WUy+5BZMZMpR HJbOL7ode/W3dVX2CmB3u6A7oukctwEX+1YOXb3KrqVEOxahoaUYYO67+rnPr2DfbY 6GdTx2d90tRqw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 05 Sep 2024 17:14:54 +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: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2A8A8A0015 X-Stat-Signature: s555syo9gksak5kgr83pjiy8z6upui7x X-Rspam-User: X-HE-Tag: 1725545699-450668 X-HE-Meta: U2FsdGVkX19hmnjRZY3gCbutVO3VtH38/UJgWMDrMTswfEirg/Z9GdCRkaqp2jbiP8VsS92EvfJ2HrOeYK3vDUD79ojZXR3aRLS7UUSqCoY2Uw2hG+mbfFNRJ9sfjOJfXfj6dpf84t2mKwRSq1DxkFcYWR59+otxwLGp4Ig/1sz6PoG+DCFUMKxWM+WzUhzqV0Jf9jEpu5NPQ7y9cEUEGKxDgBxStuAsupu3lXkQSjUyEw4cndknAOhR3+yLhDAOFTgNdvqD2GxS5FqCOBvA5Xv9KHh9FbPLE1RFHOJg+txKYre0HbTH29C7oLN/2XFoQEcW5pJWhEKNyNFK3Bm169SFa49bK2gpPzd9kaVHOzMBXU50rc056OsTiFVS4IS9YnMSlJJX3Q7G921G/yvIVdr6xRXBe95bnSVnjYWnO5AqNuqt7ZpIg/upQntVMeV5I/C66kKOEGjZrB7GMaO54uagXtpBogFlAlkyMo0S4GV2zJTe5OqkJ/52NDBu1gcYIapDy5l6l+ZwsPujdIVDs2YStJyRneKkr1YgNRmT9jLsbxXjiWt1qiQrjJitqSHaYzZFt05OxIXzoo6Q1n535ZOt9UjstB5XMLSCgJ62d3jPkD2NMG5ISlIWOS0oByXjcYLTb7NLTtv/jHR2Aus5iq4biU2ZgPLmUxB09pG3DRUpGML3Ylo0WJaY2Oz/ScJ0PWb26xkZvQ8h8OFkq/08peKYvMMtBNdjJKU7CK/FAoE7Cj9t+gtEaE//l4tshAPGBqAx728thkqdHPgZyBOTeHGGgxbA4BGenN/baS6GgTffrFBdfcSO2BnyrkfMZhPyyVmARbaP61d6sLjOKMJUfyRzV+RU3OK7/40wJQLw9z5jDZDO5OJlJi9YDhAVa5DLneFSefq9QkH8gJhg81wzA+61FViBzKADq4DCJMJIfGo8Yl58dkGK/lrU0DBYMLhgeTF9q/snxJkgzhjZpft 4hTTPb0X RZ6yVxfhGFVXnNUC8vb728YkvyM3pYtgqNcJYvWmRDFGlV5J4ooYrp0MwkFCinyKA3Uh4WzDGONhJFIIF+mYi0z7NXm4FNRtB5f8YH/pBjqDJpMGXNHmVkNCwxe9MWpyGLB/+Mu8IeOqs+vJ02fG9CYeTb8/SGMOeIHsCFkG2tXS9n/tfpQxnPOtLHfRypXG/Tr6MXKOzLKJwRm6UxrIEZpgzb2+tn+OQn2uLSrszvQhC0uVbk8eHjQdRwTjZ0YUIck1Fz6X6bt7PzWthV/INLkyym21mSuy+qMagrb8H2GOqnPg= 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 Thu Sep 5, 2024 at 6:04 AM EEST, Shuai Xue wrote: > > > =E5=9C=A8 2024/9/4 00:09, Jarkko Sakkinen =E5=86=99=E9=81=93: > > On Mon Sep 2, 2024 at 6:00 AM EEST, Shuai Xue wrote: > >> Synchronous error was detected as a result of user-space process acces= sing > >> a 2-bit uncorrected error. The CPU will take a synchronous error excep= tion > >> such as Synchronous External Abort (SEA) on Arm64. The kernel will que= ue 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 unless all bellow > >> preconditions check passed: > >> > >> - `if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))` in ghes_handl= e_memory_failure() > >> - `if (flags =3D=3D -1)` in ghes_handle_memory_failure() > >> - `if (!IS_ENABLED(CONFIG_ACPI_APEI_MEMORY_FAILURE))` in ghes_do_memor= y_failure() > >> - `if (!pfn_valid(pfn) && !arch_is_platform_page(physical_addr)) ` in = ghes_do_memory_failure() > >> > >> In such case, the user-space process will trigger SEA again. This loo= p > >> 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 queue= d > >> 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)); > >=20 > > Hmm... doest this need "hardware" or would "memory corruption" be > > enough? > >=20 > > Also, does this need to say that it is sending SIGBUS when the signal > > itself tells that already? > >=20 > > I.e. could "%s:%d has memory corruption" be enough information? > > Hi, Jarkko, > > Thank you for your suggestion. Maybe it could. > > There are some similar error info which use "hardware memory error", e.g. By tweaking my original suggestion just a bit: "%s:%d: hardware memory corruption" Can't get clearer than that, right? BR, Jarkko