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 X-Spam-Level: X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECC67C433DB for ; Fri, 22 Jan 2021 05:14:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4AC8F23122 for ; Fri, 22 Jan 2021 05:13:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AC8F23122 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kingsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 76EA46B0006; Fri, 22 Jan 2021 00:13:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 71F536B0007; Fri, 22 Jan 2021 00:13:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 635376B0008; Fri, 22 Jan 2021 00:13:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 4A2916B0006 for ; Fri, 22 Jan 2021 00:13:56 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 14263181AF5D8 for ; Fri, 22 Jan 2021 05:13:56 +0000 (UTC) X-FDA: 77732244072.09.slave01_3915ba727569 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id F1CD2180AD82F for ; Fri, 22 Jan 2021 05:13:55 +0000 (UTC) X-HE-Tag: slave01_3915ba727569 X-Filterd-Recvd-Size: 5190 Received: from mail.kingsoft.com (unknown [114.255.44.146]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 05:13:51 +0000 (UTC) X-AuditID: 0a580157-f21ff7000005df43-47-600a59b1ca6f Received: from mail.kingsoft.com (localhost [10.88.1.32]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.kingsoft.com (SMG-1-NODE-87) with SMTP id 2F.72.57155.1B95A006; Fri, 22 Jan 2021 12:50:57 +0800 (HKT) Received: from aili-OptiPlex-7020 (172.16.253.254) by KSBJMAIL2.kingsoft.cn (10.88.1.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Fri, 22 Jan 2021 13:13:42 +0800 Date: Fri, 22 Jan 2021 13:13:41 +0800 From: Aili Yao To: Oscar Salvador CC: , , Subject: Re: [PATCH v5] mm,hwpoison: send SIGBUS to PF_MCE_EARLY processes on action required events Message-ID: <20210122131341.6b1579f4.yaoaili@kingsoft.com> In-Reply-To: <20210121100257.GA11685@linux> References: <20210120162422.0ed3dd56.yaoaili@kingsoft.com> <20210121100257.GA11685@linux> Organization: Kingsoft X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.253.254] X-ClientProxiedBy: KSBJMAIL1.kingsoft.cn (10.88.1.31) To KSBJMAIL2.kingsoft.cn (10.88.1.32) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrILMWRmVeSWpSXmKPExsXCFcGooLsxkivB4O5kdot7a/6zWlxsPMBo cWZakQOzx6ZPk9g9XlzdyOKx+XR1AHMUl01Kak5mWWqRvl0CV8a6tpCCIyIVm+83sTQwvuDv YuTkkBAwkVj+YA17FyMXh5DAdCaJvzv2sUA4Lxglznb8ZQapYhFQlfjx9wIbiM0GZO+6N4sV xBYRUJOY9qqRHcRmFvCVmP3zPVi9sECaxOSls8DivAJWEkc2vgSLcwpoS+w7/BasV0ggWqJ5 7TOgZRwc/AJiEq8ajCEOspd4/vcsM0SroMTJmU9YIMbrSJxYdYwZwpaX2P52DjPEGEWJw0t+ sUP0Kkkc6Z7BBmHHSiyb94p1AqPwLCSjZiEZNQvJqAWMzKsYWYpz0w03MUJCOXwH47ymj3qH GJk4GA8xSnAwK4nwPrLkSBDiTUmsrEotyo8vKs1JLT7EKM3BoiTOq+/MliAkkJ5YkpqdmlqQ WgSTZeLglGpgEnaKXxLFuthGzbrlhPS9yEMHDOffNIk9frRqaW/fYW57H91axsy76+2vJc2d xOH6+7by3NUCUxwTbxbNd5zIb25itTCeV/tujkGa59TaNe815CWSdSwnVC2q3VRfyBejc9h1 9bqkTq3Am1c/LN7wVzp46z8mJ/vkLc+9vE14Nmk+Tdc+Ibk58VIFZ62wVFpD2Qvj0ofX3k9q vrhoZ9It45Zg/gfzmp4mzdhnJDFl2+UDXhKauy9+6c5cWzLXrlhqZvFbZ3ZZX+8Ts3xmijkr PWITEgjYVNO1QcH//duE7lWz498b97R66TS73uNevaF4+7If7gZ71uVNDEry0Nx6+KRIUusc kycK73KSci4osRRnJBpqMRcVJwIACtXXPdQCAAA= 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: On Thu, 21 Jan 2021 11:03:05 +0100 Oscar Salvador wrote: > On Wed, Jan 20, 2021 at 04:24:22PM +0800, Aili Yao wrote: > > When a memory uncorrected error is triggered by process who accessed > > the address with error, It's Action Required Case for only current > > process which triggered this; This Action Required case means Action > > optional to other process who share the same page. Usually killing > > current process will be sufficient, other processes sharing the same > > page will get be signaled when they really touch the poisoned page. > > > > But there is another scenario that other processes > > sharing the same page want to be signaled early with PF_MCE_EARLY set, > > In this case, we should get them into kill list and signal > > BUS_MCEERR_AO to them. > > > > So in this patch, task_early_kill will check current process if > > force_early is set, and if not current,the code will fallback to > > find_early_kill_thread() to check if there is PF_MCE_EARLY process > > who cares the error. > > > > In kill_proc(), BUS_MCEERR_AR is only send to current, other processes in > > kill list will be signaled with BUS_MCEERR_AO. > > > > Acked-by: Naoya Horiguchi > > Signed-off-by: Aili Yao > > Looks good to me, a few nits below. > > Reviewed-by: Oscar Salvador > > > > @@ -243,9 +243,12 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags) > > pfn, t->comm, t->pid); > > > > if (flags & MF_ACTION_REQUIRED) { > > - WARN_ON_ONCE(t != current); > > - ret = force_sig_mceerr(BUS_MCEERR_AR, > > + if (tk->tsk == current) > You can re-use "t" here. yeah, this look better, I will change to that. Thanks! > > > + ret = force_sig_mceerr(BUS_MCEERR_AR, > > (void __user *)tk->addr, addr_lsb); > > + else > > + ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr, > > + addr_lsb, t); > > I would place a brief comment above explaining why we are sending BUS_MCEER_AO > to non-current tasks. > E.g: "Signal other processes sharing the page if they have PF_MCE_EARLY set" Yes, it's good to have > > > @@ -457,8 +463,6 @@ static struct task_struct *task_early_kill(struct task_struct *tsk, > > */ > > if (tsk->mm == current->mm) > > return current; > > - else > > - return NULL; > > if (force_early && task->mm == current->mm) > return current; > > This looks more cleaner. I will modify above in a v6 patch! Thanks, -- Best Regards! Aili Yao