Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2143276pxb; Mon, 8 Mar 2021 15:45:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/UFiOpIaBNK4JQT7k964gFrKQxkhH2Z0yp34MgX1aX8BUI/mD5nDlcx5CWCT+bkMqonpz X-Received: by 2002:a17:907:2661:: with SMTP id ci1mr17248211ejc.403.1615247126566; Mon, 08 Mar 2021 15:45:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1615247126; cv=pass; d=google.com; s=arc-20160816; b=vpqVg1uD0QPGn5e+lA9uM1jnESChF2DRlScDjlGzm/DtX6JS1VQUx+At+D4vgvEAB6 6Z6LNnWUxv7+zchsnHdUkPzHsPGl9PKfknIRP0R+EcvirQgmKh4nyRulDJ7OKICC7l8k 95VcCawLcfolanvmZk+55AVVMRD0H4Iw+lNBsU0IDEmHi9ZrJ8yEOkDp53qLJFAzdD/Z eEzFj8wvg5qWj2lBOK5N40cdK4CUNtCQK3M7StRCjMgRqz5C2ZvTvPlqRdEuCaAJcvx3 YTAvDUR2hPcq07dckDOAvKycvllu478dJjf3PydM4Kmh+y6C7Dqyoq8FC1BphgRWSDJ3 uZ7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=4sbeVvZPvOxX8VhFrUAp6OySwB9TM4k5Rfud+FFWsK8=; b=n6RCe7Nh8PucqXaVvzHzBtJO39jBXeV37MIb+0oQ+3SvMzVrIQtuxnvQSwCtNw8CHQ gAaSw5Ui6P5hdOHIEqkWjlduUnV3tBh3zBTvx6X68XS4jQu6E8dtb1rthjHVmyKQHOo6 2LQ8YUGyZKbhlGrCqyfgJNeVVgs2W/ocFDLFTnwGWfMJmy0K7dDloA3JjtFBo1oN1E3D bJgqc+NPb2Uwn52FTLQGKQlJ6BYgr27k2ZherPe/Jm7jKlhthVdFDBfrsk6+IQKEANuF ty8X5G3Dl0LUv5icpn8OReKG77S3XKLRGom6JLrf3/IqYFZwLDqCWyvH4mS3uN/Q+eZp 7xEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nec.com header.s=selector1 header.b=ebN8DtBc; arc=pass (i=1 spf=pass spfdomain=nec.com dkim=pass dkdomain=nec.com dmarc=pass fromdomain=nec.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si7799526ejx.104.2021.03.08.15.45.04; Mon, 08 Mar 2021 15:45:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nec.com header.s=selector1 header.b=ebN8DtBc; arc=pass (i=1 spf=pass spfdomain=nec.com dkim=pass dkdomain=nec.com dmarc=pass fromdomain=nec.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231958AbhCHXnL (ORCPT + 99 others); Mon, 8 Mar 2021 18:43:11 -0500 Received: from mail-eopbgr1320043.outbound.protection.outlook.com ([40.107.132.43]:26208 "EHLO APC01-PU1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231307AbhCHXmw (ORCPT ); Mon, 8 Mar 2021 18:42:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RsUM1fNj2MI834AtvzdhRCb+2qL3f9UnWRPzWR29W44BT+YmOOiRwwZjKOYegYgfHU6L37ULrU6NMYRPSauL7HH8WfsemqAxk5A8X8kEcpDZKcP8o557VZyA+fH4ftgwNWgKie9ujnk29MZeI8K2zUm7w7xREyV0Un0L3mOi7JH+PNo8Eu/A3SBySGVY5P2yQWhdDRcnsFEoiC4QQ3nwwawEp9POc7VKzomOaeCBvIabcMwTBeiMUM0Oce1N1BYGOdPPKQgZ2nqx5xj3GijGK5ZWmmAX4W4Vs2CGqzHQrplwDZg1gp2z2JB+MczY9VMB52Ac/pOsmcz1EyTHXdVZ/Q== 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=4sbeVvZPvOxX8VhFrUAp6OySwB9TM4k5Rfud+FFWsK8=; b=G6H7lnKW2rQKKpJrsvzYQulqwU7PDSpC5QB7dOpqguNBfffVIKAQVrVOcTNhILzmEDeLBT0N99ADPUx5P2kjCM/HuIzM3Ap3b/13i5084XVKZzRkFnNrR5r9eU7Ah8V2Y1vtjAvNNraxUOVdZ0fpyAnsi5gXHewhUQZj+36QCCJzBSsJ+GZOU58BhkeVUooLMjqyytbHtCX2gq/hFFbugAEpAnET2XlKNmZdPgo3L3gdMNvH7Xhvze0YAwNdDKMxd8v64lg5EauNW+G1fxg/gymfEFKPf3kUVpQFhN2GvvG0RCTVE0SRFiqbkc1BHC6x7GBHB7HzuPRkgIV85A7Anw== 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=4sbeVvZPvOxX8VhFrUAp6OySwB9TM4k5Rfud+FFWsK8=; b=ebN8DtBckeJa90H8ADg8NaD3ks65a6V6q+qPzxjO+DEvVvPwE0GaJhQPHCGiPfsmuoLIdcKCQMy4t6QeYuE9CqkKmGMAJgZnYIzLz58cNj7j3l5ZlBEcV8l6UAThzki5rjwIia07w9MUPv7qZZtjUFp+DMrYfRs3spL/N5QjdZg= Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com (2603:1096:403:8::12) by TY2PR01MB2091.jpnprd01.prod.outlook.com (2603:1096:404:10::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.19; Mon, 8 Mar 2021 23:42:41 +0000 Received: from TY1PR01MB1852.jpnprd01.prod.outlook.com ([fe80::1552:1791:e07c:1f72]) by TY1PR01MB1852.jpnprd01.prod.outlook.com ([fe80::1552:1791:e07c:1f72%7]) with mapi id 15.20.3912.026; Mon, 8 Mar 2021 23:42:41 +0000 From: =?iso-2022-jp?B?SE9SSUdVQ0hJIE5BT1lBKBskQktZOH0hIUQ+TGkbKEIp?= To: "Luck, Tony" CC: Aili Yao , Oscar Salvador , "david@redhat.com" , "akpm@linux-foundation.org" , "bp@alien8.de" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "yangfeng1@kingsoft.com" Subject: Re: [PATCH] mm/memory-failure: Use a mutex to avoid memory_failure() races Thread-Topic: [PATCH] mm/memory-failure: Use a mutex to avoid memory_failure() races Thread-Index: AQHXFG4a6KBUueS0DE2O2dOaNXi1CKp6wJiA Date: Mon, 8 Mar 2021 23:42:41 +0000 Message-ID: <20210308234240.GA23822@hori.linux.bs1.fc.nec.co.jp> References: <20210304121941.667047c3@alex-virtual-machine> <20210304144524.795872d7@alex-virtual-machine> <20210304235720.GA215567@agluck-desk2.amr.corp.intel.com> <20210305093016.40c87375@alex-virtual-machine> <20210305093656.6c262b19@alex-virtual-machine> <20210305221143.GA220893@agluck-desk2.amr.corp.intel.com> <20210308064558.GA3617@hori.linux.bs1.fc.nec.co.jp> <3690ece2101d428fb9067fcd2a423ff8@intel.com> <20210308223839.GA21886@hori.linux.bs1.fc.nec.co.jp> <20210308225504.GA233893@agluck-desk2.amr.corp.intel.com> In-Reply-To: <20210308225504.GA233893@agluck-desk2.amr.corp.intel.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.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: 91b83d85-00c0-4a4a-622a-08d8e28bdd68 x-ms-traffictypediagnostic: TY2PR01MB2091: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qUeepDzDlLdevqLYkFkqya5YOKENVvHK7zZI5TCVCb0KGw8QyPikcBeCBC//2vI0youxKkF3jDMow1IkPER0w15Yit3fkEjs38rtKSn4UP7lTImzJdBJaeadyCsDZuZPO+xd8W/hnpM1HClsGOvhuxz5vyXGkeAwIeF5UiMqwRUBqt4fHggY3UnmyM/SCCLFzxwoQZGlOYMG4mPHX1gQF+qUONI12udjWIgYvkVZR8kkDNvi6oyCWNOHXDqTHDv9CAVf87Ft9XPJGzohm+6UBOXdzgqIn5/jYRaG8K1s9dX+cmFti3uCQgBe+6sVG9zElyFV7uVca67DMo9X6t5FBbU7GpNtDeXFNPM7HZHqYOdm89XpUhPVJasCzo318GgNneTLXkmDehcueo5SDIVUQ/hikc5kDCGqZRw+KhweX3Y2gnrzO8aUq2nVuDi4f9T+cdqhtSjI4iiAQQCKEigfnX5FzI52JYI/kQ8el4tVXsZrtGzcwVKbhvB1PKusPwosO91H3p7PeVOdWT9AXUXkXA== 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)(346002)(136003)(376002)(366004)(39860400002)(396003)(33656002)(6512007)(54906003)(8676002)(8936002)(83380400001)(86362001)(76116006)(186003)(66476007)(55236004)(6506007)(9686003)(4744005)(316002)(85182001)(71200400001)(6916009)(4326008)(478600001)(66556008)(1076003)(2906002)(6486002)(7416002)(66446008)(26005)(5660300002)(64756008)(66946007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-2022-jp?B?UjgrTFJaNytLRVlsWTZrV3VPalhtb3JVQWVNYi80eXJUREVDdnZmVzBE?= =?iso-2022-jp?B?OGhMRHZhdUxpMGlJY3M2ZWlqNkNRMk1jaTREdHMzTXJ0UDRRV3NvSExn?= =?iso-2022-jp?B?QXViZlZnaGpTUnBUSjNveEhNMGNaSUpSZ0JMNFFBZnFsbWpLdkFRVDFy?= =?iso-2022-jp?B?cjBxR3BCZld2SU5USGt2TVIvQzVQUWI4STZNeE1tQTllU3lzTnZrOUhp?= =?iso-2022-jp?B?R3lZRUlJSDB4b1dnM2p2cWgwUFlTUSs0dGUzL1IvaHNoWmRvKzgzNi9z?= =?iso-2022-jp?B?Wm9QWGZjTE53NUlmc3pMU0U0NkhPUWZDUmZxRlJhUmRVT2Zib0plWGlh?= =?iso-2022-jp?B?bHVWWDU3T2k1U1l6N1o0OG1YQ3NCd2lZV1dPd1NtdWMxdm1wajRuRGh0?= =?iso-2022-jp?B?UElacjRDNjhmU3IzdVpzYzI1R0FqTVBwRTZRYTFwZUtYUUx4Ry8vK1dP?= =?iso-2022-jp?B?cHRibkNpRkRKdVh4dWMvbFlObUVmR3FEOUdQK0txYU53TGRPWlluY1Q4?= =?iso-2022-jp?B?cTJUejg2S0drcDJsWk5yQXRSYjRkaTJWdkovOWN4Z215ZjNNUHl3ZWxZ?= =?iso-2022-jp?B?WU9sR1lHV1Rtd01FUWFjV1g1L3Y4ZnpKSTQvaFlhT3hINU44eVRmZHgz?= =?iso-2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drQ25Gc0Ez?= =?iso-2022-jp?B?NGVGeUpza1Jvd2NPSGJlbFMxWm92VnRpUnBKOFZTTk42cjgrWXBLaXJv?= =?iso-2022-jp?B?WmVSMndNMmNOQjNxb1dnY0luRVlkaHJkaEFBZitYZUN3b1ZaeGxVV3lV?= =?iso-2022-jp?B?ZmgxekpWQzRwTUdxdHIrRGNuY0JjTGpHK0VLY0tnb2I0WUVUYWFtNmlZ?= =?iso-2022-jp?B?aUE3YjFaWjVIVWZaRHhDZDNjWHVkMW9reHJuSy9vMDJlMDNWTlVGYWlM?= =?iso-2022-jp?B?L1B0OHVxUStlZVdvRDMxc1k2bzQrRTcrYm5ma2NsZ2VqTEVYUjNtdE5q?= =?iso-2022-jp?B?UUNqeEVPRlNQNlNJRlB3emdVY243VzlKcHVNb2RycUJTN01JbW40YVhZ?= =?iso-2022-jp?B?V0lzdjZBdEUvVVFuTUV3eWM2WlBDZz09?= Content-Type: text/plain; charset="iso-2022-jp" Content-ID: <9378190265DF474F9AAA164143487F83@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: 91b83d85-00c0-4a4a-622a-08d8e28bdd68 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2021 23:42:41.4613 (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: nQ9XrKS4AyGNfIZIxq/F8IS+Taw5Q1IodK2JQteABoxud/L2EZkN3nJIaw9dEEg/FqJLEEFbshub41B2uNdqdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR01MB2091 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 08, 2021 at 02:55:04PM -0800, Luck, Tony wrote: > There can be races when multiple CPUs consume poison from the same > page. The first into memory_failure() atomically sets the HWPoison > page flag and begins hunting for tasks that map this page. Eventually > it invalidates those mappings and may send a SIGBUS to the affected > tasks. >=20 > But while all that work is going on, other CPUs see a "success" > return code from memory_failure() and so they believe the error > has been handled and continue executing. >=20 > Fix by wrapping most of the internal parts of memory_failure() in > a mutex. >=20 > Signed-off-by: Tony Luck Thanks! Acked-by: Naoya Horiguchi =