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 9B211C433DB for ; Wed, 20 Jan 2021 06:37:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA9522313B for ; Wed, 20 Jan 2021 06:37:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA9522313B 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 ED0436B0005; Wed, 20 Jan 2021 01:37:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E80176B0006; Wed, 20 Jan 2021 01:37:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D22046B0007; Wed, 20 Jan 2021 01:37:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id B914B6B0005 for ; Wed, 20 Jan 2021 01:37:09 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7CEBD8249980 for ; Wed, 20 Jan 2021 06:37:09 +0000 (UTC) X-FDA: 77725196178.10.tin59_230e88927558 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 5BC8E16A0AE for ; Wed, 20 Jan 2021 06:37:09 +0000 (UTC) X-HE-Tag: tin59_230e88927558 X-Filterd-Recvd-Size: 11596 Received: from APC01-PU1-obe.outbound.protection.outlook.com (mail-eopbgr1320089.outbound.protection.outlook.com [40.107.132.89]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 06:37:07 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ydow5CXI/ut/CvjKLZ70m+9yWA7I9BmOHEzH9E2aSuWdK3AXFQBU6LA3YSwfRM7xayrs0oBrMJU5VLHnKRPZJu0nOscXqm+mkzIMDSouK/IEpHNOR52gJAuwE3zv1LCrD3Axuos0eDB9YEV6ZAgD67+PktHonbte9wDC7Ab14oEMDhduRwaCwMXoQATwmv52K/KPgjRCNt43eBkOa1wX+g0n0Q3RBym6ARrVl7aAJsUbGxpIfY3H+TMulVaSnipRt2zV4Uwtnh6l/xAV893ageopcsLeE7CTPX5L2V8lI5g0eMvrZp3yk0WY/PLdAaxwAj9RxxeOcl7rkW7IMQ+gQA== 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=w38f6T8tuiRADLGyNW6GqlteVzpLxtR71t0bqgnbr40=; b=H3CkZGoY5SSqpVYUSOZDWxq7U+5pharNyJaTK0Due6pmLLN0DrNhle1WanUYn7HNB4stknmBfgh7XRLfynzyD6c+tl51oppp+Fw801YhgjpvjszP1jJYPOMyhEIyA0pHkv+8aNI2/D72Ec//4LAov1r/7PvF1WAyvJQT7XCrJDnyFAs8Up6N+gwtMtnGHvU1jNTJXjVTaxn8r4BIvIO+YNptfmFpUfQaI0iWagmTsX9HSgElTePv9mwuRDjx9DVDksdvSOVGf0Rp9FJJbESuLNt00cSMzN9PbII5zXgeR6P8nVC9SETPmj5XoFwp2ZGyft4s6jUH3R/bL/i0tXO8nw== 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=w38f6T8tuiRADLGyNW6GqlteVzpLxtR71t0bqgnbr40=; b=NZwsbSGdYhBgd5Gh+PLF1UBTw7YKZhulEtuSKRr+pwyQ2nLOSPCUdmvugv5qNo4uB5LYODJrBsEhNhJOdA3iFhBKJG4V5c1KTT4om0SovRolPzPwOgY4/fPSj1vj+SrUhzG9TWjhpPw09mUVWOmFSfPMNh45HTIVE63t8OgynHI= Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com (2603:1096:403:8::12) by TY2PR01MB2699.jpnprd01.prod.outlook.com (2603:1096:404:7b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Wed, 20 Jan 2021 06:37:04 +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 06:37:04 +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 v3] mm,hwpoison: Differentiate Action Required error in current and non current processes Thread-Topic: [PATCH v3] mm,hwpoison: Differentiate Action Required error in current and non current processes Thread-Index: AQHW7vOhu8cs9SZLOEi9ST3ChpBHQaowD2yA Date: Wed, 20 Jan 2021 06:37:04 +0000 Message-ID: <20210120063703.GA31442@hori.linux.bs1.fc.nec.co.jp> References: <20210120141509.47969d56.yaoaili@kingsoft.com> In-Reply-To: <20210120141509.47969d56.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: fb516c94-acd4-44cf-521e-08d8bd0dcced x-ms-traffictypediagnostic: TY2PR01MB2699: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dRv01m/gy/y9pd+k+/WlL1Tar5EgRAlpzesqm6rYrTvIzkUKqP7ogyHWS8VKUJc8LkhxtCJeRKtOk71zDeWdGCVwBNa1v4eKDg+b4mU9L4jSg50SmpreruYogEYO5cz0n3WQE+8KXgjZ30KDd5cmOhRS5QVuhMtNHlSQ7uWtVlyoi3BR32tw5cIftsah/8m3in8g6CElVS+UE/uelFyd27p7+MtpUZHhiKcEyPQObWoaFroyisbn5ZNqlBDSX8IjQ0V11vD3Ri8lsSkIgFRzWwfPEjL0NcLXLkcxrpi9hi+p/lFfU8FbYHYwSMtapKUHDGjoa7kgSLoljLx3lCN9W9uYf9gFpVFP1bo/P6HcdVw/1H8GKI+DFD/44y03MBjSm/j85kTNwKoRpJm1Fnyx9J0x4vWZ5GKFb8+mTSSrY08D8Yq/T/BqWUeqbpf/tkSg5To5N+Nq6Z+GO3o/7jqXTg9T6M+NPPsMhH1I316Cz0ZsnlVufA9/SW9pQzmp6UUBsEmesYEoJGxEPZQsoeflo01yCN/OOfbOtf16EUtP7xxy1E529bIdnQ2G1lljzAqvPFkuCJMDSVpog1nLC4TYdbH0P5g/CbsmnG2gLkHm69c= 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)(376002)(396003)(346002)(366004)(39860400002)(136003)(6486002)(71200400001)(6512007)(76116006)(5660300002)(316002)(9686003)(2906002)(1076003)(66946007)(66446008)(26005)(66556008)(8676002)(64756008)(6506007)(8936002)(55236004)(966005)(33656002)(54906003)(83380400001)(6916009)(186003)(86362001)(4326008)(66476007)(478600001)(85182001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-2022-jp?B?cFZkRW9DQW1kbFZBcmVIaWc3alVRcWNCQlBGNkdFeFJLdUZYTGhTdlVm?= =?iso-2022-jp?B?eDZGMkhhNHJ4Q0VRQWVHakJRbENJYnlEY1Q0T3k3S0g4UUxOa1BKekFE?= =?iso-2022-jp?B?K2Z0V2ZHalNtTWtWaGZZQnVJOHZJN0hLd1dvWUZyY1ZHYm55ZysreWJ6?= =?iso-2022-jp?B?azBoNVVLdTAyK3hFdXpGYWJJVnFTWWViYWVhL3RlZmhORzkrT08wOXU2?= =?iso-2022-jp?B?WkdEU3pWN0RHWUxzdEF2bitxV2txT2xudXdHYlhKWGhGamsvc2Z5NzUw?= =?iso-2022-jp?B?cjhRaVJ6U3M1b3JZV0hWb0dmMWVaUTVZZHh1L0FlMzVKKyt2dlpWTHBw?= =?iso-2022-jp?B?bGl5M1JXSjFJWWEzd29MdW1mZGZoRktXYy9lTHhQWTV0cTdiZFk0L1BP?= =?iso-2022-jp?B?V3hrMEJTejMzcUw1YWFYOHVzeE9OdUJySmw0Rm4vdzc1M0V5dDdIeWxi?= =?iso-2022-jp?B?TDhMcHJ5TWhSL0I0Z0VIQW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-jp?B?NG05Mm1UNHZXNEYvc2d4WDlYSkRMbExrWVRXaXp5VDlqZEFvZU85cjQv?= =?iso-2022-jp?B?YU83UDZaaE1XaVZ0V082Zw==?= Content-Type: text/plain; charset="iso-2022-jp" Content-ID: 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: fb516c94-acd4-44cf-521e-08d8bd0dcced X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2021 06:37:04.2215 (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: fbt6rn53o6FwP+XK4k7B2/GosBo34XpatbGHhzCi5ROWxV/mv1nsKNwvIx1eerDa+KV7alUSX/25GJRwmaZL3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR01MB2699 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 02:15:09PM +0800, Aili Yao wrote: > 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 > Reviewed-by: Naoya Horiguchi > Reviewed-by: Oscar Salvador "Reviewed-by" tag has some special meaning in Linux kernel development, and that should be tagged explicitly by reviewers. So please wait a little more to add this :) See the document for more details: https://www.kernel.org/doc/html/v5.10/process/submitting-patches.html#using= -reported-by-tested-by-reviewed-by-suggested-by-and-fixes > Signed-off-by: Aili Yao > --- > mm/memory-failure.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 5a38e9eade94..2d6047780466 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 > @@ -454,11 +457,12 @@ static struct task_struct *task_early_kill(struct t= ask_struct *tsk, > /* > * Comparing ->mm here because current task might represent > * a subthread, while tsk always points to the main thread. > + * If tsk is not current, we need to fallback to > + * find_early_kill_thread checking whether other processes with > + * PF_MCE_EARLY set still care the error. > */ Sorry for my unclearness, I meant to ask for updating the comment below (es= pecially "Note that ..." part), which gets obsolete by your patch. > /* > * Determine whether a given process is "early kill" process which expe= cts > * to be signaled when some page under the process is hwpoisoned. > * Return task_struct of the dedicated thread (main thread unless expli= citly > * specified) if the process is "early kill," and otherwise returns NUL= L. > * > * Note that the above is true for Action Optional case, but not for Ac= tion > * Required case where SIGBUS should sent only to the current thread. > */ > static struct task_struct *task_early_kill(struct task_struct *tsk, > int force_early) > { Thanks, Naoya Horiguchi > if (tsk->mm =3D=3D current->mm) > return current; > - else > - return NULL; > } > return find_early_kill_thread(tsk); > } > --=20 > 2.25.1 > =