Received: by 2002:a05:7412:b112:b0:f9:3106:f1c0 with SMTP id az18csp86094rdb; Sun, 17 Dec 2023 22:54:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWEKcFyHdPxe49gv3FRnQJ2RActl/nQhb4mP0PvuWKHmEcQr75wmFtMVh7Sdz1GBTy+UKh X-Received: by 2002:a50:f68f:0:b0:553:7407:5c13 with SMTP id d15-20020a50f68f000000b0055374075c13mr11436edn.66.1702882498767; Sun, 17 Dec 2023 22:54:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702882498; cv=none; d=google.com; s=arc-20160816; b=QLz7DhudKBJ9zNYxRek/4bdFLPHicGSHC80We5tsWtkPfNj3fFgFgFaFHQX2x5qb61 HKtXIk53ng+kkiXVMzbWn7vL6tkf+xbk4NS7auOQdwYixIpJPn20uyVB2XvxQKSiR1hP JdjrBKTTm7lY5UfKGO0Utn16aOnw3EdXzkzFD8S/gapLwqqw7Fn7LfjuFJpgSoW92imk GAgiAY3LsISjpBiWjmOYBOx28jKYz1P2AnSIZagixg+Py8xPiGt93dNqoNadm9oLDl7p wEz4QDAvikaNxNRDaecaAIjwRDP68cPykgM1p9sEhpcYC/Tso+2CRzHku/3t48KDkZL7 Z5xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9ksOGpeiRCLU29VRf86vnJKLk51JA4ZNWagXVPsA528=; fh=tg6IlgxB4zzEgcDs3My+TAoclDht2V20wP9Lk5qqw54=; b=Q2hom3hLQFx7iuRFhcYE3y2SgRjVhMov9DCRo5ZPCBNz0wtdaIC/MDRsu+11jsmj5n n8IhRjDdsM7fpf67lzMbVQmT4CajsD/f+9wYJlfI3VWFH/SEDed0F7CdIubMQ237YoW9 dIf019aSDdIsT2FMroRcLji8JoXLeJUMTI4/3nNq2B03L6Se1GWhmKGW5yEU+GLmjF0C yPVkF9vHehnKOzoYXxNw88/pxjYsPwLkHYJk1f/lqBdQbN5yFC/ebH/FiQiiduqGHWK6 CUkmzaTnzDjBCVuXGVCY6JUcs+802tfcOrxar9cfT59lCgrub0PcHRXxNdodtVkoAO5f iThg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="iyTclJ8/"; spf=pass (google.com: domain of linux-kernel+bounces-3070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dg4-20020a0564021d0400b005536b834438si140925edb.423.2023.12.17.22.54.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 22:54:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="iyTclJ8/"; spf=pass (google.com: domain of linux-kernel+bounces-3070-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 337E51F22D94 for ; Mon, 18 Dec 2023 06:54:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D57AB79FD; Mon, 18 Dec 2023 06:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iyTclJ8/" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFB62101C9; Mon, 18 Dec 2023 06:54:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04D47C433C7; Mon, 18 Dec 2023 06:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702882462; bh=WqSdOGaMwSBPoEtUznslg5s7PXAyzsMtO2SlEkxyWGY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iyTclJ8/wMW+zu7NPf5HxB+KPpilY4WTl38/pGkHfTLt355xwMgIZfyU7dIReIUB9 dCraaErrmnktGo/N4KrHf0CS0DGxi1/eP5nKRH7eu1y0DlGqJ5zZxRNe0WyMz10aw4 v4zHkvihss/8toJXCHaAJxfTfER2aI8wyDGUJs78= Date: Mon, 18 Dec 2023 07:54:20 +0100 From: Greg KH To: Shuai Xue Cc: 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, 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, acpica-devel@lists.linuxfoundation.org, stable@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 Subject: Re: [PATCH v10 4/4] ACPI: APEI: handle synchronous exceptions in task work Message-ID: <2023121813-monthly-matriarch-2df4@gregkh> References: <20221027042445.60108-1-xueshuai@linux.alibaba.com> <20231218064521.37324-5-xueshuai@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231218064521.37324-5-xueshuai@linux.alibaba.com> On Mon, Dec 18, 2023 at 02:45:21PM +0800, Shuai Xue wrote: > Hardware errors could be signaled by asynchronous interrupt, e.g. when an > error is detected by a background scrubber, or signaled by synchronous > exception, e.g. when a CPU tries to access a poisoned cache line. Both > synchronous and asynchronous error are queued as a memory_failure() work > and handled by a dedicated kthread in workqueue. > > However, the memory failure recovery sends SIBUS with wrong BUS_MCEERR_AO > si_code for synchronous errors in early kill mode, even MF_ACTION_REQUIRED > is set. The main problem is that the memory failure work is handled in > kthread context but not the user-space process which is accessing the > corrupt memory location, so it will send SIGBUS with BUS_MCEERR_AO si_code > to the user-space process instead of BUS_MCEERR_AR in kill_proc(). > > To this end, queue memory_failure() as a task_work so that the current > context in memory_failure() is exactly belongs to the process consuming > poison data and it will send SIBBUS with proper si_code. > > Signed-off-by: Shuai Xue > Tested-by: Ma Wupeng > Reviewed-by: Kefeng Wang > Reviewed-by: Xiaofei Tan > Reviewed-by: Baolin Wang > --- > drivers/acpi/apei/ghes.c | 77 +++++++++++++++++++++++----------------- > include/acpi/ghes.h | 3 -- > mm/memory-failure.c | 13 ------- > 3 files changed, 44 insertions(+), 49 deletions(-) > This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.