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=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 4A8D1CA9EB7 for ; Mon, 21 Oct 2019 19:25:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 03B4A20873 for ; Mon, 21 Oct 2019 19:24:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="gOHsp8Bw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03B4A20873 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 93DA16B0003; Mon, 21 Oct 2019 15:24:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8ECFE6B0006; Mon, 21 Oct 2019 15:24:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B3F86B0007; Mon, 21 Oct 2019 15:24:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 54A926B0003 for ; Mon, 21 Oct 2019 15:24:59 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id E9D12612E for ; Mon, 21 Oct 2019 19:24:58 +0000 (UTC) X-FDA: 76068769476.04.root51_82a5ca6bb2e35 X-HE-Tag: root51_82a5ca6bb2e35 X-Filterd-Recvd-Size: 7731 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40048.outbound.protection.outlook.com [40.107.4.48]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Oct 2019 19:24:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfJ6wjHu7g425Q21cDn+cGxHfT5EuFjueq7gKzD7F2fzaDcW9DuvTl9TtZvE+xKYSwijELzbWzhqHP0dVeMlKzKDfN6hSEaoXthWiAE5MaETddI37Ybj8/EaL/b39O9s9UTM6hQFbE9xdvuHYrQdFhZ4Nx9SZ25NfdiTLLIgNv0JRLootQeRRoUcKVUUGQaknrVpN7xvajt9gFa7zUIoiMErau9TkfgXqQrjmjhcu377+AdyDD0D3Bi+uG5A+fSM/Rp44H7OB2pnREDhI21A9UZrmH+o0hGGcdSG6kuD4NrHe7g1yfA0sM0GAtwoZCTSNnERH7f0hdyV0fCCraF8xg== 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=1dhDTpAku16PKEX8QPygpkn/ME6Oi9YMZPMT/TaQauo=; b=GxnqFpLcoEONx91iTtrMK8N5/ltULyD8qscPxeMNv7+zc93YUoCAHzpKiFJZzkdCLxOx+AcJ/4YJQXAryhsqNJJC4yPY0a1uFYE82qJrjOLnC/YpkWYPK6K9SfTyHVpYON54dy/al+1qlTD9U2uYlFXZ9ModD8UDVGdFOlS8bOBH2ZqAh4HzGmUVLnvJrsEduR1R+gxdlJgoqbb+zWMQHzi0NzIrsCyzBwu5G57Zrw+WhRuPHltmjYWWv9GLA8ryYvbMvs+gQxDadzCIlezU+UfmaByRgPJGj4B2ihXFlThZxXYVe37wVBr4jFzfI5CoZ0R2ixZ4A5wAEK/gRallkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1dhDTpAku16PKEX8QPygpkn/ME6Oi9YMZPMT/TaQauo=; b=gOHsp8Bw9gJpeplQWvLjcTwn11zwNNxnNNrfnnbbHmcDUbenZoid3kK0nyaCfucFf4Y6JvwOjOvi9QqnAP1bx4vEKuKnWJzoChKTWibUJUiot8VHF+pt3pp9c18E4uGZeqgJFEbWryKpSRZTN+7cJ5qFyxmTwShZVa3tjaOFuR8= Received: from DB7PR05MB4138.eurprd05.prod.outlook.com (52.135.129.16) by DB7PR05MB5659.eurprd05.prod.outlook.com (20.178.104.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Mon, 21 Oct 2019 19:24:54 +0000 Received: from DB7PR05MB4138.eurprd05.prod.outlook.com ([fe80::18c2:3d9e:4f04:4043]) by DB7PR05MB4138.eurprd05.prod.outlook.com ([fe80::18c2:3d9e:4f04:4043%3]) with mapi id 15.20.2347.028; Mon, 21 Oct 2019 19:24:54 +0000 From: Jason Gunthorpe To: Jerome Glisse CC: Ralph Campbell , John Hubbard , "Felix.Kuehling@amd.com" , "linux-rdma@vger.kernel.org" , "linux-mm@kvack.org" , Andrea Arcangeli , "dri-devel@lists.freedesktop.org" , "amd-gfx@lists.freedesktop.org" , Ben Skeggs , Michal Hocko Subject: Re: [PATCH hmm 02/15] mm/mmu_notifier: add an interval tree notifier Thread-Topic: [PATCH hmm 02/15] mm/mmu_notifier: add an interval tree notifier Thread-Index: AQHVg4SuHCkuEaFxsk60wlfA7oiQWadldFEAgAAGi4CAAATrgIAAA5cA Date: Mon, 21 Oct 2019 19:24:53 +0000 Message-ID: <20191021192448.GK6285@mellanox.com> References: <20191015181242.8343-1-jgg@ziepe.ca> <20191015181242.8343-3-jgg@ziepe.ca> <20191021183056.GA3177@redhat.com> <20191021185421.GG6285@mellanox.com> <20191021191157.GA5208@redhat.com> In-Reply-To: <20191021191157.GA5208@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BL0PR02CA0049.namprd02.prod.outlook.com (2603:10b6:207:3d::26) To DB7PR05MB4138.eurprd05.prod.outlook.com (2603:10a6:5:23::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=jgg@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [142.162.113.180] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 04351a75-d219-4bc1-7c39-08d7565c5966 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: DB7PR05MB5659: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 0197AFBD92 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(346002)(136003)(376002)(366004)(39860400002)(199004)(189003)(81166006)(3846002)(6116002)(6436002)(5660300002)(52116002)(229853002)(6246003)(256004)(14444005)(1076003)(6916009)(6486002)(99286004)(4326008)(86362001)(25786009)(6512007)(8676002)(8936002)(81156014)(7416002)(2616005)(7736002)(36756003)(305945005)(66066001)(54906003)(11346002)(386003)(71190400001)(316002)(71200400001)(14454004)(66946007)(66476007)(66556008)(64756008)(66446008)(33656002)(486006)(476003)(102836004)(26005)(2906002)(76176011)(478600001)(446003)(186003)(6506007);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR05MB5659;H:DB7PR05MB4138.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uaW6dNXYv7f3Ty85RklRU7AQ9DISFCeTPUPObjm/eHP0KgJ9Wnx5A1Xir48dKXFwUS1rpcUMnUwf7IbAW0h1veKC7PvTf6TKFk1NUB+ctqzyQyqiviARQYhK73CGvjNnLrPb9OM8bzAfLvZ30osqKLlBvKNrjYWEqV5+rsU/Yd9saZkad70JWmq5m2CPkABL5/UJqqYd29y/m2GYOtvYuxc9xIryL4aDrvBvKr2tTtm8kNxUgSl8UGuaqzVwP3hoJxNaOrVGH/96MxQ9fEekO/YyglfwERt14UDx0iXFzPr6WrBnMiQszjNKFhvVYSBcGASexBAauvJeTGinow6SsqYmg8JzNtt7zspSXc5Qj7hbrZqXcPT8hv3b34HWa8JucVcjUJrvy0wUVc9r7kM4pdtdXhYDYVTtsjQCSvb2eNeqnGQ5dSelX/9AOadV3jGB x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-ID: <0EDBBF2131C9044CB11AA3ED64A52B60@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04351a75-d219-4bc1-7c39-08d7565c5966 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2019 19:24:54.0488 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: sb3rhz5F375UQWwYODHTQPl9MFhe8HNVlx/hkgyRSMie0HtCOIpI0qlukbcHGu3V4ud7QdBEoTn05ZSsKuuFrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB5659 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 Mon, Oct 21, 2019 at 03:11:57PM -0400, Jerome Glisse wrote: > > Since that reader is not locked we need release semantics here to > > ensure the unlocked reader sees a fully initinalized mmu_notifier_mm > > structure when it observes the pointer. >=20 > I thought the mm_take_all_locks() would have had a barrier and thus > that you could not see mmu_notifier struct partialy initialized.=20 Not sure, usually a lock acquire doesn't have a store barrier? Even if it did, we would still need some pairing read barrier.. > having the acquire/release as safety net does not hurt. Maybe add a > comment about the struct initialization needing to be visible before > pointer is set. Is this clear? * release semantics on the initialization of the * mmu_notifier_mm's contents are provided for unlocked readers. * acquire can only be used while holding the * mmgrab or mmget, and is safe because once created the * mmu_notififer_mm is not freed until the mm is destroyed. * Users holding the mmap_sem or one of the * mm_take_all_locks() do not need to use acquire semantics. It also helps explain why there is no locking around the other readers, which has puzzled me in the past at least. Jason