From patchwork Mon Nov 25 20:42:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 11260825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA6F4138C for ; Mon, 25 Nov 2019 20:42:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6C77B2082F for ; Mon, 25 Nov 2019 20:42:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="lVzKMq/N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C77B2082F 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 8C0D16B0282; Mon, 25 Nov 2019 15:42:57 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 848A86B0283; Mon, 25 Nov 2019 15:42:57 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 711416B0284; Mon, 25 Nov 2019 15:42:57 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id 4A7016B0282 for ; Mon, 25 Nov 2019 15:42:57 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id D4FE78249980 for ; Mon, 25 Nov 2019 20:42:56 +0000 (UTC) X-FDA: 76195973952.28.scale86_53c4e002a242f X-Spam-Summary: 2,0,0,bb6fe8004dca744a,d41d8cd98f00b204,jgg@mellanox.com,:torvalds@linux-foundation.org:akpm@linux-foundation.org:dan.j.williams@intel.com:hch@lst.de:dri-devel@lists.freedesktop.org::airlied@linux.ie:daniel@ffwll.ch:amd-gfx@lists.freedesktop.org:felix.kuehling@amd.com:alexander.deucher@amd.com:rcampbell@nvidia.com:linux-rdma@vger.kernel.org,RULES_HIT:2:4:10:41:69:355:379:421:444:582:871:968:973:988:989:1000:1152:1260:1261:1313:1314:1345:1437:1516:1518:1575:1594:1605:1730:1747:1777:1792:1801:2194:2199:2393:2559:2562:2693:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4050:4250:4321:4361:4605:5007:6119:6120:6506:6653:6742:6747:7281:7808:7875:7901:7903:7909:8660:8784:8957:9108:10004:10967:11026:11232:11657:11658:11914:12043:12296:12297:12438:12519:12555:12663:12679:12683:12740:12895:13148:13161:13229:13230:13439:14096:14659:21060:21080:21324:21325:21433:21444:21451:21611:21627:21740:21966:30012:30054:30056,0,RBL:error,CacheIP:none,Baye sian:0.5 X-HE-Tag: scale86_53c4e002a242f X-Filterd-Recvd-Size: 16095 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80052.outbound.protection.outlook.com [40.107.8.52]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Nov 2019 20:42:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILkyMCajd2MfD+aKDK1LXf6ZoZbJUXnbg1c8VQ/lb/WUvdPvFSA3X362y4tkWszrWWv+Eomy7xtBGNzclScmQGhg+dCzfh7f3NkwEdCO9aoxnJzRKaenEBf1soxSskJsDV9Z+y9MEu02lqTqM7cIxpItxQBvAfh9rExzPZK+hVUo8UWSBY5d7PBIjWcuqxMm6hU1E9Aqx/ageRwknn3eJs/w6tmruZAbJMpMB70QzJysr2/TT6Iu1n9zCGsWbrqGg0ZBmiE1VUjQifq/l+AdpxPUfIbOpkznIxaN1rAZ/ojWu3/97ufGRRZYsGi+3SXdypkBhl85VzuNeZWUHbtpEw== 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=Y6bIlO9oaZ6ZTiIOf1I5ti10Jwuo5pKl0SThESxl3jA=; b=c43kB+rz3+lQzsUYTn9N9O8WqV/PPbP+plOw7dOrLasg+VYNS3UWBRID7bo1UxRcf5WJCjpznUC+0w6sonNoythDCaqbpLM6KvazmsDyjJp6ywlJFOWCXc65/7GEcuC/jdhgUKqibF2LeqPcBrFWcAllLwf9jYMNZBbtR4nswQs0BGWXGw3OqKRk3nnk98gNhZK/AVU5DyCLQV9HxZFgAUjE6VG3lSsabI0ZUIfOLXFKHcfoSjP+OgLYlMeQ7sLFb7dvGXFYDgiTu/ywbsgIKQDBgHf70smD07vwx9t5AGGxNsGloMJ67/TuJadWmtlCYA1A0DFLav/hs4OCT5opUA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y6bIlO9oaZ6ZTiIOf1I5ti10Jwuo5pKl0SThESxl3jA=; b=lVzKMq/N71gRvMa6zk0GfPg9z6YhAFf778fqnFNiorLa13UOdh6Wl7CCIsYxsZtlHVkjtU1Cf4glAGtwA6BEXg4oLs9ID/LJ/pXx+WR2GA0zDnWFstQPGehSRX+cfWFV7X6cJB+sR8hi/S0ZWTrPh6VAPQ8KG2Fa1bE10zQshuM= Received: from VI1PR05MB4141.eurprd05.prod.outlook.com (52.133.14.15) by VI1PR05MB3166.eurprd05.prod.outlook.com (10.170.237.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.16; Mon, 25 Nov 2019 20:42:52 +0000 Received: from VI1PR05MB4141.eurprd05.prod.outlook.com ([fe80::b179:e8bf:22d4:bf8d]) by VI1PR05MB4141.eurprd05.prod.outlook.com ([fe80::b179:e8bf:22d4:bf8d%5]) with mapi id 15.20.2474.023; Mon, 25 Nov 2019 20:42:52 +0000 From: Jason Gunthorpe To: Linus Torvalds CC: Andrew Morton , Dan Williams , Christoph Hellwig , "dri-devel@lists.freedesktop.org" , "linux-mm@kvack.org" , David Airlie , Daniel Vetter , "amd-gfx@lists.freedesktop.org" , "Kuehling, Felix" , "Deucher, Alexander" , Ralph Campbell , "linux-rdma@vger.kernel.org" Subject: [GIT PULL] Please pull hmm changes Thread-Topic: [GIT PULL] Please pull hmm changes Thread-Index: AQHVo9Dog/MtwM8aJU6I/7345tJKuA== Date: Mon, 25 Nov 2019 20:42:52 +0000 Message-ID: <20191125204248.GA2485@ziepe.ca> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-clientproxiedby: BL0PR02CA0064.namprd02.prod.outlook.com (2603:10b6:207:3d::41) To VI1PR05MB4141.eurprd05.prod.outlook.com (2603:10a6:803:44::15) 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-ht: Tenant x-ms-office365-filtering-correlation-id: 049f7868-2195-499d-00ef-08d771e80a9c x-ms-traffictypediagnostic: VI1PR05MB3166: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:341; x-forefront-prvs: 0232B30BBC x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(396003)(39860400002)(136003)(366004)(189003)(199004)(66556008)(71190400001)(54906003)(64756008)(33656002)(6506007)(6916009)(256004)(8676002)(26005)(478600001)(25786009)(9686003)(186003)(6512007)(52116002)(102836004)(305945005)(7736002)(4326008)(4001150100001)(66476007)(7416002)(386003)(66446008)(2906002)(5660300002)(8936002)(66616009)(66946007)(81156014)(81166006)(86362001)(6436002)(1076003)(99286004)(36756003)(6486002)(14444005)(14454004)(66066001)(316002)(3846002)(6116002)(71200400001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR05MB3166;H:VI1PR05MB4141.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A: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: YBQBbcZgnSrcyjFYNjBBi2CFsV3TODEknMzFzu5lbIPRByF089vXUilDaPrZ/42FntexzkVe/kjm8gleFdPBFxY0n9nZrLt4usoQVZdqJ0hr5TcIgWCMECGlNLzSZ7nrGTjqoNC5hN+NWG1OgcNy96HFgcinRz40qebRLiA4CoFMIW5+iWfE+tRZOEJ/KdnyUTKfQw0h4+5ixjeiqeKBGtLH7EDI3f3AUDcazcAwZOgS97745odbDryVWqlWA1E05nsKdoYgd9PpazLIRjgg6Q9BJRVjhxaDcWrH2J8ESQlRY3jIDEnkSYd7GC0WdRYzb/axUQNuOi2xbyj0GivvxSlIBrp5yoGXEhFJ2BkKkeIKKx/IW88pcQtEd2G2M0jJ6qax6HcYTFBBYMo/cA5u+RlOeOO5hZJbtJXXeOzIZOLZiJsif3UbhYx/0nw8Lf/WzbZBVcQVHFRoDLxudjNuSwrS7QzvHN64l6cuEgVij/7Q9Gum1TeA+uW0A2rUpOtYqNjDAokmLt6BdLmVM4QDIqa1tyojBulVwkQRBuGhROElo3qd18GB3eTcsWZt4eEjytKRVZM/QeyGtllzg8jIaywK7JUoHGxXg7KSrSn9zVjNpKEwe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= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 049f7868-2195-499d-00ef-08d771e80a9c X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Nov 2019 20:42:52.4789 (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: NeZdd2YN4mfhX0/mL5MaHT06CsE6ukZyg9YqqTt9hGfatCyoYrxNBRX5Jc2rVrHSZS22jURC6UC97Er6tFsa2Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3166 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 Linus, Here is this batch of hmm updates, I think we are nearing the end of this project for now, although I suspect there will be some more patches related to hmm_range_fault() in the next cycle. You will probably be most interested in the patch "mm/mmu_notifier: add an interval tree notifier". The approach here largely pre-exists in the various drivers, but is honestly kind of complex/ugly. No better idea was found, I'm hoping putting it all in one place will help improve this over the long term. At least many bugs were squashed and lines of code eliminated while consolidating. Already i915 GPU has posted a series for the next window that also needs this same approach. There are two small conflicts I know of, the first is RDMA related with -rc, the second is a one liner updating a deleted comment in GPU. Both can be solved by using the hmm.git side of the conflict. All the big driver changes have been acked and/or tested by their respective maintainers. Regards, Jason The following changes since commit d6d5df1db6e9d7f8f76d2911707f7d5877251b02: Linux 5.4-rc5 (2019-10-27 13:19:19 -0400) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git tags/for-linus-hmm for you to fetch changes up to 93f4e735b6d98ee4b7a1252d81e815a983e359f2: mm/hmm: remove hmm_range_dma_map and hmm_range_dma_unmap (2019-11-23 19:56:45 -0400) ---------------------------------------------------------------- hmm related patches for 5.5 This is another round of bug fixing and cleanup. This time the focus is on the driver pattern to use mmu notifiers to monitor a VA range. This code is lifted out of many drivers and hmm_mirror directly into the mmu_notifier core and written using the best ideas from all the driver implementations. This removes many bugs from the drivers and has a very pleasing diffstat. More drivers can still be converted, but that is for another cycle. - A shared branch with RDMA reworking the RDMA ODP implementation - New mmu_interval_notifier API. This is focused on the use case of monitoring a VA and simplifies the process for drivers - A common seq-count locking scheme built into the mmu_interval_notifier API usable by drivers that call get_user_pages() or hmm_range_fault() with the VA range - Conversion of mlx5 ODP, hfi1, radeon, nouveau, AMD GPU, and Xen GntDev drivers to the new API. This deletes a lot of wonky driver code. - Two improvements for hmm_range_fault(), from testing done by Ralph ---------------------------------------------------------------- Christoph Hellwig (1): mm/hmm: remove hmm_range_dma_map and hmm_range_dma_unmap Jason Gunthorpe (30): RDMA/mlx5: Use SRCU properly in ODP prefetch RDMA/mlx5: Split sig_err MR data into its own xarray RDMA/mlx5: Use a dedicated mkey xarray for ODP RDMA/mlx5: Delete struct mlx5_priv->mkey_table RDMA/mlx5: Rework implicit_mr_get_data RDMA/mlx5: Lift implicit_mr_alloc() into the two routines that call it RDMA/mlx5: Set the HW IOVA of the child MRs to their place in the tree RDMA/mlx5: Split implicit handling from pagefault_mr RDMA/mlx5: Use an xarray for the children of an implicit ODP RDMA/mlx5: Reduce locking in implicit_mr_get_data() RDMA/mlx5: Avoid double lookups on the pagefault path RDMA/mlx5: Rework implicit ODP destroy RDMA/mlx5: Do not store implicit children in the odp_mkeys xarray RDMA/mlx5: Do not race with mlx5_ib_invalidate_range during create and destroy RDMA/odp: Remove broken debugging call to invalidate_range Merge branch 'odp_rework' into hmm.git mm/mmu_notifier: define the header pre-processor parts even if disabled mm/mmu_notifier: add an interval tree notifier mm/hmm: allow hmm_range to be used with a mmu_interval_notifier or hmm_mirror mm/hmm: define the pre-processor related parts of hmm.h even if disabled RDMA/odp: Use mmu_interval_notifier_insert() RDMA/hfi1: Use mmu_interval_notifier_insert for user_exp_rcv drm/radeon: use mmu_interval_notifier_insert nouveau: use mmu_notifier directly for invalidate_range_start nouveau: use mmu_interval_notifier instead of hmm_mirror drm/amdgpu: Call find_vma under mmap_sem drm/amdgpu: Use mmu_interval_insert instead of hmm_mirror drm/amdgpu: Use mmu_interval_notifier instead of hmm_mirror mm/hmm: remove hmm_mirror and related xen/gntdev: use mmu_interval_notifier_insert Ralph Campbell (2): mm/hmm: allow snapshot of the special zero page mm/hmm: make full use of walk_page_range() Documentation/vm/hmm.rst | 105 +-- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 9 +- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 443 ++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h | 53 -- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 13 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 145 ++-- drivers/gpu/drm/nouveau/nouveau_svm.c | 230 +++-- drivers/gpu/drm/radeon/radeon.h | 9 +- drivers/gpu/drm/radeon/radeon_mn.c | 218 +---- drivers/infiniband/core/device.c | 1 - drivers/infiniband/core/umem_odp.c | 341 ++------ drivers/infiniband/hw/hfi1/file_ops.c | 2 +- drivers/infiniband/hw/hfi1/hfi.h | 2 +- drivers/infiniband/hw/hfi1/user_exp_rcv.c | 146 ++-- drivers/infiniband/hw/hfi1/user_exp_rcv.h | 3 +- drivers/infiniband/hw/mlx5/cq.c | 33 +- drivers/infiniband/hw/mlx5/devx.c | 8 +- drivers/infiniband/hw/mlx5/main.c | 17 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 29 +- drivers/infiniband/hw/mlx5/mr.c | 142 ++- drivers/infiniband/hw/mlx5/odp.c | 1004 +++++++++++----------- drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 - drivers/net/ethernet/mellanox/mlx5/core/mr.c | 28 +- drivers/xen/gntdev-common.h | 8 +- drivers/xen/gntdev.c | 179 ++-- include/linux/hmm.h | 190 +--- include/linux/mlx5/driver.h | 4 - include/linux/mmu_notifier.h | 147 +++- include/rdma/ib_umem_odp.h | 86 +- include/rdma/ib_verbs.h | 2 - kernel/fork.c | 1 - mm/Kconfig | 2 +- mm/hmm.c | 523 ++--------- mm/mmu_notifier.c | 557 +++++++++++- 37 files changed, 1912 insertions(+), 2789 deletions(-) Signed-off-by: Jason Gunthorpe