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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 173AFC433E0 for ; Thu, 21 Jan 2021 10:03:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8A295238EE for ; Thu, 21 Jan 2021 10:03:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A295238EE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CCA6A6B0005; Thu, 21 Jan 2021 05:03:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7C136B0007; Thu, 21 Jan 2021 05:03:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6A976B0008; Thu, 21 Jan 2021 05:03:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id 9E5FC6B0005 for ; Thu, 21 Jan 2021 05:03:14 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 66EB1181AEF39 for ; Thu, 21 Jan 2021 10:03:14 +0000 (UTC) X-FDA: 77729344308.30.soap94_460f4a027562 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 3F9B9180B3AB8 for ; Thu, 21 Jan 2021 10:03:14 +0000 (UTC) X-HE-Tag: soap94_460f4a027562 X-Filterd-Recvd-Size: 3221 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Thu, 21 Jan 2021 10:03:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7B71AAB7A; Thu, 21 Jan 2021 10:03:12 +0000 (UTC) Date: Thu, 21 Jan 2021 11:03:05 +0100 From: Oscar Salvador To: Aili Yao Cc: naoya.horiguchi@nec.com, linux-mm@kvack.org, YANGFENG1@kingsoft.com Subject: Re: [PATCH v5] mm,hwpoison: send SIGBUS to PF_MCE_EARLY processes on action required events Message-ID: <20210121100257.GA11685@linux> References: <20210120162422.0ed3dd56.yaoaili@kingsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210120162422.0ed3dd56.yaoaili@kingsoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 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. > + 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" > @@ -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; -- Oscar Salvador SUSE L3