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 DFF4DC5478C for ; Sat, 24 Feb 2024 06:08:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DAF4F6B006E; Sat, 24 Feb 2024 01:08:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D5DF26B0071; Sat, 24 Feb 2024 01:08:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C25CD6B0072; Sat, 24 Feb 2024 01:08:56 -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 AF8716B006E for ; Sat, 24 Feb 2024 01:08:56 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4C839401E4 for ; Sat, 24 Feb 2024 06:08:55 +0000 (UTC) X-FDA: 81825669030.18.7CABEC5 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by imf16.hostedemail.com (Postfix) with ESMTP id 00C6B180002 for ; Sat, 24 Feb 2024 06:08:50 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=FvWkBAki; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf16.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.119 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=1708754933; 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=mCwCZ2rNrkkFhS7Epeg6isWMlkKLV7R/5ALQmiiXG2Q=; b=ABlOaebG43slNa9FfEQsCXwsjiQUuYAynqqKpO6pZFxDn3lwyEGA1L954tgorQzkQq4AM5 +CwuEKXlyk+B8b8g1wkyqOl1sgOJ5ICNVcjkyPnAMwModMuTHFThQGbHw+yKHPyfxQGIzg x5I38LtEwKNQc8KB1Ttw4Id4PamnfB4= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=FvWkBAki; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf16.hostedemail.com: domain of xueshuai@linux.alibaba.com designates 115.124.30.119 as permitted sender) smtp.mailfrom=xueshuai@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708754933; a=rsa-sha256; cv=none; b=fp9RuJsojgjaX+RHWawZwjrdpV+WbIs8syaSmtbfDhbuIEUi8bDYPSS5DcwitASZHHy1Kg UWcECoeynYlf5D9ZJcSaw/QEUPnOI69wpWCxDnaegkfJQs3rGZqnFP2kc/rkHJcCoS3Ci4 XPd+6/k9Rqv2TauXmwIXAMGII7AzneI= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1708754927; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=mCwCZ2rNrkkFhS7Epeg6isWMlkKLV7R/5ALQmiiXG2Q=; b=FvWkBAkiQYlNPijAVD5MPDlHTYvF5klwHKHKyj2lOJp3/NhZ9+7+w2ki5ZmTecp4RNxW9gIXvlNipgk7tRxrha+C8xm/Z1HpFYXj44JqIaW7ZqEyi6y7th/dnQsN3H95AHt+rC+gqlzeK7KRkOMdZl2pRhE1xxK6xM9YNzsn9co= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R241e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=35;SR=0;TI=SMTPD_---0W15zPT3_1708754923; Received: from 30.240.112.52(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0W15zPT3_1708754923) by smtp.aliyun-inc.com; Sat, 24 Feb 2024 14:08:45 +0800 Message-ID: <00126cf9-bb59-4c05-8046-478d0d7f4297@linux.alibaba.com> Date: Sat, 24 Feb 2024 14:08:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 1/3] ACPI: APEI: send SIGBUS to current task if synchronous memory error not recovered Content-Language: en-US To: Jonathan Cameron , Dan Williams , Borislav Petkov Cc: Ira Weiny , "Luck, Tony" , "james.morse@arm.com" , rafael@kernel.org, wangkefeng.wang@huawei.com, tanxiaofei@huawei.com, mawupeng1@huawei.com, linmiaohe@huawei.com, naoya.horiguchi@nec.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, mingo@redhat.com, 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> <20240204080144.7977-2-xueshuai@linux.alibaba.com> <20240219092528.GTZdMeiDWIDz613VeT@fat_crate.local> <65d82c9352e78_24f3f294d5@dwillia2-mobl3.amr.corp.intel.com.notmuch> <20240223120813.00005d1f@Huawei.com> <20240223121701.00004bcf@Huawei.com> From: Shuai Xue In-Reply-To: <20240223121701.00004bcf@Huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 00C6B180002 X-Stat-Signature: zikrd5wmo78mkmeb1wknc86b69e4mbrm X-Rspam-User: X-HE-Tag: 1708754930-167908 X-HE-Meta: U2FsdGVkX1+EMbpwweS76IYTIYhRv9ksxC+ANz5fIh8pA1PBW5KQ6CW60bLjCIrr88NduNoRSuw8kgTWVL/MmA3gyTyZp72UFLJPE4tL5qQUSW0oSo5dXTt8DfVJczdBwLrsPryScNrWB6tNCqA4805qJQirurZ9EMd/+4ABvSZFKzBwm3G2U8UqMQ3+ABNNWs38vtRdAOCWxOylZtu6uJPcb5oQ1ecZ55Y+mTGk8iziX739dv/6oCRh6tpBuOZxZT7ZFo2xQnK3avx09kBRzbeWNWFk24NyLQPJYFpnnRSLozufhr+7wpNc8d/v026Sr4z07BTee99Hho4QCCjB+2ErB+e5oEihSwJB0CDLMX9jdzs6yFX30etEA8SBbGrmnwOQXV9SuSGw6ZE7qsSELQmQtK86EbCxpXKpmgm6Rwoz1y4QA1HnWNkH4hQuiToCdzNDHjShu47SqAtuNZoKXcKRDyi1X09nI1PEJHl/HWA3wMjkpUMB9pgd7uqBBXpVv+gFFFe1A0EzzJXyec+UFIkhnNygrC1fWtpTFn0vKosiJJ5y6u/VdJ+78Z6Yb1WrJYA1ZoUT4MCExsyKDbemqi63GMTyhv30z1a5H/cYcbxJ8UXsIfHqKjwPit/ptuisTae2d8RSuqOPwpI7BZxZSCbwhsd+Q2r5Ti53igf5OjylO+NtPezCCObffil3UTrGNvjzcmmtVOBW5mY0fJdDaoB/stN9CzgIRuj+Ba1+XylAOGmehXBh4rS+21ouV+uv2ks5/upv1VJ8u0CcJZ9XhOPodoWxJwz1ZjCEa8m1kTymyHHFU+1pjLdDqCREGgwcb6TnWt7AWdHE8iXLhXR/RucovgOYCEd2HreZ63+8bIgvrueZw++lr4UUoftdPZe0KbZ+8GHsKdv5Z3spXjMxde/Q7Flp6Ep4kfc9e1xCbbRks0BDNDhZsJnwd5ES+rXDa3PTBJnkkVQIpvlzjdL gYP7rlsU +eiBce0xbPFbBF5pbhs23s0KhGIGcWFyUJXJ93sX1XDwScsg8bQNl9T4bzh9PXPr6JLONl29nACKi1Kxros1XeAXI/jGaPZ8MWEtraK0Gy3s1xIMrdUTG+GNcsmKpGA99igB1ayAg3/we5SNH3+vZ/KgfAsL/DRAkGVwYN4WUfRqI7DR3UzZkVXNt4C0mr2Am6zuQnaNUY7MNY9z1C6VaDLxjP59607mus/chwylB1MB+edGQaO0RK7t/xHj+JdbWtCD70B6ktoxPhfwadlrWdmecFxwFOOUp5iokmACPQIjCQCyexrImcPeXHzFTfxHxx1Z43JDuwdHZzMCANnWqXBSy8IHhHc3PMn4cOQLhnnKTAovRYuNeUeaDoa5hYtT/5WXY9psUpXyNPB1TS+011mWXf/37RL8Klw6V7smOjJyi1AdiiJaXHofIYW8Fc95CnsER+vaAOu20A+M= 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 2024/2/23 20:17, Jonathan Cameron wrote: > On Fri, 23 Feb 2024 12:08:13 +0000 > Jonathan Cameron wrote: > >> On Thu, 22 Feb 2024 21:26:43 -0800 >> Dan Williams wrote: >> >>> Shuai Xue wrote: >>>> >>>> >>>> On 2024/2/19 17:25, Borislav Petkov wrote: >>>>> On Sun, Feb 04, 2024 at 04:01:42PM +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 >>>>>> --- >>>>>> drivers/acpi/apei/ghes.c | 9 +++++++++ >>>>>> 1 file changed, 9 insertions(+) >>>>>> >>>>>> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c >>>>>> index 7b7c605166e0..0892550732d4 100644 >>>>>> --- a/drivers/acpi/apei/ghes.c >>>>>> +++ b/drivers/acpi/apei/ghes.c >>>>>> @@ -806,6 +806,15 @@ 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("Sending SIGBUS to current task due to memory error not recovered"); >>>>>> + force_sig(SIGBUS); >>>>>> + } >>>>> >>>>> Except that there are a bunch of CXL GUIDs being handled there too and >>>>> this will sigbus those processes now automatically. >>>> >>>> Before the CXL GUIDs added, @Tony confirmed that the HEST notifications are always >>>> asynchronous on x86 platform, so only Synchronous External Abort (SEA) on ARM is >>>> delivered as a synchronous notification. >>>> >>>> Will the CXL component trigger synchronous events for which we need to terminate the >>>> current process by sending sigbus to process? >>> >>> None of the CXL component errors should be handled as synchronous >>> events. They are either asynchronous protocol errors, or effectively >>> equivalent to CPER_SEC_PLATFORM_MEM notifications. >> >> Not a good example, CPER_SEC_PLATFORM_MEM is sometimes signaled via SEA. >> > > Premature send.:( > > One example I can point at is how we do signaling of memory > errors detected by the host into a VM on arm64. > https://elixir.bootlin.com/qemu/latest/source/hw/acpi/ghes.c#L391 > CPER_SEC_PLATFORM_MEM via ARM Synchronous External Abort (SEA). > > Right now we've only used async in QEMU for proposed CXL error > CPER records signalling but your reference to them being similar > to CPER_SEC_PLATFORM_MEM is valid so 'maybe' they will be > synchronous in some physical systems as it's one viable way to > provide rich information for synchronous reception of poison. > For the VM case my assumption today is we don't care about providing the > VM with rich data, so CPER_SEC_PLATFORM_MEM is fine as a path for > errors whether from CXL CPER records or not. > > Jonathan Thank you for your confirmation and explanation. So I think the condition: - `sync` for synchronous event, - `!queued` for CPER_SEC_PLATFORM_MEM notifications which do not handle memory failures. is fine. @Borislav, do you have any other concerns? Best Regards, Shuai