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 A76D9E68945 for ; Thu, 31 Oct 2024 01:37:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B04B6B0093; Wed, 30 Oct 2024 21:37:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 038CC6B0095; Wed, 30 Oct 2024 21:37:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DCD716B0096; Wed, 30 Oct 2024 21:37:10 -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 BAFC26B0093 for ; Wed, 30 Oct 2024 21:37:10 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3B02B1A122A for ; Thu, 31 Oct 2024 01:37:10 +0000 (UTC) X-FDA: 82732183044.08.A1904A0 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf08.hostedemail.com (Postfix) with ESMTP id CC477160012 for ; Thu, 31 Oct 2024 01:36:49 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=kOAMTMWR; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf08.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730338510; a=rsa-sha256; cv=none; b=2Bop0X21uO1faonEZFyq21rggHS5m36PrOOhcv/APXBXYL3qlkBCme9Z/269jB0XM+VnJV z00V9A8KctAJzJKFiQlAV2AH7t5r+lseHPyJBpCh9o1/3umYhFLhwLl9BkogZkeTxG/n1L EV/Tjxue+W2u9sJV384egnKf0/GzFlI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=kOAMTMWR; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf08.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.99 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=1730338510; 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=ZwUq071psuIhKucSfF2WgOJ4JR/ocIDnq9dWFuR/ybI=; b=Q44DUfGzYDjcmzfAZFQac+vGG5Usew1wLiUJEQxdzC8GwyjDt7VoiIPwbkbsG1OBIN0uiN mbBgrWBr8HoO1p970B/Z5hW+rxx74YPAkS8sEQcqbGcMDD/NkDDcHli245sZTZIj5CH9PH rLKDvF1enQHpFsjmuT9CyeEl96+JRss= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1730338624; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=ZwUq071psuIhKucSfF2WgOJ4JR/ocIDnq9dWFuR/ybI=; b=kOAMTMWRCU1vpoeHvxLJW8MujHzxBgBVg2M/BupAYkMSqv2rEP2/zl/mp2bVpzX0be+q20VTO0ZlMig5GPcFGrPuV9+uADhiz7CWp2ktlEvifXLGGKlCFG8kPzFKQXPI//gUk6Za6K7FRzGJ2vC6MrFYsk/7nGB0/x3eWmgr7Vs= Received: from 30.246.162.170(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WIGN02O_1730338618 cluster:ay36) by smtp.aliyun-inc.com; Thu, 31 Oct 2024 09:37:02 +0800 Message-ID: <6979b369-7aeb-4157-a89e-3fc4b7f39333@linux.alibaba.com> Date: Thu, 31 Oct 2024 09:36:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v15 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered To: Yazen Ghannam Cc: 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, 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, 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 References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> <20241028081142.66028-2-xueshuai@linux.alibaba.com> <20241029204848.GA1229628@yaz-khff2.amd.com> <20241030140800.GA1288714@yaz-khff2.amd.com> From: Shuai Xue In-Reply-To: <20241030140800.GA1288714@yaz-khff2.amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CC477160012 X-Stat-Signature: w31p6qy9xco4jswihh1t796nftr17h99 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1730338609-640965 X-HE-Meta: U2FsdGVkX1+u/mh0cfJeeT7DfIPeB+9TkZZn19IJ4skNp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uyeiQQFqhAlOxY5oSXGxh02n41Jb76vYDG1rW1PaVRqKe3gYXK8y3SI+cTMpMHnMrYBfKd0drbXb5LnotQrVdk5eTzO7Ec0eG9Oo01gcHDAaCFcXYU6a/8nZoQnU3tcVxehOgkMg7Q20O7nXilGxLeraLz2GP9nTIqiKe9ISWhYVp6PM7XaFbW493UhgEnhbBXHx1FUhw+u+qkVmm3y 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: 在 2024/10/30 22:08, Yazen Ghannam 写道: > On Wed, Oct 30, 2024 at 09:54:00AM +0800, Shuai Xue wrote: >> >> >> 在 2024/10/30 04:48, Yazen Ghannam 写道: >>> On Mon, Oct 28, 2024 at 04:11:40PM +0800, Shuai Xue wrote: >>>> 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)); >>> >>> I think it would help to include the GHES_PFX to indicate where this >>> message is coming from. The pr_fmt() macro could also be introduced >>> instead. >> >> Yes, GHES_PFX is a effective prefix and will be consistent to other message >> in GHES driver. Will add it in next version. >> >> What do you mean about pr_fmt()? > > This can be used to set a prefix for an entire section of code. The > pr_*() macros will pick it up without needing to include a prefix for > each call. > > This is described in "Documentation/core-api/printk-basics.rst". Got you point, a pr_fmt is much more convenient, but it is beyond this patch. I would like to send a patch to add pr_fmt and then replace each call after this patch merged. > >> >>> >>> Also, you may want to include the HW_ERR prefix. Not all kernel messages >>> related to hardware errors have this prefix today. But maybe that should >>> be changed so there is more consistent messaging. >>> >> >> Do we really need a HW_ERR prefix? The other case which use HW_ERR prefix >> are for hardware registers. The messages which send SIGBUS does >> not include HW_ERR, e.g. in kill_proc(), kill_procs(). >> >> pr_err("%#lx: Sending SIGBUS to %s:%d due to hardware memory >> corruption\n",... >> pr_err("%#lx: forcibly killing %s:%d because of failure to unmap >> corrupted page\n",... >> >> > > Correct, HW_ERR isn't used there. My interpretation is that it can be > used whenever an event is due to a hardware error (real or simulated). > This is a very clear message to a user. > > It may be redundant in some cases (like here where the message already > says "hardware memory corruption"). But I think it would be go to use it > anyway for consistency. > > I think other relevant places in the kernel should also be updated. But > that is beyond this patch, and I don't expect it to be done here and > now. Ok, I will add the HW_ERR in next version, if no one else objects. > > Thanks, > Yazen Thank you. Best Regards, Shuai