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 B406AC433E0 for ; Thu, 4 Feb 2021 07:28:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1C65B64F44 for ; Thu, 4 Feb 2021 07:28:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C65B64F44 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 588FE6B0005; Thu, 4 Feb 2021 02:28:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 538A46B006C; Thu, 4 Feb 2021 02:28:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B3586B006E; Thu, 4 Feb 2021 02:28:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 231FE6B0005 for ; Thu, 4 Feb 2021 02:28:09 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A40B2181AEF1E for ; Thu, 4 Feb 2021 07:28:08 +0000 (UTC) X-FDA: 77779756656.22.cream46_3914404275da Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 862F618038E67 for ; Thu, 4 Feb 2021 07:28:08 +0000 (UTC) X-HE-Tag: cream46_3914404275da X-Filterd-Recvd-Size: 12012 Received: from JPN01-TY1-obe.outbound.protection.outlook.com (mail-eopbgr1400078.outbound.protection.outlook.com [40.107.140.78]) by imf11.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 07:28:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JHggNdI5R+EpIRw6zvja+19u2K2+yKcBUg1i3aMs7vuOOV/5dmOC5Q3DfhKz3bi4rGuPovcLgky/I1eWEyiH1mWJehM0Ltrta1+bL8eWdUD+tgrn2EuKfME2dYtsGoVa+8EknL7S6JHBi+XsyID9bd2mU0CM9lezdM0UJRrYeYk3mhwIArgkLGncva23v8ki27/gGm+sb0HS/uH4NbHNTu6/AxqqNNHPG/y2T6nUunLnGuMP+HvYPuy7dUegX/EJg8ySBWO8qpnrCM7qSjIxAzKCEeEV9Jzhad8VYWoJNZnK+4Ng79vwB1Pm2KBDt8iHapjxU1DFY7jQ1/HNp/2cWQ== 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=t6teBTrudqMycsa9eBPAb9korXH7RtGLT16P86Bkc+4=; b=dkR/+zcqcjyYtEPHzGOZRSoBK3Gscnp+69WUyZTxtMdYPTnKTNR6QWcsz9ySIdYVSpPayp35ElzhQVCa2VE1Mc0a9v2bpylezG6lFBWb08Wl6aYhSO6SXTUValfbnjdmQw+Zl96tmj78zwYNAJRyQ6wA/5vhUuvl+dsJbfWFaqS+OZvZ+DYZFNgtpeIDRddnZ7z5uv3V6J6SvPKG+WEeUlDG99x02Hv9AKhYBZ+PM4APHblYRMl8oHZ9JH+m73u2asWcBv+QF1PGGRhIobJ0/NFxxlS4yJgiwZHvXvSlciqL5RzSz4L6hVxM50SBDHG91Q0HMNA7TbJg19C2o51tQg== 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=t6teBTrudqMycsa9eBPAb9korXH7RtGLT16P86Bkc+4=; b=JFQ2x1ncdV6DxUvzgAdThIBIjblqzzy3GSZBm3sQdlxBW9u+A7cY46uC/h1sCHEs6sV4dNuxCTY5vTP/CSa/k9zKDUT7m7VydtawTgr5c6ALI8xnTwMntkpzkDGK1XSH6JwzHKD0Ldp33TQWcyjZiVJK2PYAHj2IPggpMa/qhcs= Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com (2603:1096:403:8::12) by TYBPR01MB5344.jpnprd01.prod.outlook.com (2603:1096:404:802f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.19; Thu, 4 Feb 2021 07:28:03 +0000 Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com ([fe80::1d15:6a82:ea9b:5101]) by TY1PR01MB1852.jpnprd01.prod.outlook.com ([fe80::1d15:6a82:ea9b:5101%6]) with mapi id 15.20.3805.024; Thu, 4 Feb 2021 07:28:03 +0000 From: =?iso-2022-jp?B?SE9SSUdVQ0hJIE5BT1lBKBskQktZOH0hIUQ+TGkbKEIp?= To: "akpm@linux-foundation.org" CC: Aili Yao , "osalvador@suse.de" , "linux-mm@kvack.org" , "YANGFENG1@kingsoft.com" Subject: Re: [PATCH v6] mm,hwpoison: Send SIGBUS to PF_MCE_EARLY processes on action required events Thread-Topic: [PATCH v6] mm,hwpoison: Send SIGBUS to PF_MCE_EARLY processes on action required events Thread-Index: AQHW8H7f5tTBaOadlk+BQqtRWAazRapHrYwA Date: Thu, 4 Feb 2021 07:28:03 +0000 Message-ID: <20210204072802.GB22850@hori.linux.bs1.fc.nec.co.jp> References: <20210122132424.313c8f5f.yaoaili@kingsoft.com> In-Reply-To: <20210122132424.313c8f5f.yaoaili@kingsoft.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: linux-foundation.org; dkim=none (message not signed) header.d=none;linux-foundation.org; 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: 437cfcdd-d9c2-4921-4a24-08d8c8de6899 x-ms-traffictypediagnostic: TYBPR01MB5344: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: P2RSC0e8q7mlSd9obkQQoePqewxH2C9Lx+zO41nZzl3mve8lQuDngpGRmP2InOXpVlUuzammUoy59x7sVBIR8Qp3odYd6Kwe4Kb4rN3GJYzf2nEVOmWEzMdQVOBc+uL5Q1AHFYhBYKuv2ZdNNRIxvKw0QccRorF/2FEwT69Gur25DMizPn2/9USHIJQQvleu0nwDk9LUdUnU8ixE6uoCj7tvvnvKKuGQctlf9CUNrmOgk7uohAIP0B7c25cn9ugwEWlXVukncTXGvAtldSAilKedf5c/sj15+GsGSlbImRXfztNOdueVpAIeBi17TCzlcaWWfNnRHRWvSSHbnc98PjU63Hvck5Vn47Tz3xEMhkQ0ZXLo50m5lbYGXTlFGR+LGweZtOpTRFbQ1sc3v1ZvC4aP9Yy/NQRs5wat3YXuLdyE/eZh3BQpgwFI1+xnEUfjTo76RA3A0JFjdapsycasrdxp8umcwJ4Ac2S4Hgjch4NmtbhtEEvRDp6EkDzwZ5lAmvyz3eLX5KLZ/LvesLF5ng== 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)(366004)(376002)(39860400002)(346002)(136003)(478600001)(6916009)(4326008)(85182001)(76116006)(54906003)(316002)(66556008)(83380400001)(66446008)(64756008)(66476007)(186003)(66946007)(8936002)(26005)(55236004)(8676002)(71200400001)(86362001)(33656002)(6506007)(5660300002)(9686003)(6512007)(1076003)(2906002)(6486002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-2022-jp?B?K3BLek9sRmt3aFhMWWtmaWU1MUVob1VvdG1RWUpIUXlGakFIM2swaEha?= =?iso-2022-jp?B?OCtpcnZQd05QY0tDMVZ5MHB1RzJnYWdRcFRxWTFCZE5pS3Z4UFlROWd5?= =?iso-2022-jp?B?dE52VVVzWER2SkxvRmVtUm11cUM5bUNmS2xERjVFcXNSY3BYRDROU0x0?= =?iso-2022-jp?B?ZXE4RFJ5VWJienhNeDJtUytHS1BOY0RkODVaOWFFSEM1Sm1vUFlJb25E?= =?iso-2022-jp?B?aG9CdW1yMU9GZ3hpR2JUMEY3L1Fkb0hRb3lOYXNacFdZclBWUFIzUDJh?= =?iso-2022-jp?B?bEtkNjJvZVc2YmQvdWJLZkVqbmVtY1F1b3hGSmZoVkp2OE4vdEZYdndN?= =?iso-2022-jp?B?cGpBVHAxVUo0Uld3N3l1S3hRMFpUajUxK3NWc3VnNThtWk14M2MwMzF2?= =?iso-2022-jp?B?cFQ1R1hsUWdvdFNxVjhBOUtLU05QSTdoQmEyRFNaUjh1U2ZBUkMySDJa?= =?iso-2022-jp?B?Z3JvTmVyV21lMm9rb3UyZEY4MWljdERpeEJHZmtaSkQ2bU5DdXlrcFFX?= =?iso-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yV2pJUHRa?= =?iso-2022-jp?B?N2t2b3RQcHovZUFGa0pXRlo0TkRrc2R5WkVLbEszQTF2cXYzdWYyOEFX?= =?iso-2022-jp?B?bTJpKzhXK21GV2EyQ0FOcTRpcWpzQzV5ZVpHempWSUNLdmFzL09xck9C?= =?iso-2022-jp?B?cVBXek45N3JDMjJBeFZiM3JnPT0=?= Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <75005F37B145E841BD50B00197BDA16C@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: 437cfcdd-d9c2-4921-4a24-08d8c8de6899 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2021 07:28:03.5346 (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: JWK48nPtH/fZI5uN6IlHIyY3mJDAVgsYp29Sa7tn6XBIRxUx8rFRiHhp2iZGt12klXYCNqSNrYAJ3N9+Nd9+FQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYBPR01MB5344 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 Andrew, This patch is worth going to mainline for next merge window. So could you queue this to your tree? Thanks, Naoya Horiguchi On Fri, Jan 22, 2021 at 01:24:24PM +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. >=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,the code will fallback to > find_early_kill_thread() to check if there is PF_MCE_EARLY process > who cares the error. >=20 > In kill_proc(), BUS_MCEERR_AR is only send to current, other processes > in kill list will be signaled with BUS_MCEERR_AO. >=20 > Reviewed-by: Oscar Salvador > Acked-by: Naoya Horiguchi > Signed-off-by: Aili Yao > --- > mm/memory-failure.c | 34 +++++++++++++++++++--------------- > 1 file changed, 19 insertions(+), 15 deletions(-) >=20 > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 5a38e9eade94..3fd483e6c2fb 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -243,9 +243,13 @@ 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 (t =3D=3D current) > + ret =3D force_sig_mceerr(BUS_MCEERR_AR, > (void __user *)tk->addr, addr_lsb); > + else > + /* Signal other processes sharing the page if they have PF_MCE_EARLY = set. */ > + 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 > @@ -440,26 +444,26 @@ static struct task_struct *find_early_kill_thread(s= truct task_struct *tsk) > * Determine whether a given process is "early kill" process which expec= ts > * to be signaled when some page under the process is hwpoisoned. > * Return task_struct of the dedicated thread (main thread unless explic= itly > - * specified) if the process is "early kill," and otherwise returns NULL= . > + * specified) if the process is "early kill" and otherwise returns NULL. > * > - * Note that the above is true for Action Optional case, but not for Act= ion > - * Required case where SIGBUS should sent only to the current thread. > + * Note that the above is true for Action Optional case. For Action Requ= ired > + * case, it's only meaningful to the current thread which need to be sig= naled > + * with SIGBUS, this error is Action Optional for other non current > + * processes sharing the same error page,if the process is "early kill",= the > + * task_struct of the dedicated thread will also be returned. > */ > static struct task_struct *task_early_kill(struct task_struct *tsk, > int force_early) > { > if (!tsk->mm) > return NULL; > - if (force_early) { > - /* > - * Comparing ->mm here because current task might represent > - * a subthread, while tsk always points to the main thread. > - */ > - if (tsk->mm =3D=3D current->mm) > - return current; > - else > - return NULL; > - } > + /* > + * Comparing ->mm here because current task might represent > + * a subthread, while tsk always points to the main thread. > + */ > + if (force_early && tsk->mm =3D=3D current->mm) > + return current; > + > return find_early_kill_thread(tsk); > } > =20 > --=20 > 2.25.1 > =