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=-11.6 required=3.0 tests=BAYES_00, CHARSET_FARAWAY_HEADER,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,PDS_BAD_THREAD_QP_64,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 080EDC433DB for ; Wed, 20 Jan 2021 00:06:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7F1AB23104 for ; Wed, 20 Jan 2021 00:06:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F1AB23104 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=nec.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AAF416B0005; Tue, 19 Jan 2021 19:06:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A3A296B0006; Tue, 19 Jan 2021 19:06:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D89E6B0007; Tue, 19 Jan 2021 19:06:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 7267E6B0005 for ; Tue, 19 Jan 2021 19:06:25 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 417BE8249980 for ; Wed, 20 Jan 2021 00:06:25 +0000 (UTC) X-FDA: 77724211530.12.boys72_2903b8827556 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 1C71718054902 for ; Wed, 20 Jan 2021 00:06:25 +0000 (UTC) X-HE-Tag: boys72_2903b8827556 X-Filterd-Recvd-Size: 11759 Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400087.outbound.protection.outlook.com [40.107.140.87]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 00:06:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MiZigMBo4V4G/KsbM67aag+X/Qhlo5+nq11oBR580ZocXPKwmXxm1VkE9SD4grkFwUe5cOMTewm+7MRYrPQUVzrHMnXT8g3ltWk4NET2svjOwT1GvPdWNokIsMaTtHGT449Ht5J3Q1XUbiz6lQLqwG1zvK7+ATPutjuCjUytoHR+Ow3yRCtbh4pckujjdkmUtBF4EHbGPKh+Pomq5l3nhEVB0Vr1KAuvbD3/Gk6SNa0a0lJ1rS8BJShRNZixr270731axmd/m+YR5idh96KoHCHfceOs/wazgAsRJmoxRTs2R3f7tFp5BUm/Faot2QDFyPHdrtTJcznr6Fcd9x0KqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aPYl5sEfmOkKFt+7SGDL337tU5ChLM/VyNWuuV7hK6M=; b=Yc9puaK5JBjohijXdXRx62Z4kfbfJxPzO5NPO8fXntGQkjV9VrWVobqxDvP5aNEn46FHngxMsjo4Ni5239if7Vl3XqYXfbpV/+MurPzEArEO7iPIAspMMPmfl/DItTE75K/wPXyZaLXa/rxPo0PjuMpeuvOPyWvIH/+jYX0fARX6XWd3Ri98cR33pW5WPtKlU6maQuaEtZ00oUzrqse9XK3gDuQOzHV43nY17xmy9iK5QWKOpMDi6uDe2nKnYyrpJgHuD0y7/WYBRN1Z2DI0lsFgukHbFGIwqAjy2zfACdfOk3smCFITOHuoeCnHiB6s1wNZc9GEOg3m/lRPacJezw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nec.com; dmarc=pass action=none header.from=nec.com; dkim=pass header.d=nec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nec.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aPYl5sEfmOkKFt+7SGDL337tU5ChLM/VyNWuuV7hK6M=; b=aMARrkY5ZWG1mcfJreDCiAHmhuBgudijBsTczY+LoqNxv/4lonm3n7rntr7oXEAalcrDGhrICkUpfPY0vIwOG4DSzF1enEksO+eT3qLhCLoeaZY2OKjpuFVTIxIDcEyX3A377fxO7ArIvrrwDgIr6favV+jG0gXfsIYuMnFJtCQ= Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com (2603:1096:403:8::12) by TYAPR01MB2909.jpnprd01.prod.outlook.com (2603:1096:404:8a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9; Wed, 20 Jan 2021 00:06:14 +0000 Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com ([fe80::8453:2ddb:cf2b:d244]) by TY1PR01MB1852.jpnprd01.prod.outlook.com ([fe80::8453:2ddb:cf2b:d244%7]) with mapi id 15.20.3763.013; Wed, 20 Jan 2021 00:06:14 +0000 From: =?iso-2022-jp?B?SE9SSUdVQ0hJIE5BT1lBKBskQktZOH0hIUQ+TGkbKEIp?= To: Aili Yao CC: "linux-mm@kvack.org" , "osalvador@suse.de" , "YANGFENG1@kingsoft.com" Subject: Re: [PATCH v2] mm,hwpoison:Differentiate Action Required error in current and non current process Thread-Topic: [PATCH v2] mm,hwpoison:Differentiate Action Required error in current and non current process Thread-Index: AQHW7hnJXO0SuNUa0Ea5inAVtR+LDKovo+4A Date: Wed, 20 Jan 2021 00:06:14 +0000 Message-ID: <20210120000614.GA22376@hori.linux.bs1.fc.nec.co.jp> References: <20210119120956.7f901b76.yaoaili@kingsoft.com> In-Reply-To: <20210119120956.7f901b76.yaoaili@kingsoft.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: kingsoft.com; dkim=none (message not signed) header.d=none;kingsoft.com; dmarc=none action=none header.from=nec.com; x-originating-ip: [165.225.110.205] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0286def1-c0a5-4500-0dba-08d8bcd733f0 x-ms-traffictypediagnostic: TYAPR01MB2909: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: D/0iwxAjAvPny1xE/0dJ1ocwxIdI2KbE6iOkjXySccxF6QwRP0GXovx2kYwcSnqp1ve7/65gbqdwu/JQ5+ynLDInfMtQB8T2TzjYvNON9ux4j/Nz7asMHumqpzIjy8Uj01GnMM3zeG27K2LwkjQpU4KaC1G+86raCuX6Bc6BfYFGAj4wkj56JxGGilgf/AdHBSo4WhcSQ5UO3wWkuicUa1dG9JX9mzFetoESUsv/IvP7CBQZd8XB3iq1MC+4tpftYeS4WAedZlmJVwR7A+pDXGEAUj9xbKQ8lheaL8THFM7EWkMN+Gp513tKn5LiOwiyJqa3F2xLyCE91Ghb8x18nkprDoveER0avxEC7j0kS3c+u19NeB9JzZ6CJAjcW83r2fLaJ9AslYlJ+eCGKzNAQA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY1PR01MB1852.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(346002)(376002)(39860400002)(366004)(33656002)(1076003)(5660300002)(66446008)(2906002)(66946007)(26005)(71200400001)(85182001)(86362001)(64756008)(316002)(8936002)(66476007)(66556008)(6486002)(6512007)(76116006)(4326008)(6916009)(55236004)(8676002)(54906003)(9686003)(83380400001)(478600001)(6506007)(53546011)(186003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-2022-jp?B?N1JmZStGOVV2d2t0d1FMNW1QeDVybSs1ckJrY0xlUUFYL01TTXJRdkRl?= =?iso-2022-jp?B?VXhlM0R5aWYzZEM3dWpIeWd2Yk0ySXFHN2dFQWY5R1YxN1A1UG9ub2dS?= =?iso-2022-jp?B?UVhuMGsyMjRIbzRPOVRUMkVXWkNCUXZwS1dDdFljY2N1bXlmTUdXQU5u?= =?iso-2022-jp?B?M1Q2WjlXT1ljdFI2bTQvQzlpZ055QjBLSDRSMW9ZNUYzd2lhaEU1N1NN?= =?iso-2022-jp?B?cHhFR2thMHpNak1uOUVHeUswQy9hSHEvVWtsMFBTVFc3QjFMbHZOME1D?= =?iso-2022-jp?B?dFhxRHd1eDlvYmJUZDVpejl4M1ExZ0swMkRYdjJ3eVFndkxXaTU1eEFy?= =?iso-2022-jp?B?Q3RHYS9pcEdXdjd3RkZSZjI0bVNaWkxSQmh5U3FVWWpDR3VVV3lZUGZo?= =?iso-2022-jp?B?UFdxVWVhTXArK0Z0TEViU0wvOVFvSUl6ci9pNFpCM2pIemQ1T3RvOXZD?= =?iso-2022-jp?B?TEx4Y3RtRjJuT3lrS2FrTHNBUUFaSzZrOHlvUnp1UnBzU3NtZ2dPcEtP?= =?iso-2022-jp?B?dDRaVFZmcjI0amR0eERqVHI2VUY4Mkc2ZkpGMEMyWWdraTN2bDFqNkxF?= =?iso-2022-jp?B?TzE4cGxXejFNUURzY01ObVF1SlNLRHBIaStoUDI5L1FZek5uei81WjF5?= =?iso-2022-jp?B?SStNTHBFRjFCVTY0Mm1DOXBJTXN0UVNqekRMTmRXTlphc202dVhGVCta?= =?iso-2022-jp?B?V3JOT2dMOStSK052ZEp6M2pCQVNWeDNIT3pVRkpKb0VKY0lueVUra1pG?= =?iso-2022-jp?B?aWxTcmp5TGwwYUZ4cHJqRlpJeHB5bFZycDN3SElRT1JxbTh4eFJyWkNQ?= =?iso-2022-jp?B?cFVHSmdCaGVPeHNXYXRNa0lvVU5pNjMyRytxUG8zN3ArOEo0YWR1TXBr?= =?iso-2022-jp?B?ZzhXd1BNS2VWV2hqNWtwbzFrSGc5b1RVamFmTlJpRzlmQVVkREViOE1I?= =?iso-2022-jp?B?RndBMi9OK29IcUZOOFVOdnk1cjJCaGNVQythTDExZjR3MlFzL1AzVnN4?= =?iso-2022-jp?B?Ylg0S3dIcXdsdHRRTkt3dWQxMXRtS1VZNC8vYlZKYlpoRXV2dnFGU0c4?= =?iso-2022-jp?B?eGxEOEFuY2k4Yko5UUxuMDIvY1pFU0dYMFdhVGNOSXliVC8vVTg4Vk15?= =?iso-2022-jp?B?aGJreHVQYWt3SjkzeCt1VVhpRVdsN3VmNnVGd2laQ1BpdklHWE1rSnc3?= =?iso-2022-jp?B?YzJtcGdKSldrT2lOYzdKd3FjSVUveURGZ01KRU85MVZ0WG0zQzN4Sy91?= =?iso-2022-jp?B?c1VndzFSSGtMWlI4dHYxRU84YXBNRFhyb3Bidi9WK1NzZ21sM0d4OVB4?= =?iso-2022-jp?B?MzZPTUliZm1KM25lSlhSUFMyWEF0ZjZIWitJNVVvMzNjUFNFWDBGMWVj?= =?iso-2022-jp?B?UGpMTUp1QmhvUzlSTFJvenA0RWtHWWd0NElXcDBwdEZLZmNOMWNhQ2xP?= =?iso-2022-jp?B?Q25TV1FSNjVOUnBHVXJZSg==?= Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <191FF93E7B21AB40ADC0243A4038995C@jpnprd01.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nec.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TY1PR01MB1852.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0286def1-c0a5-4500-0dba-08d8bcd733f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2021 00:06:14.7986 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: e67df547-9d0d-4f4d-9161-51c6ed1f7d11 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: OCwXHXsYxmmN6Eg+H7nfhsfFAJBTIPFvrlXUTOwITLaRVNxB9TQD5uE+F0JONd2PigN5UY4m/ajJz/q6C+VVCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYAPR01MB2909 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: Hi Aili, On Tue, Jan 19, 2021 at 12:15:30PM +0800, Aili Yao wrote: > Hello,From 6f7f0582509e1b2aaa23e06868fee96f024e9551 Mon Sep 17 00:00:00 2= 001 > From: Aili Yao > Date: Tue, 19 Jan 2021 11:46:50 +0800 > Subject: [PATCH] mm,hwpoison:Differentiate Action Required error in curre= nt > and non current process You don't have to add these header info into patch description because git can get them from email headers. # scripts/checkpatch.pl shows some warning due to these. >=20 > When a memory uncorrected error is triggered by process A 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, kill current > process will be sufficient, other process sharing the same page will > get be signaled when they really touch the poisoned page. >=20 > 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. >=20 > So in this patch, task_early_kill will check current process if > force_early is set, and if not current,check find_early_kill_thread > to see if there is PF_MCE_EARLY process which cares the error. >=20 > In kill_proc, BUS_MCEERR_AR is only send to current, other process in > kill list will be signaled BUS_MCEERR_AO. >=20 > Signed-off-by: Aili Yao > --- > mm/memory-failure.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) >=20 > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 5a38e9eade94..808ff7c24f38 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -243,9 +243,12 @@ static int kill_proc(struct to_kill *tk, unsigned lo= ng pfn, int flags) > pfn, t->comm, t->pid); > =20 > if (flags & MF_ACTION_REQUIRED) { > - WARN_ON_ONCE(t !=3D current); > - ret =3D force_sig_mceerr(BUS_MCEERR_AR, > + if (tk->tsk =3D=3D current) > + ret =3D force_sig_mceerr(BUS_MCEERR_AR, > (void __user *)tk->addr, addr_lsb); > + else > + ret =3D send_sig_mceerr(BUS_MCEERR_AO, (void __user *)tk->addr, > + addr_lsb, t); > } else { > /* > * Don't use force here, it's convenient if the signal > @@ -391,10 +394,14 @@ static void kill_procs(struct list_head *to_kill, i= nt forcekill, bool fail, > * signal and then access the memory. Just kill it. > */ > if (fail || tk->addr =3D=3D -EFAULT) { > - pr_err("Memory failure: %#lx: forcibly killing %s:%d because of fail= ure to unmap corrupted page\n", > - pfn, tk->tsk->comm, tk->tsk->pid); > - do_send_sig_info(SIGKILL, SEND_SIG_PRIV, > + if (tk->tsk =3D=3D current) { > + pr_err("Memory failure: %#lx: forcibly killing %s:%d because of fai= lure to unmap corrupted page\n", > + pfn, tk->tsk->comm, tk->tsk->pid); > + do_send_sig_info(SIGKILL, SEND_SIG_PRIV, > tk->tsk, PIDTYPE_PID); > + } else if (kill_proc(tk, pfn, flags) < 0) > + pr_err("Memory failure: %#lx: Cannot send advisory machine check si= gnal to %s:%d\n", > + pfn, tk->tsk->comm, tk->tsk->pid); This seems to change (maybe beyond the intent of this patch) the behavior o= f action optional events, i.e. without this patch all processes on to_kill li= st receive SIGKILL. but with patch SIGKILL is sent only to current (if it happens to be linked to to_kill list) and any other processes on the list receive SIGBUSs. Any justification on this change? This code path is for failure in error handling, where we can't do anything more. So I think that just killing all affected processes with SIGKILL as we do now is the expected behavior. > } > =20 > /* > @@ -457,8 +464,6 @@ static struct task_struct *task_early_kill(struct tas= k_struct *tsk, > */ > if (tsk->mm =3D=3D current->mm) > return current; > - else > - return NULL; Please update the comment above this function about action required case. Thanks, Naoya Horiguchi=