From patchwork Mon Mar 30 17:57:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 11466173 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 8F41D1668 for ; Mon, 30 Mar 2020 17:57:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F5482073B for ; Mon, 30 Mar 2020 17:57:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="kR36fS77" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F5482073B 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 4B3AD8E0005; Mon, 30 Mar 2020 13:57:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 43E8A8E0001; Mon, 30 Mar 2020 13:57:55 -0400 (EDT) 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 32DFF8E0005; Mon, 30 Mar 2020 13:57:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 1C5DB8E0001 for ; Mon, 30 Mar 2020 13:57:55 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BE66E8248D52 for ; Mon, 30 Mar 2020 17:57:54 +0000 (UTC) X-FDA: 76652786868.08.smell84_ac1d497f4f2d X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jgg@mellanox.com,,RULES_HIT:30012:30054:30070,0,RBL:40.107.13.82:@mellanox.com:.lbl8.mailshell.net-62.14.84.32 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:72,LUA_SUMMARY:none X-HE-Tag: smell84_ac1d497f4f2d X-Filterd-Recvd-Size: 11197 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130082.outbound.protection.outlook.com [40.107.13.82]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Mar 2020 17:57:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0N2tCImxz8xPLtAw92sN+BVAR1FMyCDKUJxak0yo4xlPj3uMhLKiy1AEvCXAp2tGw7YjP9Xg+ZscH9mQHjlFYq/SOR1p6MPIRjI/HGoHtTxgY23pbr3RNYyobw4qBKVI71JlpI0z5MqtQif+vKxsRRTyE/UmiSJTipSgrS0kOLMz8GFXXIKtNCCn6Bkmq1o8+olL5v0O8ihkgSRD9/ro+RHnFdCjiXuG19QksLqzu59aGWbizG3WMfcvkLcuWq86aC9brwd+WYqt65jsyn587XhOvzEcu06e9916xYHCHOpPN5mMRRj8lPuqEozJ+FFQZIGqMR+Txp5ZavamvP1dQ== 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=R2fNT6WPbvGT4O2cVXJBTUxrPfCnKkoN4KIgzkkCOuU=; b=nY3LgtVYOGJeg36hvvW5pKJY9JWmzuKFZ36I0r+40zHmaOdaS2C0baiHAb5e8LeTjFDh62WVs/Z1WvCs5hlmK/WzEWZFyPaK0o2NycdKyNphA25KlU13Gvwz1/PmaefjUTqq4kffT2R6ceA9FNUqciQq007t8VwUVksjP1TYb2kTMedPEfHXRsNnldCBA/Lp7Ds7IQe3ArJC8tt9uigAm3JKAhvyY/0lS+xC5LOkNr78GpDarvORGMWEvt/vFXcf/jcX7J67V7zrk3iRB/er0Y+eS5eBsA8pTT2kOJyoErbjGEtckcyge9g6sbNfIwRVwBvnytBn/Pl8dFSRrECSFw== 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=R2fNT6WPbvGT4O2cVXJBTUxrPfCnKkoN4KIgzkkCOuU=; b=kR36fS77RW8XIriFGqKLRptaDjF6fibUU4SOImJ+74eyHIvXqBTJzcLnMY4E4nO57yW7A7b+JhwmeotmWIIEMb6SkhsENSPd+NBgvknSi5cXDuHMZn1JESN+qrWnQNE3VZfK63oJn+edWHIWZ0j9n4CsX980U4eqg4g2QJgG3Xo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jgg@mellanox.com; Received: from VI1PR05MB4141.eurprd05.prod.outlook.com (52.133.14.15) by VI1PR05MB4942.eurprd05.prod.outlook.com (20.177.51.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20; Mon, 30 Mar 2020 17:57:51 +0000 Received: from VI1PR05MB4141.eurprd05.prod.outlook.com ([fe80::18d2:a9ea:519:add3]) by VI1PR05MB4141.eurprd05.prod.outlook.com ([fe80::18d2:a9ea:519:add3%7]) with mapi id 15.20.2856.019; Mon, 30 Mar 2020 17:57:51 +0000 Date: Mon, 30 Mar 2020 14:57:48 -0300 From: Jason Gunthorpe To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Andrew Morton , linux-mm@kvack.org Subject: [GIT PULL] Please pull HMM changes Message-ID: <20200330175748.GA32709@ziepe.ca> Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: MN2PR19CA0025.namprd19.prod.outlook.com (2603:10b6:208:178::38) To VI1PR05MB4141.eurprd05.prod.outlook.com (2603:10a6:803:44::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.68.57.212) by MN2PR19CA0025.namprd19.prod.outlook.com (2603:10b6:208:178::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Mon, 30 Mar 2020 17:57:51 +0000 Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jIyfU-00005x-1N; Mon, 30 Mar 2020 14:57:48 -0300 X-Originating-IP: [142.68.57.212] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 63b8f37a-5b20-4300-9a01-08d7d4d3dd34 X-MS-TrafficTypeDiagnostic: VI1PR05MB4942: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1850; X-Forefront-PRVS: 0358535363 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR05MB4141.eurprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10009020)(4636009)(366004)(396003)(39860400002)(346002)(376002)(136003)(9746002)(9786002)(21480400003)(186003)(1076003)(8676002)(9686003)(36756003)(81166006)(52116002)(5660300002)(86362001)(44144004)(66946007)(66476007)(66556008)(2906002)(316002)(478600001)(6916009)(4326008)(33656002)(26005)(81156014)(8936002)(24400500001)(2700100001);DIR:OUT;SFP:1101; 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: eI3m7ro8CN9blgAryv2/kMnqFhMR+1xfpwzwGu259EF9nYJSYGWadknaZ3WxcoWAbQxKoQpGWttATXoaZe3bQeejnJPHXcWfOhtqwCOtKcaK+su55S1z5Iloc4UGja5McQIRE1uESq1pX5DcIeM8bxCor0Y0dRzhHFT/BkDtZkGfCavAxwtTnRbnc3A2Nf9bDNSD5mvlfdDcJ4Cl4MFWectoz8pQXUodwUeRrThLtlrVePEFjo0UyLC5pzBHpPxZNZPZqhMJgR2PMibIIyB1sF9MU/Uyq1UU0CkJ6kyzGJwddj/qVsEr8zSbsqJzXskrNYZHSXhX2ItLNIlNGYlSXclxjP5apR4lAojlbY9wz9C+YzoovZIGFTjV03MrL06FgEb5nvQ8nak74/MljrdVWisrxLBRD82Oc/772V3/w33Hkeg5v2yraUWfwnnJZ1rTFtR7n7adwgJyEj1YRsZgydrk/0N6jwWuSTJfeG8A9UFIEKarWpvAVYFkL8Mwygnlo+g8NvDEViFa3h4uAO425w== X-MS-Exchange-AntiSpam-MessageData: 7kYFlGD8ljrOKMImAA3TE7+0e538HauXCT4DptZn29kNUvQRAsc0jbqg2aYCoxuUDLkTtnEm3X8BQwTNb5GB3prbS51PLi/twiUKUq6EPHl+HbXF1tU4aP+Gk4Zh/sYbhc+IDZ5Ebg8AmBAJoAD9BQ== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63b8f37a-5b20-4300-9a01-08d7d4d3dd34 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2020 17:57:51.2013 (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: qsnPmrjBtypGYHeb729fbMCEGhLDFtKK5OiMEVk7dUR/JwCsJOfcGGSAkIaEyhHXKt5qlasKb7n/urW/1ZZKNw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4942 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, This series arose from a review of hmm_range_fault() by Christoph, Ralph and myself. Several bug fixes and some general clarity. hmm_range_fault() is being used by these 'SVM' style drivers to non-destructively read the page tables. It is very similar to get_user_pages() except that the output is an array of PFNs and per-pfn flags, and it has various modes of reading. This is necessary before RDMA ODP can be converted, as we don't want to have weird corner case regressions, which is still a looking forward item. Ralph has a nice tester for this routine, but it is waiting for feedback from the selftests maintainers. Regards, Jason The following changes since commit f8788d86ab28f61f7b46eb6be375f8a726783636: Linux 5.6-rc3 (2020-02-23 16:17:42 -0800) 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 9cee0e8c6f1eb4b5e56d3eb7f5d47b05637bab4f: mm/hmm: return error for non-vma snapshots (2020-03-27 20:19:25 -0300) ---------------------------------------------------------------- hmm related patches for 5.7 This series focuses on corner case bug fixes and general clarity improvements to hmm_range_fault(). - 9 bug fixes - Allow pgmap to track the 'owner' of a DEVICE_PRIVATE - in this case the owner tells the driver if it can understand the DEVICE_PRIVATE page or not. Use this to resolve a bug in nouveau where it could touch DEVICE_PRIVATE pages from other drivers. - Remove a bunch of dead, redundant or unused code and flags - Clarity improvements to hmm_range_fault() ---------------------------------------------------------------- Christoph Hellwig (9): mm/hmm: don't provide a stub for hmm_range_fault() mm/hmm: remove the unused HMM_FAULT_ALLOW_RETRY flag mm/hmm: simplify hmm_vma_walk_hugetlb_entry() mm/hmm: don't handle the non-fault case in hmm_vma_walk_hole_() mm: merge hmm_vma_do_fault into into hmm_vma_walk_hole_ memremap: add an owner field to struct dev_pagemap mm: handle multiple owners of device private pages in migrate_vma mm: simplify device private page handling in hmm_range_fault mm/hmm: check the device private page owner in hmm_range_fault() Jason Gunthorpe (17): mm/hmm: add missing unmaps of the ptep during hmm_vma_handle_pte() mm/hmm: do not call hmm_vma_walk_hole() while holding a spinlock mm/hmm: add missing pfns set to hmm_vma_walk_pmd() mm/hmm: add missing call to hmm_range_need_fault() before returning EFAULT mm/hmm: reorganize how !pte_present is handled in hmm_vma_handle_pte() mm/hmm: return -EFAULT when setting HMM_PFN_ERROR on requested valid pages mm/hmm: add missing call to hmm_pte_need_fault in HMM_PFN_SPECIAL handling mm/hmm: do not check pmd_protnone twice in hmm_vma_handle_pmd() mm/hmm: remove pgmap checking for devmap pages mm/hmm: return the fault type from hmm_pte_need_fault() mm/hmm: remove unused code and tidy comments mm/hmm: remove HMM_FAULT_SNAPSHOT mm/hmm: remove the CONFIG_TRANSPARENT_HUGEPAGE #ifdef mm/hmm: use device_private_entry_to_pfn() mm/hmm: do not unconditionally set pfns when returning EBUSY mm/hmm: do not set pfns when returning an error code mm/hmm: return error for non-vma snapshots Documentation/vm/hmm.rst | 12 +- arch/powerpc/kvm/book3s_hv_uvmem.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +- drivers/gpu/drm/nouveau/nouveau_dmem.c | 19 +- drivers/gpu/drm/nouveau/nouveau_svm.c | 3 +- include/linux/hmm.h | 125 +-------- include/linux/memremap.h | 4 + include/linux/migrate.h | 8 + mm/hmm.c | 476 +++++++++++++------------------- mm/memremap.c | 4 + mm/migrate.c | 9 +- 11 files changed, 227 insertions(+), 439 deletions(-)